Skip to content

[v3-2-test] Redact secret-looking query parameters in HTTP access log (#67498)#67631

Merged
jason810496 merged 2 commits into
apache:v3-2-testfrom
jason810496:backport-aa3b7d4-v3-2-test
May 29, 2026
Merged

[v3-2-test] Redact secret-looking query parameters in HTTP access log (#67498)#67631
jason810496 merged 2 commits into
apache:v3-2-testfrom
jason810496:backport-aa3b7d4-v3-2-test

Conversation

@jason810496
Copy link
Copy Markdown
Member

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)

…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>
Copy link
Copy Markdown
Member

@pierrejeambrun pierrejeambrun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs conflict solving

@jason810496 jason810496 merged commit 43acb47 into apache:v3-2-test May 29, 2026
109 checks passed
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:API Airflow's REST/HTTP API

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants