Authorization, Cookie and API keys in a HAR: what is exposed
One-line answer: an authentication header in a HAR is a key that can resend that request. Treat Bearer tokens and session cookies with the same care as a password.
Authorization schemes
| Scheme | Shape | Risk in a HAR |
|---|---|---|
| Bearer | Bearer eyJ… (JWT) or an opaque string | Can be replayed until it expires. |
| Basic | Basic base64(user:password) | Decoding reveals the credentials outright. |
| Digest | Digest username=…, response=… | Harder to replay, but account identifiers are visible. |
| ApiKey | ApiKey <key> | Often valid indefinitely depending on the service. |
Cookie and Set-Cookie
The Cookie header carries the session ID the browser sends. Set-Cookie shows the session the server issued plus attributes (Path, HttpOnly, Secure, SameSite). The attributes make session policy easy to read, but a live value is equivalent to being signed in.
Keeping cookie names while masking values lets a reader tell a session cookie from a preference; clearing every value is the safer default.
X-API-Key and X-Auth-Token
These are service-specific names, not standards. Similar names carry different meanings and lifetimes, so a HAR alone cannot tell you when a key expires. Treat a visible key as exposed and ask the service owner whether it must be rotated.
A JWT is not encrypted
A JWT is three base64url parts: header.payload.signature. The signature prevents forgery, but anyone can decode and read the payload, including claims such as sub, scope and exp.
That is why masking only part of a JWT is not enough. harview replaces the whole three-part token that starts with eyJ with [REDACTED_JWT].
Why keep the scheme and the names
Keeping "Bearer [REDACTED]" shows which authentication method was used, and keeping cookie names shows which session system is in play. That helps debugging and is not the secret.
The value itself should not survive, not even its length: length is a hint about the token type.
If you find an exposure
- Revoke or rotate the token immediately.
- Search logs and stores for the same credential elsewhere.
- Tell the people you shared it with and distribute a new copy.
- Add a masking step to your HAR-sharing procedure so it does not recur.
Questions
What does decoding a JWT reveal?
The algorithm in the header and claims such as sub (user), scope (rights) and iat/exp (issued and expiry times). It is readable without verifying the signature, so identity and permission details are exposed.
Is Basic authentication safe because it is base64?
No. Base64 is encoding, not encryption; decoding gives the username and password directly.
Masking breaks reproduction. Is that acceptable?
Keep the original separately when you need to replay. A shared copy is for showing structure, not for replaying requests.
Sources
- RFC 6750 — The OAuth 2.0 Bearer Token Usage
- RFC 7519 — JSON Web Token (JWT)
- OWASP — Session Management Cheat Sheet
Every example here can be opened in the workbench as it is.
Open the workbench