ozontech / ozontech/file.d

Bug: Clear-text logging of sensitive HTTP headers on authentication failure

Open Beginner friendly
#988 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Go
Stars
504
Forks
263
Avg merge
4d 2h
Merged PRs (30d)
5

Description

Location:
  • Path: plugin/input/http/http.go
  • Function: ServeHTTP
  • Line: zap.Any("headers", r.Header) inside if !ok { ... } block (~line 420)
Description

On authentication failure, the entire r.Header map is logged in plaintext:

p.logger.Warn("auth failed",
    zap.String("user_agent", r.UserAgent()),
    zap.Any("headers", r.Header),          //  logs all headers as-is
    zap.String("remote_addr", r.RemoteAddr),
)

r.Header contains the Authorization header (or the custom Auth.Header) with live credentials: Basic <base64>, Bearer <token>, or API keys. These are serialized to JSON by zap.Any and written to logs without masking.

Risk
  • Failed auth requests contain the exact credentials just sent by the client; they are persisted in plaintext in logs accessible to operators, SOC, and external log aggregators.

  • Token/JWT leakage — even expired or malformed JWTs expose PII in the payload and may be replayable; Bearer tokens and API keys are usable as-is.

  • Compliance — violates PCI-DSS, GDPR Article 32, and SOC2 controls for credential storage/protection.

Recommendations:
  • Remove zap.Any("headers", r.Header) from the auth-failure log.

  • Log only safe metadata:

p.logger.Warn("auth failed",
    zap.String("user_agent", r.UserAgent()),
    zap.String("remote_addr", r.RemoteAddr),
    zap.String("method", r.Method),
    zap.String("uri", r.RequestURI),
    zap.Bool("has_auth", r.Header.Get(p.config.Auth.Header) != ""),
)
  • If correlation is needed, log a truncated SHA-256 hash of the auth header instead of the raw value.
References:

CWE-532: Insertion of Sensitive Information into Log File

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Open plugin/input/http/http.go and inspect ServeHTTP's authentication-failure block around the zap.Any("headers", r.Header) call. Replace the raw header logging with the safe metadata described in the issue, or an appropriately truncated auth-header hash if correlation is required. Done means failed-auth logs no longer contain credentials or other sensitive headers.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
security
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
75/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.