Skip to content

Conversation

@jessarcher
Copy link
Member

@jessarcher jessarcher commented Sep 22, 2025

This PR introduces the capturing of request headers on inbound requests.

The following headers will be redacted by default:

  • Cookie - cookie names will be captured, but cookie values will be redacted.
  • Authorization and Proxy-Authorization - the authorization type (e.g. Basic, Bearer) will be captured, but the remainder of the value will be redacted.
  • X-XSRF-TOKEN - the full value will be redacted.

The redacted headers can be customized with the NIGHTWATCH_REDACT_HEADERS environment variable. E.g:

NIGHTWATCH_REDACT_HEADERS=Authorization,Cookie,Proxy-Authorization,X-XSRF-TOKEN,Secret-Header

The value specified here will override the defaults, so be sure to keep the default values if you wish for them to be redacted.

When a header is redacted, the header name is always preserved so you know what headers were present. The value will be replaced by an indication of how many bytes were redacted. E.g. [123 bytes redacted].

@jessarcher jessarcher force-pushed the capture-request-headers branch 3 times, most recently from f4e7fac to e2bb8e0 Compare September 22, 2025 12:39
@jessarcher jessarcher force-pushed the capture-request-headers branch from 119c64d to 970f633 Compare September 30, 2025 06:38
@jessarcher jessarcher marked this pull request as ready for review October 7, 2025 04:54
@jessarcher jessarcher enabled auto-merge (squash) October 7, 2025 04:55
@jessarcher jessarcher merged commit f6458b2 into 1.x Oct 7, 2025
25 checks passed
@jessarcher jessarcher deleted the capture-request-headers branch October 7, 2025 04:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants