On this page
A HAR file can help a support team diagnose a failed request, but it can also expose information that was never meant to leave your browser. To redact sensitive data from a HAR file, start with its URLs, then review the rest of the capture: URL redaction alone does not sanitize the file.
This checklist uses fictional values and focuses on preparing a capture for an authorized recipient. The HAR specification and browser export instructions were not available to consult for this article, so verify the steps and export options against your browser’s current official documentation.
Key Takeaways
- Query strings can contain tokens, email addresses, search terms, and other private values. Paths can contain sensitive identifiers too.
- HAR files can also contain cookies, headers, request bodies, response bodies, and duplicated representations of URL data.
- Preserve the request method, endpoint, status, and timing where safe; replace secrets with consistent placeholders.
- Review the exported file itself before sharing it. Do not assume an export labeled as sanitized removed everything relevant to your case.
1. Capture only what is needed
- Confirm that the recipient is authorized to receive the capture and agree on a secure transfer method.
- Use a test account and fictional or non-sensitive inputs if they can reproduce the issue. Avoid collecting other users’ activity.
- Open your browser’s developer tools and select the Network panel. Clear existing entries, reproduce only the relevant issue, and export the network log as a HAR file. If the problem involves navigation or redirects, enable the option to preserve the log first.
- Check your browser’s official export instructions for the exact controls and any available sanitization options. Labels and export behavior can vary by browser and version.
- Store the original securely and work on a separate copy. The original may contain live credentials even if the copy is cleaned.
A smaller capture is easier to review. If reproduction requires an authenticated account, assume the export may contain sensitive session material.
Advertisement
2. Redact sensitive data from HAR file URLs
Inspect each request URL, including query strings, path segments, and any redirect destinations. Look for access tokens, session identifiers, email addresses, search terms, account IDs, and other values that could identify a person or grant access. Also inspect URL-bearing headers such as Referer and Location.
These fictional examples illustrate the change to look for; they are not complete HAR documents. Before redaction:
https://example.test/api/search?q=private+search&email=alex%40example.test&token=FAKE_TOKEN
After redaction:
https://example.test/api/search?q=%5BREDACTED%5D&email=%5BREDACTED%5D&token=%5BREDACTED%5D
Keeping the host, path, and parameter names can help the recipient understand which request failed and which inputs were present. Keep a value only if it is necessary for diagnosis and safe to disclose. Parameter names and paths can themselves reveal sensitive information, so redact those when needed too.
HAR request data may represent query parameters separately from the full URL. If you change the URL, check the corresponding queryString entries and remove the same sensitive values there. Likewise, a redirect URL can appear outside the original request URL. Avoid leaving contradictory or unredacted copies behind.
3. Sanitize the rest of the file
URL cleaning is only one part of the job. Review the copy as JSON, including fields not visible in a network-panel summary:
- Request headers and cookies: Remove or replace credentials in
Authorization,Cookie, API-key headers, and other application-specific headers. Inspect the structured request cookie entries as well as the headers. - Response headers and cookies: Check
Set-Cookie, redirect locations, and structured response cookie entries. Other headers can contain identifiers or private URLs. - Request bodies: Inspect form fields, JSON, and other
postDatafor passwords, tokens, personal data, and uploaded content. - Response bodies: Check
content.textand other captured response content for personal data, credentials, or confidential application data. Encoded content, including base64, may need separate inspection; a plain-text search is not enough. - Other metadata: Review page titles, page URLs, server addresses, and browser- or application-specific fields. Sensitive values may appear in unexpected places.
Replace secrets consistently when their relationships matter. For example, use [SESSION_A] for repeated appearances of one fictional session value and [SESSION_B] for another. Tell the recipient that the placeholders represent redacted values, not real credentials. Do not reuse real secret fragments as labels.
If a body or header is unnecessary for the investigation, remove or redact its sensitive content rather than trying to preserve every detail. Take care not to break the HAR structure; the recipient may need to import the file into a viewer. Sanitization can also make body sizes or other metadata inconsistent, so note substantial changes when those details matter to the investigation.
Advertisement
4. Preserve useful debugging context
Agree with the recipient on the minimum context needed. Depending on the problem, useful fields may include:
- The request method and endpoint, with sensitive path and query values removed.
- The response status and relevant non-sensitive headers.
- Request order, redirect relationships, and timing information.
- Parameter names or a non-sensitive substitute showing the shape of a request body.
There is a trade-off: replacing a value can obscure a bug caused by that exact value or its encoding. If that happens, try to reproduce the issue with a fictional substitute and explain what was changed. If the real value is essential, get explicit approval and use an appropriately secure channel rather than silently including it.
5. Perform a final review before sharing
- Open the sanitized exported copy, not just the browser’s display, and confirm it is valid JSON. Where practical, import it into the intended HAR viewer to check that the relevant requests remain usable.
- Search the entire file for known sensitive values and field names, including token names, email addresses, cookie names, authorization headers, and application-specific secrets. Search for encoded variants as well. Searches are a supplement to review, not proof that the file is clean.
- Check all copies of each sensitive value, including URL fields, query entries, headers, cookies, bodies, redirect data, and custom fields.
- Confirm that the recipient can understand the failure without the removed values, and document any redactions that affect interpretation.
- Send only the sanitized copy to the intended recipient through the agreed channel. Follow your organization’s retention and deletion rules for both copies.
If a live credential was included in a file already shared with the wrong recipient, treat it as exposed: revoke or rotate it and follow your organization’s incident process. Redacting a later copy does not undo the earlier disclosure.
Common Mistakes
- Cleaning only the visible URL: The same token can remain in a query entry, cookie, header, body, or redirect.
- Trusting a filename or export option: A file called “sanitized” still needs a review against the data and risks in that capture.
- Using a public online cleaner for a sensitive HAR: Uploading the original may disclose the data before it is cleaned. Prefer an approved local process.
- Removing all context: A capture without the failing request, status, or sequence may be impossible to troubleshoot. Coordinate on the minimum useful detail.
- Relying only on find-and-replace: Encoded values, alternate representations, and unfamiliar fields can evade simple searches.
Conclusion
Treat a HAR as a potentially sensitive record, not just a list of URLs. Capture narrowly, redact URLs and the rest of the file, preserve only useful context, and review the actual export before sending it.
What would your domain sell for?
A free TidyURLs account unlocks the Domain Estimator. It prices a name from 191,011 real domain sales.