Skip to content

feat: add configurable header redaction for logs#1240

Open
rdark wants to merge 1 commit intoory:masterfrom
rdark:redact-arbitrary-headers
Open

feat: add configurable header redaction for logs#1240
rdark wants to merge 1 commit intoory:masterfrom
rdark:redact-arbitrary-headers

Conversation

@rdark
Copy link

@rdark rdark commented Oct 6, 2025

When configuring oathkeeper to use a non standard auth header (such as token_from in the jwt authenticator), oathkeeper currently logs these tokens in plain text when configured at log level INFO or above. There is no way currently to append additional headers to the default list of redacted headers.

I considered implementing a matcher for some of these fields, but went with a more generic solution that allows the user to choose which arbitrary headers to redact from logging.

Add support for log.redact_headers configuration option to redact additional sensitive headers beyond the defaults (authorization, cookie, set-cookie, x-session-token). Headers specified in this configuration will have their values masked in log output.

Example configuration

log:
  redact_headers:
    - x-custom-authorization
    - x-api-key

Related issue(s)

Checklist

  • I have read the contributing guidelines.
  • I have referenced an issue containing the design document if my change
    introduces a new feature.
  • I am following the
    contributing code guidelines.
  • I have read the security policy.
  • I confirm that this pull request does not address a security
    vulnerability. If this pull request addresses a security vulnerability, I
    confirm that I got the approval (please contact
    security@ory.sh) from the maintainers to push
    the changes.
  • I have added tests that prove my fix is effective or that my feature
    works.
  • I have added or changed the documentation.

Further Comments

  Add support for log.redact_headers configuration option to redact
  additional sensitive headers beyond the defaults (authorization, cookie,
  set-cookie, x-session-token). Headers specified in this configuration
  will have their values masked in log output.

  Configuration can be set via YAML:
    log:
      redact_headers:
        - x-custom-authorization
        - x-api-key

  This prevents sensitive authentication headers from being logged,
  improving security for deployments using non-standard auth headers.
@rdark rdark requested review from a team and aeneasr as code owners October 6, 2025 13:13
@rdark
Copy link
Author

rdark commented Oct 6, 2025

the format failing test seems to be not related to my change

rdark added a commit to rdark/ory-docs that referenced this pull request Oct 6, 2025
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.

1 participant