[No Ticket] Stricter redirects when interacting with registry v2 api #1308
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.
Overview
This PR, addresses some of the root cause of STM transaction errors, seen for some of container scanning runs.
Acceptance criteria
fossa-cli
does not throw 400 Error, when docker.io decides to use s3 storage proxy for manifests and blobs.Testing plan
To force non-cloudfront storage proxy (specifically s3),
fossa container-analyze -o --debug node:latest
(you should see STM transaction error, and 400 HTTP Error)Now, (download this PR's
fossa
binary from Build Action's summary artifact)4. Run
./fossa container-analyze -o --debug node:latest
(you should not see any errors)Risks
There is open ticket on this: containers/image#641, but consensus is that, we ought to strip headers on redirect. There is also ticket by podman: containers/podman#15187, and https://bugzilla.redhat.com/show_bug.cgi?id=1695236
I think ideal solution is to re-implement same logic, as docker client, which only injects headers, if and only if, it matches host used for token generation - in the redirect chain - but for now I think this should be better alternative, while we replicate /ticket exact docker-client behaviour in redirect chain.
Metrics
N/A
References
I discovered this via bulk testing, as part of tar ticket.
Checklist
If this PR introduced a user-visible change, I added documentation intodocs/
.Changelog.md
. If this PR did not mark a release, I added my changes into an# Unreleased
section at the top.If I made changes to.fossa.yml
orfossa-deps.{json.yml}
, I updateddocs/references/files/*.schema.json
. You may also need to update these if you have added/removed new dependency type (e.g.pip
) or analysis target type (e.g.poetry
).If I made changes to a subcommand's options, I updateddocs/references/subcommands/<subcommand>.md
.