Watch
1
0
Fork
You've already forked pkg-proxy
1
mirror of https://github.com/git-pkgs/proxy.git synced 2026-09-16 07:42:05 -04:00
pkg-proxy/internal/scanner
Repository files (latest commit first)
Filename Latest commit message Latest commit date
aarnaud 5499837084
Add pre-cache artifact scanning hook (trivy/ClamAV/Wiz/custom) (#298)
Runs fetched artifacts through pluggable external scanners after they're
staged in storage but before they're committed to the cache DB, so a
block verdict deletes the object instead of ever exposing it to a
client. Scanners pull the staged bytes themselves via a short-lived
HMAC-signed internal route rather than the proxy pushing bytes to them,
keeping the mechanism storage-backend-agnostic and avoiding uploading
potentially huge artifacts through the proxy's own egress.

Hardening baked in from the start: the internal scan-fetch route is
gated both at router-mount time and in the handler so it's inert
whenever scanning is disabled or unsigned; the signing key is mandatory
whenever scanning is enabled, enforced directly in scanner.NewGroup
rather than relying on callers to invoke config validation; the scan
call and the delete-on-block cleanup both run on a context detached
from the client's, so a client disconnecting mid-scan can't be mistaken
for a scanner failure, doesn't cause a legitimate artifact to be
deleted, and doesn't leave a genuinely blocked artifact's bytes
orphaned in storage; and scanner infrastructure errors (connection
failures, internal hostnames) are never forwarded verbatim to anonymous
clients, only a generic message. The scan-error metric also correctly
distinguishes a scanner's own timeout from being cancelled because a
sibling scanner already decided the verdict.

Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-03 10:06:44 +01:00
..
group.go Add pre-cache artifact scanning hook (trivy/ClamAV/Wiz/custom) (#298) 2026-09-03 10:06:44 +01:00
group_test.go Add pre-cache artifact scanning hook (trivy/ClamAV/Wiz/custom) (#298) 2026-09-03 10:06:44 +01:00
http.go Add pre-cache artifact scanning hook (trivy/ClamAV/Wiz/custom) (#298) 2026-09-03 10:06:44 +01:00
http_test.go Add pre-cache artifact scanning hook (trivy/ClamAV/Wiz/custom) (#298) 2026-09-03 10:06:44 +01:00
scanner.go Add pre-cache artifact scanning hook (trivy/ClamAV/Wiz/custom) (#298) 2026-09-03 10:06:44 +01:00