fix(pii): Scrub API key headers with hyphens (e.g. x-api-key)#5829
Open
fix(pii): Scrub API key headers with hyphens (e.g. x-api-key)#5829
Conversation
The PASSWORD_KEY_REGEX matched `api_key` and `apikey` but not `api-key`, so HTTP headers like Anthropic's `x-api-key` were not scrubbed by default data scrubbing. Update the regex to use `api[-_]key` (and `private[-_]key` for consistency) to cover hyphenated header names.
sehr-m
approved these changes
Apr 13, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
PASSWORD_KEY_REGEXinrelay-piimatchedapi_key(underscore) andapikey(no separator) but notapi-key(hyphen), meaning HTTP headers like Anthropic'sx-api-keywere not scrubbed by default data scrubbingapi[-_]keyto cover all separator variantsprivate_key→private[-_]keyfor consistency (matches the existingtwo[-_]factorpattern)Test plan
test_api_key_header_scrubbingtest coveringx-api-key,api-key,api_key,apikey, andX-Api-Keyrelay-piitests pass with no regressions[Filtered]