Skip to content

admin: redact sensitive request headers in API logs #7566

@aleister1102

Description

@aleister1102

Issue Details

The admin API handler logs request headers using zap.Reflect("headers", r.Header) in adminHandler.ServeHTTP (admin.go:803), which serializes the raw header map without any redaction.

The rest of the codebase uses LoggableHTTPHeader for header logging, which redacts Cookie, Set-Cookie, Authorization, and Proxy-Authorization unless ShouldLogCredentials is explicitly enabled (added in #5669). The admin handler is the only logging path that bypasses this.

Fix: Replace the zap.Reflect call with zap.Object("headers", LoggableHTTPHeader{Header: r.Header}) to be consistent with every other logging site in the codebase.

This matters in deployments where the admin API is accessed through a proxy that injects auth headers, or where admin logs are shipped to a centralized logging system.

Assistance Disclosure

AI used

If AI was used, describe the extent to which it was used.

Claude help me write the issue body but the finding is mine.

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