Skip to content
Open
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
1 change: 1 addition & 0 deletions .golangci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ issues:
- ireturn
- wrapcheck
- errcheck
- dupl
- path: internal/view/(.+)_test\.go
linters:
- testpackage
Expand Down
2 changes: 2 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -105,3 +105,5 @@ require (
gopkg.in/warnings.v0 v0.1.2 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)

// replace github.com/snyk/go-application-framework => ../go-application-framework

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe add a snapshot case where there are some upgrades & pins in the summary

Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,42 @@
"packageManager": "",
"policy": "",
"projectName": "",
"remediation": {
"ignore": null,
"patch": null,
"pin": {},
"unresolved": [
{
"creationTime": "2025-07-28T17:11:43.000000Z",
"cvssScore": 0,
"description": "Test vulnerability description",
"disclosureTime": "2025-07-28T17:11:43.000000Z",
"epssDetails": null,
"from": [
"[email protected]",
"[email protected]"
],
"id": "snyk-vuln-123",
"isPatchable": false,
"isUpgradable": false,
"language": "js",
"malicious": true,
"modificationTime": "2025-07-28T17:11:43.000000Z",
"name": "foo",
"packageManager": "npm",
"packageName": "foo",
"publicationTime": "2025-07-28T17:11:43.000000Z",
"reachability": "REACHABLE",
"riskScore": 80,
"severity": "high",
"socialTrendAlert": false,
"title": "Test High Severity Finding",
"upgradePath": null,
"version": "0.0.0"
}
],
"upgrade": {}
},
"summary": "",
"uniqueCount": 1,
"vulnerabilities": [
Expand All @@ -34,7 +70,10 @@
"description": "Test vulnerability description",
"disclosureTime": "2025-07-28T17:11:43.000000Z",
"epssDetails": null,
"from": [],
"from": [
"[email protected]",
"[email protected]"
],
"id": "snyk-vuln-123",
"isPatchable": false,
"isUpgradable": false,
Expand Down
12 changes: 8 additions & 4 deletions internal/commands/ostest/consolidation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ func Test_consolidateFindings(t *testing.T) {
},
}

consolidated := ostest.ConsolidateFindings(findings, &logger)
consolidated, err := ostest.ConsolidateFindings(findings, &logger)
require.NoError(t, err)
require.Len(t, consolidated, 1)

// The highest risk score (900) should be preserved
Expand Down Expand Up @@ -84,7 +85,8 @@ func Test_consolidateFindings(t *testing.T) {
},
}

consolidated := ostest.ConsolidateFindings(findings, &logger)
consolidated, err := ostest.ConsolidateFindings(findings, &logger)
require.NoError(t, err)
require.Len(t, consolidated, 1)

// The highest severity (critical) should be preserved
Expand Down Expand Up @@ -123,7 +125,8 @@ func Test_consolidateFindings(t *testing.T) {
},
}

consolidated := ostest.ConsolidateFindings(findings, &logger)
consolidated, err := ostest.ConsolidateFindings(findings, &logger)
require.NoError(t, err)
require.Len(t, consolidated, 1)

// Both the highest risk score (950) and highest severity (critical) should be preserved
Expand Down Expand Up @@ -154,7 +157,8 @@ func Test_consolidateFindings(t *testing.T) {
},
}

consolidated := ostest.ConsolidateFindings(findings, &logger)
consolidated, err := ostest.ConsolidateFindings(findings, &logger)
require.NoError(t, err)
require.Len(t, consolidated, 1)

// Should preserve the risk score from the second finding
Expand Down
22 changes: 19 additions & 3 deletions internal/commands/ostest/sbom_reachability_flow_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,17 +135,33 @@ func setupTest(ctx context.Context, t *testing.T, ctrl *gomock.Controller, jsonO
require.NoError(t, err)

// Create mock evidence
ev := testapi.Evidence{}
err = ev.FromReachabilityEvidence(testapi.ReachabilityEvidence{
reachEv := testapi.Evidence{}
err = reachEv.FromReachabilityEvidence(testapi.ReachabilityEvidence{
Reachability: testapi.ReachabilityTypeFunction,
})
require.NoError(t, err)

depPathEv := testapi.Evidence{}
err = depPathEv.FromDependencyPathEvidence(testapi.DependencyPathEvidence{
Path: []testapi.Package{
{
Name: "root",
Version: "1.0.0",
},
{
Name: "foo",
Version: "0.0.0",
},
},
Source: testapi.DependencyPath,
})
require.NoError(t, err)

// Create mock FindingAttributes
findingAttrs := testapi.FindingAttributes{
CauseOfFailure: false,
Description: "Test vulnerability description",
Evidence: []testapi.Evidence{ev},
Evidence: []testapi.Evidence{reachEv, depPathEv},
FindingType: testapi.FindingTypeSca,
Key: "TEST-FINDING-KEY",
Locations: []testapi.FindingLocation{location},
Expand Down
Loading