Skip to content

fix(triage): cache Referrers-API support per registry to skip slow oras discover#112

Merged
tobias-pfaffelmoser-aa merged 1 commit into
mainfrom
fix/jfrog-triage-referrers-cache
Jun 11, 2026
Merged

fix(triage): cache Referrers-API support per registry to skip slow oras discover#112
tobias-pfaffelmoser-aa merged 1 commit into
mainfrom
fix/jfrog-triage-referrers-cache

Conversation

@tobias-pfaffelmoser-aa

Copy link
Copy Markdown

Problem

retrieve-triage -i <images> against JFrog is slow and looks broken: every image logs oras discover ... timed out after 15s. JFrog doesn't implement the OCI Referrers API, so oras discover hangs to the timeout instead of failing fast — and we pay that once per image. Worse, the legacy triage.toml fallback also calls oras discover (full timeout, twice counting the --plain-http retry) even though its own comment says it should be skipped once the Referrers API has timed out — so any image without a tag-based attestation burns up to ~360s.

The triage itself was already fetched correctly via the tag-based cosign fallback (#104); this PR is purely about the wasted time and the misleading timeout spam.

Change

Add a process-wide RegistryCapabilityCache (mirrors the existing DigestCache):

  • _discover_referrers returns immediately when the host is already known to lack the Referrers API, and records the host on the first timeout (both the digest-based and tag-based probes).
  • fetch_triage_for_image skips the legacy triage.toml path for such hosts (honoring the existing comment), going straight to tag-based cosign attestation.

Only the negative signal (timeout) is cached, per registry host — a non-timeout failure still falls through unchanged, and Harbor (which supports Referrers) is unaffected.

Effect (measured on a 41-image JFrog list)

  • oras discover calls: 41 → 1
  • Wall time: ~14m → ~4m
  • Untriaged images fail in ~6s instead of ~375s
  • No change in which images get triage (40/41; the single miss genuinely has no attestation attached)

Test

python3 -m scanner_py retrieve-triage -i <41 jfrog images> -o triage -r report.md -v — confirmed 1 total oras discover call, 40 "Skipping Referrers API" debug hits, and every triaged image fetched.

…as discover

JFrog has no OCI Referrers API, so `oras discover` does not fail fast — it
hangs until the timeout — making retrieve-triage pay the full ~15s probe per
image, plus up to ~360s more per untriaged image via the legacy triage.toml
path (which also calls oras discover despite a comment saying it should be
skipped once the Referrers API has timed out).

Add a process-wide RegistryCapabilityCache: the first Referrers-API timeout
marks that registry host unsupported, and every later image on the same host
skips both oras-discover probes and falls straight through to tag-based cosign
attestation. On a 41-image JFrog list this drops oras discover calls from 41 to
1 and the run from ~14m to ~4m, with no change in which images get triage.
@github-actions github-actions Bot added the fix label Jun 11, 2026
@tobias-pfaffelmoser-aa
tobias-pfaffelmoser-aa merged commit 7a50e8c into main Jun 11, 2026
5 checks passed
@tobias-pfaffelmoser-aa
tobias-pfaffelmoser-aa deleted the fix/jfrog-triage-referrers-cache branch June 11, 2026 13:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant