fix(vex): handle 304 status code#10307
Open
alegrey91 wants to merge 1 commit intoaquasecurity:mainfrom
Open
Conversation
e2637f6 to
486981c
Compare
Co-authored-by: Fabrizio Sestito <[email protected]> Signed-off-by: Alessio Greggi <[email protected]>
940a4a3 to
3809871
Compare
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.
Description
Currently, trivy deletes the content of the vex cache every time a new download happens.
This action is not always needed, since when an ETag is provided, the server may respond with
304 Not Modified, meaning the existing content atdstis still valid.In that case, trivy should not destroy
dst. Instead, we can move it aside as a backup and restore it on 304.This particular case happens when a Vexhub repository has a small ' update_interval '.
Here's the original PR where we noticed the bug: kubewarden/sbomscanner#867
cc @fabriziosestito
Related issues
There's no open issue for it.
Remove this section if you don't have related PRs.
Checklist