Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

known_vulnerability semver matching issue #57

Open
becojo opened this issue May 3, 2024 · 1 comment
Open

known_vulnerability semver matching issue #57

becojo opened this issue May 3, 2024 · 1 comment
Assignees

Comments

@becojo
Copy link
Contributor

becojo commented May 3, 2024

Describe the bug

When hashicorp/go-version is given a GitHub Actions version "4", it pads the rest of the semver components with zeros making the effective version "4.0.0" https://github.com/hashicorp/go-version/blob/644291d14038339745c2d883a1a114488e30b702/version.go#L77-L82

This makes it so when trying to match version "4" against a vulnerable version range such as ">=4.0.0,<4.4.1", version "4.0.0" is considered part of the range. The expected result of this test case should be flipped:

diff --git a/opa/opa_test.go b/opa/opa_test.go
index 5ca7d5e..9f8979c 100644
--- a/opa/opa_test.go
+++ b/opa/opa_test.go
@@ -67,7 +67,7 @@ func TestSemverConstraintCheck(t *testing.T) {
 		{
 			constraint: ">=4.0.0,<4.4.1",
 			version:    "4",
-			expected:   true,
+			expected:   false,
 		},
@fproulx-boostsecurity
Copy link
Contributor

I guess this could be closed @becojo

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

No branches or pull requests

2 participants