[v3-2-test] Redact secret-looking query parameters in HTTP access log (#67498)#67631
Merged
jason810496 merged 2 commits intoMay 29, 2026
Merged
Conversation
…apache#67498) The HTTP access log middleware logged the raw query string without passing it through ``secrets_masker.redact()``. The decorator-layer audit log already masks request data; the access-log layer did not. A secret inadvertently passed as a query parameter (e.g. ``?password=foo`` or ``?token=bar``) was therefore written to the access log in plaintext. Parse the query string into ``(key, value)`` pairs and call ``secrets_masker.redact(value, key)`` per pair before logging. This matches the pattern already used in ``logging/decorators.py``: keys whose names are flagged sensitive by ``secrets_masker`` (``password``, ``token``, ``api_key``, …) have their values replaced with ``***``; values previously registered via ``mask_secret()`` are caught too. Non-sensitive keys are unchanged, blank values are preserved so log readers still see the parameter was present, and malformed query strings fall back to raw logging rather than silently dropping diagnostic information. (cherry picked from commit aa3b7d4) Co-authored-by: Jarek Potiuk <jarek@potiuk.com>
7 tasks
pierrejeambrun
approved these changes
May 28, 2026
Member
pierrejeambrun
left a comment
There was a problem hiding this comment.
Needs conflict solving
vatsrahul1001
pushed a commit
that referenced
this pull request
May 29, 2026
…#67498) (#67631) The HTTP access log middleware logged the raw query string without passing it through ``secrets_masker.redact()``. The decorator-layer audit log already masks request data; the access-log layer did not. A secret inadvertently passed as a query parameter (e.g. ``?password=foo`` or ``?token=bar``) was therefore written to the access log in plaintext. Parse the query string into ``(key, value)`` pairs and call ``secrets_masker.redact(value, key)`` per pair before logging. This matches the pattern already used in ``logging/decorators.py``: keys whose names are flagged sensitive by ``secrets_masker`` (``password``, ``token``, ``api_key``, …) have their values replaced with ``***``; values previously registered via ``mask_secret()`` are caught too. Non-sensitive keys are unchanged, blank values are preserved so log readers still see the parameter was present, and malformed query strings fall back to raw logging rather than silently dropping diagnostic information. (cherry picked from commit aa3b7d4) Co-authored-by: Jarek Potiuk <jarek@potiuk.com>
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.
The HTTP access log middleware logged the raw query string without passing it through
secrets_masker.redact(). The decorator-layer audit log already masks request data; the access-log layer did not. A secret inadvertently passed as a query parameter (e.g.?password=fooor?token=bar) was therefore written to the access log in plaintext.Parse the query string into
(key, value)pairs and callsecrets_masker.redact(value, key)per pair before logging. This matches the pattern already used inlogging/decorators.py: keys whose names are flagged sensitive bysecrets_masker(password,token,api_key, …) have their values replaced with***; values previously registered viamask_secret()are caught too.Non-sensitive keys are unchanged, blank values are preserved so log readers still see the parameter was present, and malformed query strings fall back to raw logging rather than silently dropping diagnostic information.
(cherry picked from commit aa3b7d4)