Repository navigation
fix(sdl): fetch oci modules from public registries through the anonymous token flow - #1480
Conversation
d013e1b to
7dd887f
Compare
…ter entry Each open entry in the divergence register now names its issue: #1525 to #1557 for the production changes, and #1521 for the smaller corrections. The entries that open pull requests now address move to "Addressed by pull requests" with their issues: GH-7 (#1491, #1490), NS-1 (#1476, #1475), NS-2 (#1480, #1479), MF-2 (#1483, #1482), CL-2 (#1474, #1473), ST-2 (#1472, #1559) and NS-7 and NS-8 (#1488, #1560 and #1561). ST-1 names #1558, GH-3 records that #1415 merged, and "What remains" names #1522 for the unverified and unexamined boundaries.
7dd887f to
7f1db16
Compare
…ous token flow ghcr.io, Docker Hub and ECR Public answer an anonymous registry request with 401 and a WWW-Authenticate Bearer challenge, and the module registry reported every such import as a fetch failure. A 401 from the requested URL that carries exactly one Bearer challenge is now answered with one anonymous token request to the challenge's HTTPS realm (no redirects followed) and one retry. The challenge is parsed strictly, tokens are cached per realm, service and scope for one import resolution, and the token is attached as an unredirected header, so urllib never sends it on the 307 to a registry's blob storage. Timeouts, size limits, digests and the urlopen seam are unchanged.
…quested url A realm whose host is percent-encoded or not IDNA-encodable passed the realm check and then escaped parse_sdl_file as http.client.InvalidURL or UnicodeEncodeError. The realm check now refuses a "%" in the authority and any host the IDNA codec rejects, so such a challenge fails with an SDLParseError before any token request. The token response's oversize message named the token URL built from the challenge's realm, service and scope. It now names the requested URL, like every other message in the flow. A second parse_sdl_file import against the same registry now pins the one-cache-per-import token lifetime.
…nder the line cap Dev's #1426 grew resolution.py to 492 lines, so the token threading put it at 501, over the ADR-015 500-line cap. Formatting only.
Collected with blitz-tools/collect_research_evidence.py on this branch's source (6 pinned artifacts through the production pipeline, 10 retained cases via replay_case, 4 production processor cases, 14 participant functions), then recorded with python -m tools.research_capture record.
7f1db16 to
deaed7d
Compare
|
Recommendation: do not merge as is. Reviewed head
Required action:
Coverage and outstanding work: #1479's anonymous flow, access_token compatibility, challenge rejection, token bounds and redirect non-disclosure cases are represented. The use of urllib's unredirected header is appropriate. No additional confirmed source defect identified in the reviewed patch. Verification limits: Green head checks and complete snapshot do not validate the source resulting from current-dev conflict resolution. Live full RAES-module/public-registry and proxy coverage is explicitly limited. |
Conflict in module_registry/resolution.py (imports only): dev moved _select_tag into _digests and dropped _normalize_exact_or_range from resolution; this branch adds _RegistryTokens. Kept dev's _digests import and the _registry_auth import. Dev's editor path mode refuses oci: before any registry request, and its iterative locked: chain ends in the same _resolve_oci_import, which creates one _RegistryTokens per import.
Dev's locked: chain resolver (#1339) reaches _resolve_oci_import with the manifest pinned by digest, so no tags/list request precedes the challenge. Cover one and two locked hops: one token request, one retry per registry URL, and no Authorization at the storage origin.
Collected on the merge of current dev with blitz-tools' collect_research_evidence.py and recorded with research_capture record: specification capture-917dcfe8, formal capture-75bb6056.
|
Review of 2026-10-25 addressed on head
|
|
This branch conflicts with dev again after the Quality refactor merges, in |
Summary
Public registries answer anonymous
/v2/requests with401and aBearerchallenge, sooci:imports failed. Now: one token request to the HTTPS realm (no redirect), one retry with the token as an unredirected header, so blob307s reach storage without it.Requirement UIDs
Related Issues
Closes #1479
#1484 depends on this PR. Tracked, not delivered here: token refresh (#1542), image-index tags (#1540), live RAES-module and proxy qualification (#1544).
ADR Impact
Changes
module_registry/_registry_auth.py, behind_json_requestand_bytes_request.f02583f3: one conflict, the_digestsimport inresolution.py(feat!: make reference eligibility explicit per purpose and align the editor with validation #1446 moved_select_tag); kept dev's import plus_RegistryTokens. Dev'slocked:chain reaches the token flow: testeb32f9f1.f02583f3test_rejected_token_gets_exactly_one_retry,test_token_realm_must_be_an_absolute_https_url,test_token_endpoint_redirect_is_not_followed,test_oci_import_rejects_tampered_config_blob,test_oci_bytes_request_rejects_oversized_response,test_bearer_token_never_follows_a_blob_redirect,test_locked_import_fetches_the_pinned_manifest_through_the_token_flowebe04761implementations/python/tests/test_issue_<this issue>_oci_anonymous_token.py, runs hermetic loopback servers:parse_sdl_fileimport must succeed with one token request, one anonymous attempt and one retry per registry URL, and noAuthorizationat the storage origin._registry_gettest_import_uses_one_anonymous_token_and_retries_each_request_oncehttprealm, a redirecting token endpoint, a401without aBearerchallenge, twoBearerchallenges, anaccess_token-only response, malformed and oversized token responses, a401from a redirect target, and the challenge grammar. The module fails ondev._anonymous_token,_parse_bearer_challengeadd_unredirected_headertest_sdl_module_registry.pywith default markers and with-m integration.nox -s verify-fast-feedback -- --base-rev origin/dev,nox -s lint,make policy, both research evidence checkers and the three evidence test modules.Test Plan
Merged head,
pyteston the 7 modules that importraes.module_registryor useoci:: 368 passed;-m integration: 5 passed. The locked test fails with dev'sresolution.py(401) and withadd_header(storage403).Live (2026-10-25): the issue's script stops at module validation on Docker Hub and ECR Public; ghcr.io's index tag answers
404(#1540). One config blob per registry:401, one200retry,Authorizationunredirected, digests matched.Evidence:
collect_research_evidence.pyon the merged head (38 of 42 stages passed, 4 preregistered; 20 of 20 formal observations as expected), thenresearch_capture record:capture-917dcfe8(spec),capture-75bb6056(formal). Both checkers, the three evidence modules,nox -s contracts,verify-fast-feedback,lint: passed.Ground Control Checks
make policypassed on this head.Traceability
implementations/python/packages/raes/module_registry/{_registry_auth,__init__,resolution}.pyimplementations/python/tests/test_issue_1479_oci_anonymous_token.pyChecklist
fixcuts a patch release.