Skip to content

Commit 4e3b875

Browse files
authored
Add "Find vulnerabilities" workflow based on scancode-action (#267)
Signed-off-by: tdruez <[email protected]>
1 parent b4b8cab commit 4e3b875

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Find dependencies vulnerabilities
2+
3+
on: [push]
4+
5+
jobs:
6+
scan-codebase:
7+
runs-on: ubuntu-24.04
8+
name: Inspect packages with ScanCode.io
9+
steps:
10+
- uses: actions/checkout@v4
11+
with:
12+
path: scancode-inputs
13+
sparse-checkout: setup.cfg
14+
sparse-checkout-cone-mode: false
15+
16+
- uses: nexB/scancode-action@alpha
17+
with:
18+
pipelines: "inspect_packages:StaticResolver,find_vulnerabilities"
19+
env:
20+
VULNERABLECODE_URL: https://public.vulnerablecode.io/
21+
22+
- name: Fail in case of vulnerabilities
23+
shell: bash
24+
run: |
25+
scanpipe shell --command '
26+
from scanpipe.models import Project
27+
project = Project.objects.get()
28+
packages_qs = project.discoveredpackages.vulnerable()
29+
dependencies_qs = project.discovereddependencies.vulnerable()
30+
vulnerability_count = packages_qs.count() + dependencies_qs.count()
31+
if vulnerability_count:
32+
print(vulnerability_count, "vulnerabilities found:")
33+
for entry in [*packages_qs, *dependencies_qs]:
34+
print(entry)
35+
exit(1)
36+
else:
37+
print("No vulnerabilities found")
38+
exit(0)
39+
'

0 commit comments

Comments
 (0)