Skip to content

TRACE_EXPORTER=gofr logs TRACER_URL credentials unredacted on every failed span export #4495

Open

Description

@NitinKumar004

Summary

With TRACE_EXPORTER=gofr, every failed span export logs the raw TRACER_URL, including credentials in its userinfo or query string. The startup log line and the OTel error handler already redact the URL, but the gofr exporter's own export-failure log does not.

Since TRACER_HEADERS is documented as unsupported for the gofr exporter, credentials in the URL are the only way to authenticate it.

Reproduction

A test in package gofr:

  • an httptest collector returns 401;
  • TRACE_EXPORTER=gofr, TRACER_URL=http://bob:S3CRETPASS@127.0.0.1:<port>/api/spans?api_key=TOPSECRETKEY;
  • the test ends one span, then flushes traces.
ERROR failed to post spans on 'http://bob:S3CRETPASS@127.0.0.1:63676/api/spans?api_key=TOPSECRETKEY', unexpected response status code: '401'
ERROR failed to post spans on 'http://REDACTED@127.0.0.1:63676/api/spans?REDACTED', unexpected response status code: '401'

The first line comes from the exporter itself. The second is the same error logged again by the OTel error handler, redacted.

Root cause

pkg/gofr/exporter.go (processSpans, around lines 83-99) builds failed to post spans on '%v' from e.endpoint and logs it through its own logger without redaction. The client.Do error is also logged raw, and it can contain the URL as well.

Suggested fix

  • Use exporters.RedactURL(e.endpoint) in the message, and exporters.RedactMessage on the client.Do error.
  • Or drop the exporter's own log line, since the returned error is already logged (redacted) by the OTel error handler.
  • Add a test asserting the secret does not appear in the logs.

Activity

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