Skip to content

Commit 0e12664

Browse files
committed
feat: Add automatic vulnerabilities check
1 parent d37e08c commit 0e12664

File tree

2 files changed

+80
-1
lines changed

2 files changed

+80
-1
lines changed

.github/workflows/check-binaries.yml

+76
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
name: Check binaries
2+
3+
on:
4+
workflow_dispatch:
5+
schedule:
6+
- cron: "0 16 * * 1-5" # min h d Mo DoW / 9am PST M-F
7+
8+
jobs:
9+
check-for-vulnerabilities:
10+
runs-on: ubuntu-latest
11+
outputs:
12+
report_contents: ${{ steps.save-output.outputs.report_contents }}
13+
steps:
14+
- uses: actions/setup-python@v5
15+
with:
16+
python-version: '3.11'
17+
- uses: actions/checkout@v4
18+
with:
19+
ref: main
20+
- uses: robinraju/[email protected]
21+
with:
22+
latest: true
23+
fileName: 'aws-lambda-rie*'
24+
out-file-path: "bin"
25+
- name: Run check for vulnerabilities
26+
id: check-binaries
27+
run: |
28+
make check-binaries
29+
- if: always() && failure() # Failure means there are vulnerabilities
30+
id: save-output
31+
name: Save output contents
32+
run: |
33+
report_csv="$(ls -tr output.cve-bin-*.csv 2>/dev/null | tail -n1)" # last file generated
34+
echo "Vulnerabilities stored in $report_csv"
35+
final_report="${report_csv}.txt"
36+
awk -F',' '{n=split($10, path, "/"); print $2,$3,$4,$5,path[n]}' "$report_csv" | column -t > "$final_report" # make the CSV nicer
37+
echo "report_contents<<EOF" >> "$GITHUB_OUTPUT"
38+
cat "$final_report" >> "$GITHUB_OUTPUT"
39+
echo "EOF" >> "$GITHUB_OUTPUT"
40+
- if: always() && steps.check-binaries.outcome == 'failure'
41+
name: Build new version and check
42+
id: check-new-version
43+
run: |
44+
mkdir ./bin2
45+
mv ./bin/* ./bin2
46+
make compile-with-docker-all
47+
latest_version=$(strings bin/aws-lambda-rie* | grep '^go1\.' | sort | uniq)
48+
echo "latest_version=$latest_version" >> "$GITHUB_OUTPUT"
49+
make check-binaries
50+
- if: always() && steps.check-binaries.outcome == 'failure'
51+
name: Save output for new version
52+
id: save-new-version
53+
run: |
54+
exit_code=$?
55+
if [ "${{ steps.check-new-version.outcome }}" == "failure" ]; then
56+
fixed="No"
57+
else
58+
fixed="Yes"
59+
fi
60+
echo "fixed=$fixed" >> "$GITHUB_OUTPUT"
61+
- if: always() && steps.check-binaries.outcome == 'failure'
62+
name: Create Issue
63+
id: create-issue
64+
uses: dacbd/create-issue-action@main
65+
with:
66+
token: ${{ github.token }}
67+
title: |
68+
CVEs found in latest RIE release
69+
body: |
70+
### CVEs found in latest RIE release
71+
```
72+
${{ steps.save-output.outputs.report_contents }}
73+
```
74+
75+
#### Are these resolved by building with the latest patch version of Go (${{ steps.check-new-version.outputs.latest_version }})?:
76+
> **${{ steps.save-new-version.outputs.fixed }}**

Makefile

+4-1
Original file line numberDiff line numberDiff line change
@@ -70,4 +70,7 @@ integ-tests-with-docker-old:
7070
make ARCH=old compile-with-docker
7171
make prep-python
7272
make TEST_ARCH="" TEST_PORT=9052 exec-python-e2e-test
73-
73+
74+
check-binaries: prep-python
75+
.venv/bin/pip install cve-bin-tool
76+
.venv/bin/python -m cve_bin_tool.cli bin/ -r go -d REDHAT,OSV,GAD,CURL --no-0-cve-report -f csv

0 commit comments

Comments
 (0)