Skip to content

fix: harden registry parsing (digests, ports, tag pagination) - #88

Open
Abhinesh Jha (Abhineshhh) wants to merge 2 commits into
microsoft:mainfrom
Abhineshhh:fix/registry-stack
Open

fix: harden registry parsing (digests, ports, tag pagination)#88
Abhinesh Jha (Abhineshhh) wants to merge 2 commits into
microsoft:mainfrom
Abhineshhh:fix/registry-stack

Conversation

@Abhineshhh

Copy link
Copy Markdown
Contributor

Description

Consolidated registry fixes that both touch pkg/infrastructure/scanner/registry.go, stacked into one PR for a clean review/merge.

Related Issues

Fixes #74
Fixes #76

Changes

  1. ExtractRegistryAndRepo — strip @digest first; last : after last / is the tag; support host:port / localhost ([Bug]: ExtractRegistryAndRepo mishandles digest-pinned refs and registries with ports #74)
  2. GetTags pagination — follow Registry API Link: rel=next with n=100; httptest multi-page tests ([Bug]: GetTags does not follow Registry API pagination (Link header) #76)

Stack note

This replaces the overlapping single-file PRs #83 and #84 (closed in favor of this consolidated stack).

Checklist

  • go test ./... passes locally
  • Documentation updated (if applicable)
  • Commits are logical and reviewable in order

ExtractRegistryAndRepo previously split on the first :, which mangled
digest suffixes (@sha256:...) and registries with ports (localhost:5000).
Strip digests first and use the last : after the last / as the tag
separator, matching Docker reference parsing.

Fixes microsoft#74
GetTags issued a single tags/list request and ignored the Link
rel=next header, so large repositories could silently drop tags
before filtering and --max-tags selection.

Page with n=100 and follow next links until exhausted; add unit tests
with a multi-page httptest server.

Fixes microsoft#76
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant