Skip to content

test(ghrel): verify a real GitHub asset against the hash spc pins - #205

Merged
luthermonson merged 1 commit into
mainfrom
test/ghrel-live-github
Sep 22, 2026
Merged

luthermonson merged 1 commit into
mainfrom
test/ghrel-live-github

Conversation

@luthermonson

Copy link
Copy Markdown
Contributor

Both ghrel production breaks were about what GitHub actually returns, and no hermetic test in this package could see either — they all assert against a fake upstream that ignores Accept and always returns bytes. A proxy that never sends the header is indistinguishable from one that does, against that server.

That is why TestAPIAssetEndpointServesBytesNotJSON passed the whole time the fleet was serving 1,429 bytes of metadata JSON in place of zlib-1.3.2.tar.gz.

This fetches the real asset through the proxy and checks its sha256 against the value spc pins — so it fails for the same reason spc failed, rather than for a reason I picked in advance. It fetches twice: a cache that stores the right bytes and returns the wrong ones on the hit path is equally broken.

Behind a livegithub build tag so CI stays hermetic and offline:

go test -tags livegithub ./pkg/proxies/ghrel/ -run TestLive -v

Verified against api.github.com:

cold:             1502830 bytes, sha256=bb329a0a2cd0274d05519d61c667c062e06990d72e125ee2dfa8de64f0119d16
warm (cache hit): 1502830 bytes, sha256=bb329a0a2cd0274d05519d61c667c062e06990d72e125ee2dfa8de64f0119d16

Both ghrel production breaks were about what GitHub actually returns,
and no hermetic test in this package could see either: they all assert
against a fake upstream that ignores Accept and always returns bytes. A
proxy that never sends the header is indistinguishable from one that
does, against that server. That is why TestAPIAssetEndpointServesBytesNotJSON
passed while the fleet served 1429 bytes of metadata JSON as zlib.

This fetches the real asset through the proxy, twice, and checks the
sha256 against the value spc pins — so it fails for the same reason spc
failed, rather than for a reason I chose in advance. The second fetch
covers the hit path: a cache that stores the right bytes and returns the
wrong ones is equally broken.

Behind a `livegithub` build tag so CI stays hermetic and offline:

    go test -tags livegithub ./pkg/proxies/ghrel/ -run TestLive -v

Verified against api.github.com: 1502830 bytes,
sha256=bb329a0a2cd0274d05519d61c667c062e06990d72e125ee2dfa8de64f0119d16
on both the cold fetch and the cache hit.
@ephpm

ephpm Bot commented Sep 22, 2026

Copy link
Copy Markdown

ePHPm Preview — removed

Preview deployment has been torn down.

@ephpm
ephpm Bot temporarily deployed to preview-pr-205 September 22, 2026 05:12 Inactive
@ephpm
ephpm Bot temporarily deployed to preview-pr-205 September 22, 2026 05:12 Inactive
@luthermonson
luthermonson merged commit 48e7851 into main Sep 22, 2026
4 checks passed
@luthermonson
luthermonson deleted the test/ghrel-live-github branch September 22, 2026 19:57

This branch was previously deployed

1 inactive deployment
preview-pr-205 de131455 Deployed Sep 22, 2026 by ephpm[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant