1
0
Fork 1
mirror of https://github.com/git-pkgs/proxy.git synced 2026-06-02 08:38:17 -04:00
pkg-proxy/internal/handler
Andrew Nesbitt 61741123bf
Verify cached artifacts on read (#111)
checkCache opened the storage reader and streamed it to the client
without checking that the bytes still matched what was originally
stored, or what the upstream registry declared. Disk corruption,
accidental overwrites, or local tampering would go unnoticed.

Wrap the storage reader in a verifyingReader that computes SHA256
(against artifact.content_hash) and, when version.integrity holds an
SRI string, the corresponding sha256/384/512 digest as bytes flow
through. At EOF the digests are compared; on mismatch we log at
error level, bump proxy_integrity_failures_total, and clear the
artifact's cache entry so the next request refetches from upstream.

Verification is skipped when the stream was not fully consumed
(client disconnect) to avoid evicting good artifacts on partial
reads. The DirectServe presigned-URL path is unverified since the
proxy never sees those bytes.

Refs #42 (part 1)
2026-05-03 10:36:28 +01:00
..
cargo.go Add mirror command and API for selective package mirroring 2026-04-13 09:01:04 +01:00
cargo_test.go Add mirror command and API for selective package mirroring 2026-04-13 09:01:04 +01:00
composer.go Apply 'go fmt' as suggested in CONTRIBUTING.md. 2026-04-18 07:43:22 -04:00
composer_test.go Add failing tests for composer dist URL and shared reference bugs 2026-04-06 17:07:20 +01:00
conan.go Add mirror command and API for selective package mirroring 2026-04-13 09:01:04 +01:00
conan_test.go Fix all golangci-lint issues across the codebase (#32) 2026-03-18 10:59:29 +00:00
conda.go Add mirror command and API for selective package mirroring 2026-04-13 09:01:04 +01:00
conda_test.go Apply 'go fmt' as suggested in CONTRIBUTING.md. 2026-04-18 07:43:22 -04:00
container.go Apply 'go fmt' as suggested in CONTRIBUTING.md. 2026-04-18 07:43:22 -04:00
container_test.go Apply 'go fmt' as suggested in CONTRIBUTING.md. 2026-04-18 07:43:22 -04:00
cran.go Add mirror command and API for selective package mirroring 2026-04-13 09:01:04 +01:00
cran_test.go Hello world 2026-01-20 22:00:31 +00:00
debian.go Fix review issues in mirror feature 2026-04-13 09:01:04 +01:00
debian_test.go Fix all golangci-lint issues across the codebase (#32) 2026-03-18 10:59:29 +00:00
download_test.go Add mirror command and API for selective package mirroring 2026-04-13 09:01:04 +01:00
gem.go Add mirror command and API for selective package mirroring 2026-04-13 09:01:04 +01:00
gem_test.go Add cooldown support for RubyGems 2026-04-06 13:16:26 +01:00
go.go Add mirror command and API for selective package mirroring 2026-04-13 09:01:04 +01:00
go_test.go Hello world 2026-01-20 22:00:31 +00:00
handler.go Verify cached artifacts on read (#111) 2026-05-03 10:36:28 +01:00
handler_test.go Add storage.direct_serve_base_url to override presigned URL host 2026-04-27 12:14:37 +01:00
hex.go Add mirror command and API for selective package mirroring 2026-04-13 09:01:04 +01:00
hex_test.go Add cooldown support for Hex 2026-04-06 13:18:57 +01:00
integrity.go Verify cached artifacts on read (#111) 2026-05-03 10:36:28 +01:00
integrity_test.go Verify cached artifacts on read (#111) 2026-05-03 10:36:28 +01:00
maven.go Add mirror command and API for selective package mirroring 2026-04-13 09:01:04 +01:00
maven_test.go Hello world 2026-01-20 22:00:31 +00:00
npm.go Add mirror command and API for selective package mirroring 2026-04-13 09:01:04 +01:00
npm_test.go Apply 'go fmt' as suggested in CONTRIBUTING.md. 2026-04-18 07:43:22 -04:00
nuget.go Apply 'go fmt' as suggested in CONTRIBUTING.md. 2026-04-18 07:43:22 -04:00
nuget_test.go Apply 'go fmt' as suggested in CONTRIBUTING.md. 2026-04-18 07:43:22 -04:00
path_traversal_test.go Check for path traversal after URL decoding (#108) 2026-05-03 09:07:16 +01:00
pub.go Fix metadata caching, 404 propagation, mirror progress, and registry stubs 2026-04-13 09:01:05 +01:00
pub_test.go Add version cooldown to filter recently published packages 2026-03-04 19:00:31 +00:00
pypi.go Apply 'go fmt' as suggested in CONTRIBUTING.md. 2026-04-18 07:43:22 -04:00
pypi_test.go Add upstream URL tests for all ecosystem download handlers (#51) 2026-04-01 15:22:52 +01:00
read_metadata_test.go Fix silent truncation of large npm metadata responses 2026-04-08 16:02:30 +01:00
rpm.go Add mirror command and API for selective package mirroring 2026-04-13 09:01:04 +01:00
rpm_test.go Fix all golangci-lint issues across the codebase (#32) 2026-03-18 10:59:29 +00:00