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

add gitlab CVE-2024-5655 #140

Merged
merged 2 commits into from
Jul 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 34 additions & 14 deletions opa/rego/external/build_platform.rego
Original file line number Diff line number Diff line change
@@ -1,20 +1,40 @@
package external.build_platform

advisories = {
"gitlab": {"CVE-2024-2651": {
"osv_id": "CVE-2024-2651",
"published": "2024-05-14T00:00:00Z",
"aliases": [],
"summary": "It was possible for an attacker to cause a denial of service using maliciously crafted markdown content.",
"severity": [{
"type": "CVSS_V3",
"score": "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H",
}],
"cwe_ids": ["CWE-400"],
"vulnerable_versions": [],
"vulnerable_version_ranges": [">=0,<16.9.7"],
"vulnerable_commit_shas": [],
}},
"gitlab": {
"CVE-2024-5655": {
"osv_id": "CVE-2024-5655",
"published": "2024-06-26T00:00:00Z",
"aliases": [],
"summary": "It was possible for an attacker to trigger a pipeline as another user under certain circumstances.",
"severity": [{
"type": "CVSS_V3",
"score": "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:H/I:H/A:N",
}],
"cwe_ids": ["CWE-284"],
"vulnerable_versions": [],
"vulnerable_version_ranges": [
">=15.8.0,<16.11.5",
">=17.0.0,<17.0.3",
">=17.1.0,<17.1.1",
],
"vulnerable_commit_shas": [],
},
"CVE-2024-2651": {
"osv_id": "CVE-2024-2651",
"published": "2024-05-14T00:00:00Z",
"aliases": [],
"summary": "It was possible for an attacker to cause a denial of service using maliciously crafted markdown content.",
"severity": [{
"type": "CVSS_V3",
"score": "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H",
}],
"cwe_ids": ["CWE-400"],
"vulnerable_versions": [],
"vulnerable_version_ranges": [">=0,<16.9.7"],
"vulnerable_commit_shas": [],
},
},
"github": {"CVE-2024-4985": {
"osv_id": "CVE-2024-4985",
"published": "2024-05-20T00:00:00Z",
Expand Down
15 changes: 4 additions & 11 deletions opa/rego/rules/known_vulnerability_in_build_platform.rego
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,11 @@ import rego.v1

rule := poutine.rule(rego.metadata.chain())

provider_advisory(provider, provider_version) = advisory if {
version := provider_version
advisory := advisories[provider][osv_id]

regex.match("^[0-9]+(\\.[0-9]+)*?$", version)

semver.constraint_check(advisory.vulnerable_version_ranges[_], version)
}

results contains poutine.finding(rule, input.provider, {
"osv_id": advisory.osv_id,
"details": sprintf("Provider: %s", [input.provider]),
}) if {
advisory := provider_advisory(input.provider, input.version)
}
advisory := advisories[input.provider][osv_id]
regex.match("^[0-9]+(\\.[0-9]+)*?$", input.version)
semver.constraint_check(advisory.vulnerable_version_ranges[_], input.version)
}
8 changes: 8 additions & 0 deletions scanner/inventory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,14 @@ func TestFindings(t *testing.T) {
Details: "Provider: gitlab",
},
},
{
RuleId: "known_vulnerability_in_build_platform",
Purl: "gitlab",
Meta: opa.FindingMeta{
OsvId: "CVE-2024-5655",
Details: "Provider: gitlab",
},
},
{
RuleId: "injection",
Purl: purl,
Expand Down