Skip to content

Leaking sensitive headers #288

Closed
Closed

Description

Would you be open to a PR to censor sensitive headers ?

I realized that I leaked my secrets in Cloudwatch because of hpack when I set the logger to debug to check on something, see this source.

Activity

  1. Kriechi commented on Mar 1, 2026

    @Kriechi
    Member

    Yes - happy to review one!
    Should it directly conditionally rely on the sensitive flag? Or introduce some new config option for encoders/decoders to control it?

  2. woodside-david-francoeur commented on Mar 2, 2026

    @woodside-david-francoeur
    Author

    Personally, I'd keep that simple, but that's not my project, so if you have something more involved in mind, I can go along.

    My thinking is: no configuration, we check the sensitive flag, if it's true we log REDACTED (possibly inlude a hash of the value if this is not too expensive to do), otherwise we keep the existing behaviour (log the value).

    The user of this lib can already define what headers are sensitive by calling encode and using the appropriate shape (as the doc mentions):

    encoder.encode([
        HeaderTuple(':method', 'GET'),
        NeverIndexedHeaderTuple('customkey', 'sensitiveinfo'),
    ])
    # or
    
    encoder.encode([
        (':method', 'GET', True),
        ('customkey', 'sensitiveinfo', True),
    ])

    wdyt?

  3. Kriechi commented on Mar 8, 2026

    @Kriechi
    Member

    Makes sense. No hashing - we might be on a hot code path. For the value to log: SENSITIVE_REDACTED and clearly mention it in the docs. Thanks for pushing this idea!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions