HAR files contain cookies, auth headers, and tokens that can compromise security. Covers what to redact and how to sanitize before sharing.
A HAR file is a complete record of every credential your browser sent during a recording session. Session cookies, API keys, Bearer tokens, passwords in POST bodies, OAuth codes in URL query parameters. All of it sits in the file unencrypted. Browser DevTools have no built-in redaction filter. Chrome and Firefox export everything visible in the Network tab.
When you share an unsanitized HAR with a support engineer, a QA tester, or attach it to a public bug report, you are handing over the exact data needed to impersonate a user session. The 2023 Okta breach started this way. An attacker gained access to HAR files from support sessions, extracted cookies, and replayed them to access customer tenants.
When you record a HAR in Chrome DevTools, it captures:
The file is useful for debugging network issues. The problem is that it captures everything, including the fields that carry credentials.
The Cookie header in requests contains session tokens, authentication cookies, CSRF tokens, and tracking identifiers. Session cookies are especially dangerous because they grant immediate access to a user’s account.
{
"name": "Cookie",
"value": "session_id=abc123def456; csrf_token=xyz789; auth_token=eyJhbGc..."
}
The Set-Cookie header in responses may also contain sensitive values and flags:
{
"name": "Set-Cookie",
"value": "session_id=abc123def456; Path=/; HttpOnly; Secure; SameSite=Strict"
}
The Authorization header carries Bearer tokens, Basic auth credentials, and API keys:
{
"name": "Authorization",
"value": "Bearer eyJhbGciOiJSUzI1NiIs..."
}
{
"name": "Authorization",
"value": "Basic dXNlcjpwYXNzd29yZA=="
}
Basic auth is base64-encoded, not encrypted. The decoded value is user:password.
POST and PUT request bodies often contain credentials:
{
"username": "admin@example.com",
"password": "s3cr3t",
"credit_card": "4111111111111111"
}
API responses may also return sensitive data in the body:
{
"access_token": "eyJhbGciOiJSUzI1NiIs...",
"refresh_token": "dGhpcyBpcyBhIHJlZnJlc2ggdG9rZW4",
"user": {
"email": "admin@example.com",
"ssn": "123-45-6789"
}
}
URLs with tokens in query strings appear in HAR files:
https://api.example.com/auth/callback?code=abc123&state=xyz789&redirect_uri=https://app.example.com
Authorization codes and state parameters in OAuth flows are sensitive. They can be replayed to complete the authentication flow.
In October 2023, Okta disclosed that an attacker gained access to HAR files from Okta support sessions. The HAR files contained session tokens that the attacker used to access customer tenants. The attacker extracted cookies and headers from the HAR data and replayed them to impersonate authenticated users.
The HAR Viewer tool can highlight fields that likely contain sensitive data. Look for:
Cookie, Authorization, Set-Cookie, or any header containing token, key, secret, password, or authcode, token, state, session, or keypassword, token, secret, access_token, or refresh_tokenOpen the HAR file in a text editor and replace sensitive values:
// Before
{
"name": "Authorization",
"value": "Bearer eyJhbGciOiJSUzI1NiIs..."
}
// After
{
"name": "Authorization",
"value": "Bearer [REDACTED]"
}
For cookies, replace the entire value:
{
"name": "Cookie",
"value": "[REDACTED]"
}
For repeated sanitization, write a script:
import json
SENSITIVE_HEADERS = {"authorization", "cookie", "set-cookie", "proxy-authorization"}
SENSITIVE_QUERY_PARAMS = {"code", "token", "state", "session", "key", "secret"}
def sanitize_har(har_path):
with open(har_path) as f:
har = json.load(f)
for entry in har["log"]["entries"]:
# Redact request headers
for header in entry["request"]["headers"]:
if header["name"].lower() in SENSITIVE_HEADERS:
header["value"] = "[REDACTED]"
# Redact response headers
for header in entry["response"]["headers"]:
if header["name"].lower() in SENSITIVE_HEADERS:
header["value"] = "[REDACTED]"
# Redact sensitive query params
if "queryString" in entry["request"]:
for param in entry["request"]["queryString"]:
if param["name"].lower() in SENSITIVE_QUERY_PARAMS:
param["value"] = "[REDACTED]"
return har
Checklist:
Authorization headers and redact themCookie headers and redact themSet-Cookie response headers and redact themBearer, eyJ, password, secret, token)Nothing you paste leaves this tab. Every tool runs entirely in your browser — no upload, no server, no account.