Repository navigation
fix(rules): check major and minor action refs against the latest release in their line - #460
Open
Mohil-Ahuja wants to merge 2 commits into
Open
Mohil-Ahuja wants to merge 2 commits into
Mohil-Ahuja wants to merge 2 commits into
Conversation
…ase in their line known_vulnerability_in_build_component read a ref like `@v4` as 4.0.0, so an action pinned to a major tag was reported for any advisory that 4.0.0 falls into, even when the fix shipped in a later 4.x release that the moving v4 tag points to. Pad a major or minor ref to the highest version it can stand for before the constraint check. `@v4` is reported only when no 4.x release has the fix, `@v4.1` only when no 4.1.x release has it. Full versions are checked as before. The build platform rule, which also uses semver.constraint_check, is unchanged. Fixes boostsecurityio#443 Signed-off-by: Mohil Ahuja <mohilahuja@gmail.com>
Contributor
|
Sorry, but CI fails. Some tests do not pass @Mohil-Ahuja |
GHSA-6q4m-7476-932w affects github-slug-action below 4.4.1. The v4 tag of rlespinasse/github-slug-action points at v4.5.0, so with major refs checked against the latest release in their line, @v4 in gravy-overflow's level0.yml is no longer reported. Signed-off-by: Mohil Ahuja <mohilahuja@gmail.com>
Author
|
@fproulx-boostsecurity Thanks, fixed in c383a7d. The two failing snapshot tests expected |
This branch has not been 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.
Fixes #443
known_vulnerability_in_build_componenttrims thevfrom a ref and passes the rest tosemver.constraint_check, so@v4is checked as4.0.0. Action authors move a major tag (and often a minor one) to each new release in that line, so@v4runs the latest 4.x. With an advisory fixed in 4.2.0,@v4was reported even though the tag already points at a fixed release.This pads a major or minor ref to the highest version it can stand for before the check:
4becomes4.999999999.999999999and4.1becomes4.1.999999999. Along the lines of the padding suggested in the issue, but done in the rule rather than in the builtin:@v4is reported only if no 4.x release has the fix (e.g. a range<5.0.0).@v4.1is reported only if no 4.1.x release has it.@v4.1.2are checked exactly as before.semver.constraint_checkitself is unchanged, becauseknown_vulnerability_in_build_platformalso uses it for platform versions, where a short version is not a moving tag.The trade-off: a repository that never moves its major tag stays at whatever release the tag was cut on, and a ref to it would now be treated as the latest in its line. Moving major tags is the documented convention for actions, so this follows what the ref usually resolves to.
Tests
TestKnownVulnerabilityInBuildComponentFloatingRefsrunsstep_advisoryagainstrun-terraform.yml(vulnerable below 2.7.5, in the bundled advisories):v1v2v2.2v2.7v2.7.1,2.7.1v2.7.5,v3With the previous rule,
v2andv2.7fail (reported) and the rest pass.go test ./...passes; the existing@v2.2fixture inscanner/testdatais still reported, as 2.2.x is below 2.7.5.