1
0
mirror of https://github.com/alauda/registry-auth.git synced 2026-10-25 01:19:23 +03:00

3 Commits

Author SHA1 Message Date
Gang Wang
b77f429f5a fix(ci): hoist source-image fetch out of per-version loop
scripts/simple-tests.sh ran `skopeo copy ... docker-archive:/tmp/registry-src.tar`
inside do_tests, so the second iteration (v3.0.0) failed with "docker-archive
doesn't support modifying existing images" because the v2.8.1 pass had already
written the file. Move the source-image fetch into its own prepare_source_image
called once from main(), and guard with -f so reruns are idempotent.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-26 03:35:52 +00:00
Gang Wang
7bd9e7c2ac feat: support distribution v3.x via x5c JWT header
distribution/distribution v3.0.0 replaced libtrust with go-jose and keys
its trustedKeys map by RFC 7638 JWK thumbprint, so tokens signed with the
old libtrust-style kid header (which v2.8.1 used) are no longer matched.

Switch to emitting the signing certificate in the JWS x5c protected
header. Both v2.8.1 (parseAndVerifyCertChain) and v3.0.0 (verifyCertChain)
verify x5c against the rootcertbundle, so the same token works on both —
no libtrust dependency needed.

- pkg/server/auth.go: drop libtrust kid derivation; embed the signing
  cert as base64 DER in the x5c header.
- go.mod/go.sum: remove github.com/docker/libtrust (archived).
- scripts/simple-tests.sh: parametrize REGISTRY_VERSIONS so CI exercises
  both v2.8.1 and v3.0.0 (defaults to both).
- pkg/server/server_test.go: cover the x5c regression and the
  previously-untested Authenticate / Authorize / DecodeScope* paths
  (raises pkg/server coverage from 0% to ~27%).
- README/README_zh: note v2/v3 dual compatibility and v3's config path.
- CLAUDE.md: project guidance with the x5c rationale.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-26 03:27:37 +00:00
tfwang
ba4af46d05 add tests script
Signed-off-by: tfwang <tfwang@alauda.io>
2022-10-17 23:58:10 +08:00