Skip to content

ci(publish-verify): the fake registry rejects a wrong bearer token so a mis-passed token is seen red (#999) - #1015

Merged
bpalermo merged 2 commits into
mainfrom
fix/999-fake-registry-token
Sep 27, 2026
Merged

bpalermo merged 2 commits into
mainfrom
fix/999-fake-registry-token

Conversation

@bpalermo

Copy link
Copy Markdown
Owner

The gap

#1000 hot-fixed #999: check_signature in scripts/verify-published-artifacts.sh step 5 was handed the proxy repo's tag list where it takes the pull token. The offline harnesses never saw it because their fake registries accepted any Authorization: Bearer … value. A wrong token and the right one looked the same.

The enforcement

  • scripts/check-registry-lookup.sh (the curl fake): the fake now issues one token, fake, from the token endpoint (/token for ghcr.io, /v2/auth for quay.io, unchanged). Every other request must carry exactly Authorization: Bearer fake. Anything else gets a 401 in the shape each call style reads: -w prints 401, -f returns 22, otherwise an UNAUTHORIZED body. Each refusal is logged to $FAKE/unauthorized. This is what ghcr.io and quay.io do.
  • scripts/check-publish-verify-control.sh (the function-level fake): registry_all_tags, registry_any_tag, registry_tag_exists, registry_manifest_digest and registry_referrers accept only the fake-token that registry_registry_token issues. Any other value gets 401 on stderr and rc 2. registry_any_tag and registry_tag_exists now pass the token through, which they previously dropped.
  • There is one supporting change to the fake: a manifest HEAD by digest echoes that digest in docker-content-digest, so the pinned proxy index can resolve. Tag HEADs behave as before.
  • Nothing else in the fakes was restructured. The diff is limited to the token check and the one case, so it should rebase cleanly under feat/040-quay-cutover.

The new case (check-registry-lookup, 30 → 31 cases)

It drives the verifier's step-5 proxy-pin signature path through the fake:

Both halves sit in one case, so the case also fails if the fake ever stops checking the token.

Seen red: buggy verifier staged in place of the fixed one

The pre-#1000 file (16a4958, the commit before b763e8a) cannot run against main's libraries at all. It predates #998, so it sources ghcr-lib.sh and reads GHCR_CHART_REPO_PREFIX. Staged literally, it fails every verifier case with GHCR_CHART_REPO_PREFIX: unbound variable, which is the wrong reason. So the staged buggy script is main's verifier with #1000's two-token diff reversed, the same two lines 16a4958 carries (check_signature "$PROXY_REPO" "$pin" "$tags" "proxy index" / … "$child" "$tags" "proxy child"):

$ sed -i -E 's/(check_signature "\$PROXY_REPO" "\$(pin|child)" )"\$tok"/\1"$tags"/' scripts/verify-published-artifacts.sh
$ scripts/check-registry-lookup.sh; echo rc=$?
  ... 30 x ok ...
  FAIL  verifier proxy pin: fixed rc 2 (0/3 proxy signatures, 1 request(s) refused 401), #999-mutated rc 2 (want 0 and 2)
        fixed |   ok      ghcr.io/bpalermo/aether/aether-proxy@sha256:0722f675… (pinned in charts/aether/values.yaml)
        fixed | registry_referrers: GET https://ghcr.io/v2/bpalermo/aether/aether-proxy/referrers/sha256:0722f675… answered '401'
        fixed | ::error::inconclusive: could not look up the signature tags of ghcr.io/bpalermo/aether/aether-proxy@sha256:0722f675…
        fixed | fake registry: 401 <- https://ghcr.io/v2/bpalermo/aether/aether-proxy/referrers/sha256:0722f675… Bearer dev ...
::error::registry direct lookup is wrong; see cases above
rc=1

Bearer dev … is the tag list sent as the token, which is #999 exactly.

Green: fixed verifier (this branch, rebased on fea9dce)

$ scripts/check-registry-lookup.sh; echo rc=$?
  ...
  ok    verifier: a signed post-cut-over proxy pin passes on the issued token (40 artifacts, 3 proxy signatures); #999's tag list as the token is refused 401, exit 2
registry lookup: 31/31 cases correct
rc=0
$ scripts/check-publish-verify-control.sh
  ...
publish-verify control: 14/14 cases correct

All 30 pre-existing cases and all 14 control cases stay green with the token enforced. ShellCheck (--config=lint --@aspect_rules_lint//lint:fail_on_violation //scripts:scripts_shell) is clean, and shfmt (//:format) left the files unchanged. docs/runbook.md gains one sentence on the control harness paragraph.

Closes #999

🤖 Generated with Claude Code

https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr

bpalermo and others added 2 commits September 27, 2026 17:41
… a mis-passed token is seen red (#999)

The offline fakes in scripts/check-registry-lookup.sh and
scripts/check-publish-verify-control.sh accepted any Authorization value,
so #999 (check_signature handed the proxy repo's tag list as the pull
token) passed the harness green. Both fakes now accept only the token they
issue (`fake` from /token or /v2/auth; `fake-token` in the control) and
answer anything else with a 401.

New check-registry-lookup case drives the verifier's step-5 proxy-pin
signature path (HEAD's pin, cut-over placed just before its introducing
commit): the fixed verifier passes 40/40 with three proxy signatures and no
refused request; the same verifier with #999 re-injected is exit 2 on a 401.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr
@bpalermo
bpalermo merged commit 8d4f223 into main Sep 27, 2026
24 checks passed
@bpalermo
bpalermo deleted the fix/999-fake-registry-token branch September 27, 2026 20:54
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.

publish-verify: the proxy-pin step passes the tag list as the bearer token — every sweep since the #997 cut-over exits 2 (inconclusive)

1 participant