Skip to content

test: expect scrubbed custom header values in e2e - #2133

Merged
sabre1041 merged 1 commit into
oras-project:mainfrom
TerryHowe:test/scrubbed-custom-header-e2e
Aug 20, 2026
Merged

test: expect scrubbed custom header values in e2e#2133
sabre1041 merged 1 commit into
oras-project:mainfrom
TerryHowe:test/scrubbed-custom-header-e2e

Conversation

@TerryHowe

Copy link
Copy Markdown
Member

What this PR does

Fixes the 9 failing 1.1 registry users: when custom header is provided e2e specs that have broken main since the GHSA-5jhf-2qmf-m8c5 fix landed.

Why

That fix scrubs configured custom header names from --debug trace output, since --header is commonly used to pass credential headers:

  • cmd/oras/internal/option/remote.go collects every --header name into sensitiveHeaders and passes them to trace.NewTransport
  • internal/trace/transport.go replaces those values with *****

The e2e specs were not updated, so they still assert the raw values:

FoobarHeader = "\"Foo\": \"bar\"\n"
AbHeader     = "\"A\": \" b\"\n"

while the debug output now contains:

"A": "*****"
"Foo": "*****"

Every spec fails at test/e2e/internal/utils/match/request.go:58 with failed to match all headers. This affects attach, blob, manifest, pull, push, repo, tag, and both cp specs, and it fails on every PR branched after the fix (for example #2130, where it is unrelated to that PR's dependency bump).

The change

Expect the scrubbed values. The specs still verify that each custom header name is present on every matching request, which is what they were really guarding.

Verification

The full e2e suite could not be run locally (macOS AirPlay Receiver holds port 5000, so the test registry is unreachable), so the expected literals were checked directly against the real trace.logHeader with a throwaway unit test: "Foo": "*****"\n and "A": "*****"\n are both produced, and neither raw value leaks. CI on this PR exercises the real suite.

Note, not addressed here

The login spec in the same block passes only vacuously — it omits -d, so getRequests finds no requests and the matcher's loop never runs. Worth a follow-up.

The GHSA-5jhf-2qmf-m8c5 fix scrubs configured custom header values from
--debug trace output, but the e2e specs still asserted the raw values,
so every "custom header is provided" spec has failed on main since then.

Expect the scrubbed values instead. The specs still verify that each
custom header name is present on every matching request.

Signed-off-by: Terry Howe <terrylhowe@gmail.com>
@codecov

codecov Bot commented Aug 17, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 87.63%. Comparing base (799bb3e) to head (93796af).
⚠️ Report is 3 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2133      +/-   ##
==========================================
+ Coverage   87.44%   87.63%   +0.18%     
==========================================
  Files         139      139              
  Lines        5544     5651     +107     
==========================================
+ Hits         4848     4952     +104     
  Misses        417      417              
- Partials      279      282       +3     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@sabre1041 sabre1041 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@sabre1041
sabre1041 merged commit 94fa1d8 into oras-project:main Aug 20, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants