Skip to content
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
16 changes: 16 additions & 0 deletions app/controlplane/api/gen/frontend/attestation/v1/crafting_state.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 13 additions & 3 deletions pkg/attestation/crafter/api/attestation/v1/crafting_state.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,8 @@ message PolicyVulnerabilityFinding {
string recommendation = 7;
// Optional longer description of the vulnerability
string description = 8;
// Version that fixes the vulnerability (e.g., "2.0.1", "1.3.4-patch1")
string fixed_version = 9;
}

// Output schema for SAST findings from policy evaluation.
Expand Down
17 changes: 17 additions & 0 deletions pkg/policies/engine/rego/builtins/vulnerability_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,23 @@ result := object.union(
"recommendation": "upgrade to v2.0.0",
},
},
{
name: "combined with object.union for fixed_version",
policy: `package test
import rego.v1

result := object.union(
chainloop.vulnerability("CVE found", "CVE-2024-5678", "pkg:npm/foo@1.0", "HIGH"),
{"fixed_version": "1.0.1"},
)`,
expected: map[string]any{
"message": "CVE found",
"external_id": "CVE-2024-5678",
"package_purl": "pkg:npm/foo@1.0",
"severity": "HIGH",
"fixed_version": "1.0.1",
},
},
{
name: "with sprintf interpolation",
policy: `package test
Expand Down
21 changes: 21 additions & 0 deletions pkg/policies/findings/registry_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,27 @@ func TestValidateFinding(t *testing.T) {
assert.Equal(t, "A buffer overflow vulnerability in the parsing module allows remote code execution.", f.GetDescription())
},
},
{
name: "valid vulnerability finding with fixed_version",
findingType: "VULNERABILITY",
raw: map[string]any{
"message": "Found CVE-2024-5678",
"external_id": "CVE-2024-5678",
"package_purl": "pkg:golang/example.com/lib@v1.0.0",
"severity": "HIGH",
"fixed_version": "1.0.1",
},
checkFn: func(t *testing.T, msg interface{}) {
t.Helper()
f, ok := msg.(*v1.PolicyVulnerabilityFinding)
require.True(t, ok)
assert.Equal(t, "Found CVE-2024-5678", f.GetMessage())
assert.Equal(t, "CVE-2024-5678", f.GetExternalId())
assert.Equal(t, "pkg:golang/example.com/lib@v1.0.0", f.GetPackagePurl())
assert.Equal(t, "HIGH", f.GetSeverity())
assert.Equal(t, "1.0.1", f.GetFixedVersion())
},
},
{
name: "vulnerability finding missing required field",
findingType: "VULNERABILITY",
Expand Down
Loading