File tree Expand file tree Collapse file tree 1 file changed +25
-3
lines changed Expand file tree Collapse file tree 1 file changed +25
-3
lines changed Original file line number Diff line number Diff line change 1515package scvs
1616
1717import (
18+ "bytes"
1819 "fmt"
1920 "os"
2021 "os/exec"
@@ -164,10 +165,31 @@ func IsSBOMTimestamped(d sbom.Document, s *scvsScore) bool {
164165
165166// 2.8 SBOM is analyzed for risk(L1, L2, L3)
166167func IsSBOMAnalyzedForRisk (d sbom.Document , s * scvsScore ) bool {
167- // N/A
168- s .setDesc ("Not Supported(N/A)" )
168+ // // N/A
169+ // s.setDesc("Not Supported(N/A)")
170+ // return false
171+
172+ // Run OpenSCA CLI to check for vulnerabilities
173+ cmd := exec .Command ("opensca-cli" , "scan" , "--path" , "~/sbom/sbomqs-fossa.spdx.json " )
174+
175+ var out bytes.Buffer
176+ cmd .Stdout = & out
177+ err := cmd .Run ()
178+ if err != nil {
179+ s .setDesc ("Error running OpenSCA CLI: " + err .Error ())
180+ return false
181+ }
182+
183+ // Parse the output to check for vulnerabilities
184+ output := out .String ()
185+ if strings .Contains (output , "Vulnerabilities found" ) {
186+ s .setDesc ("Vulnerabilities found in SBOM components" )
187+ return true
188+ }
189+
190+ s .setDesc ("No vulnerabilities found" )
169191 return false
170- } // 2.8
192+ }
171193
172194// 2.9 SBOM contains a complete and accurate inventory of all components the SBOM describes(L1, L2, L3)
173195func IsSBOMHasInventoryOfDependencies (d sbom.Document , s * scvsScore ) bool {
You can’t perform that action at this time.
0 commit comments