Skip to content

cleanup: replace internal/trace/transport.go with remote.NewLoggingTransport() (blocked upstream) #2315

Open

Description

@TerryHowe

Follow-on to #2008 (phase 2.4). The v2→v3 migration (#2002) has merged; this is the last of the deprecation-cleanup items — and the one that cannot be done as described today.

Intent

internal/trace/transport.go (269 LOC, plus 568 lines of tests) implements --debug HTTP request/response logging. oras-go v3 ships an equivalent at registry/remote/logging_transport.go, usable either directly or via ClientBuilder.Logger:

func NewLoggingTransport(inner http.RoundTripper, logger *slog.Logger) *LoggingTransport

The upstream version matches ours on header scrubbing, the 16 KiB body cap, and adds per-request IDs for correlating concurrent blob fetches. Net ~−160 LOC.

Blocker: swapping as-is leaks user-supplied secret headers

Our transport takes a variadic list of header names to scrub:

// internal/trace/transport.go:58
func NewTransport(base http.RoundTripper, sensitiveHeaders ...string) *Transport

and remote.go:473 passes the names of every --header flag the user supplied:

client.Client.Transport = trace.NewTransport(client.Client.Transport, sensitiveHeaders...)

That exists because --header is how users pass custom auth headers to registries that do not use standard Authorization.

Upstream scrubs only a hardcoded set, with no way to extend it:

// oras-go registry/remote/logging_transport.go:29
var sensitiveHeaders = []string{
    "Authorization", "Cookie", "Proxy-Authorization", "Set-Cookie",
}

A straight swap would print user-supplied credential headers in cleartext under --debug. CI would not catch it — it is a silent disclosure, not a build or test failure.

Required first

An oras-go change giving LoggingTransport a configurable scrub list (an exported field, an option, or a NewLoggingTransportWithHeaders variant). Once that is released, this becomes a small mechanical swap on top of the internal/logutil slog bridge from the NewWarningLogger issue.

Do not merge a partial version of this that drops the --header scrubbing. If upstream declines the change, close this and keep internal/trace/transport.go.

Acceptance

  • Upstream oras-go supports additional sensitive header names
  • internal/trace/transport.go removed, replaced via ClientBuilder.Logger or remote.NewLoggingTransport()
  • A test asserts that a value passed via --header does not appear in --debug output

Activity

  1. added this to the future milestone on Nov 4, 2026
  2. added
    enhancement
    go
    on Nov 4, 2026
  3. TerryHowe commented on Nov 25, 2026

    @TerryHowe
    MemberAuthor

    Waiting on the next oras-go release. oras-project/oras-go#1775 (extra sensitive headers for LoggingTransport) and oras-project/oras-go#1786 (ClientBuilder from Configs) are merged on oras-go main but are not in v3.0.0, so this can't be picked up until oras-go v3.0.1/v3.1.0 is tagged.

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

    enhancementgologging

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions