test(ghrel): verify a real GitHub asset against the hash spc pins - #205
Merged
Merged
Conversation
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 Preview — removed Preview deployment has been torn down. |
This branch was previously deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
Acceptand always returns bytes. A proxy that never sends the header is indistinguishable from one that does, against that server.That is why
TestAPIAssetEndpointServesBytesNotJSONpassed the whole time the fleet was serving 1,429 bytes of metadata JSON in place ofzlib-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
livegithubbuild tag so CI stays hermetic and offline:Verified against api.github.com: