Safeguard
Security Guides•

What should an error report scrub before it leaves your app?

Error reports often capture headers, request bodies, URLs and variables. A scrub list for crash and exception reports, with steps to verify what you send.

Safeguard Security Team
3 min read

Scrub credentials, session values, personal data, connection strings and full request bodies. Error reports collect more context than logs because they are meant to help you reproduce a bug, and that context is often exactly the sensitive part. Decide the fields in advance and test them.

What an error report usually contains

A typical report includes the exception message and stack trace, the request URL and method, request headers and cookies, parts of the request body, user details, environment names, and sometimes local variables. Each is useful for debugging, and each can hold a secret.

The OWASP Logging Cheat Sheet lists data to exclude or protect: session identification values, access tokens, passwords, database connection strings, encryption keys and primary secrets, payment data, and sensitive personal information. Error reports are a log destination with extra detail, so the same list applies.

Field by field

FieldRiskAction
Exception messageCan embed a connection string or a user valueReview messages, avoid putting values in them
Stack traceUsually safe, shows pathsKeep
Request URLTokens in query stringsStrip or mask the query
Request headersAuthorization, cookiesDrop sensitive headers
Request bodyPasswords, personal dataDo not send, or allow list fields
Local variablesAnything in memoryDisable, or allow list
User infoEmail, nameSend an opaque ID
BreadcrumbsRecorded clicks and inputsMask input values

Steps

  1. Read the configuration of your error reporting library. Find the options that control bodies, headers, cookies and variables, and turn off what you do not need.
  2. Add a scrubbing hook that runs before sending, so it applies to every report.
  3. Deny headers by name: authorization, cookie, set-cookie, api key headers.
  4. Mask URL query values with an allow list of safe parameters.
  5. Write exceptions without embedded values. Use a short message and put identifiers in separate, reviewed fields.
  6. Test with canary values. See test log redaction with canary values.
  7. Check where reports are stored and who can read them. Reports are often visible to the whole engineering group.

Mistakes we see

Treating an error tracker as an internal tool, so scrubbing is skipped. Leaving defaults on after an upgrade. Letting a developer paste a report into a public issue or chat. Retaining reports for a year when thirty days would do.

Related reading

For one framework's built in tools, see Django sensitive variables and error report secrets. For production debug pages, see what Django DEBUG True exposes in production.

Quick check

Is a stack trace sensitive?

Usually not by itself, but it reveals code paths and library versions. Restrict access, and avoid showing it to end users.

Should error reports include the request body?

Not by default. Use an allow list of fields if you need some of the body to reproduce bugs.

Safeguard's dependency scanning also covers the error reporting libraries in your SBOM. A free scan is at gold.safeguard.sh/scan.

Sources

Last reviewed: 19 October 2026.

Never miss an update

Weekly insights on software supply chain security, delivered to your inbox.

Self-healing security runs on Safeguard.

Your first fix PR is minutes away.

No sales call required, even your agent can complete the purchase over MCP.