Skip to content

Commit 44b9bca

Browse files
committed
Complete check and issue creation.
1 parent 8a95085 commit 44b9bca

File tree

2 files changed

+47
-23
lines changed

2 files changed

+47
-23
lines changed

.github/workflows/check-binaries.yml

+46-22
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ on:
2121
jobs:
2222
check-binary:
2323
runs-on: ubuntu-latest
24-
# outputs:
25-
# vulnerability: ${{steps.laststep.outputs}}
24+
outputs:
25+
report_contents: ${{ steps.save-output.outputs.report_contents }}
2626
steps:
2727
- uses: actions/setup-python@v5
2828
with:
@@ -33,24 +33,48 @@ jobs:
3333
latest: true
3434
fileName: 'aws-lambda-rie*'
3535
out-file-path: "bin"
36-
- name: check-binaries
37-
run: make check-binaries
38-
- id: laststep
39-
run: cat $(ls -tr *.csv 2>/dev/null | tail -n1) >> "$GITHUB_OUTPUT"
40-
# - id: laststep
41-
# run: cat $(ls -tr *.csv 2>/dev/null | tail -n1) >> "$GITHUB_OUTPUT"
42-
# create-issue:
43-
# runs-on: ubuntu-latest
44-
# needs: check-binary
45-
# if: always() && needs.check-binary.outputs != ""
46-
# steps:
47-
# - name: Create Issue
48-
# uses: dacbd/create-issue-action@main
49-
# with:
50-
# token: ${{ github.token }}
51-
# title: |
52-
# CVEs found in latest RIE binaries
53-
# body: |
54-
# ## CVEs found in latest RIE binaries:
55-
# > **${{ needs.check-binary.outputs}}**
36+
- name: Run check for vulnerabilities
37+
id: check-binaries
38+
run: |
39+
make check-binaries
40+
- if: always() && failure() # Failure means there are vulnerabilities
41+
id: save-output
42+
name: Save output contents
43+
run: |
44+
report_csv="$(cat $(ls -tr output.cve-bin-*.csv 2>/dev/null | tail -n1))" # last file generated
45+
report="${report_csv}.txt"
46+
awk -F',' '{n=split($10, path, "/"); print $2,$3,$4,$5,path[n]}' "$report_csv" | column -t > "$report" # make the CSV nicer
47+
echo "report_contents=$(cat $report)" >> "$GITHUB_OUTPUT"
48+
create-issue:
49+
runs-on: ubuntu-latest
50+
needs: check-binary
51+
if: always() && needs.check-binary.outputs.report_contents != ''
52+
steps:
53+
- name: Build new version and check
54+
id: check-new-version
55+
run: |
56+
make compile-with-docker-all
57+
latest_version=$(strings bin/aws-lambda-rie* | grep '^go1\.' | uniq)
58+
echo "latest_version=$latest_version"
59+
make check_binaries
60+
exit_code=$?
61+
if [ "$exit_code" != "0" ]; then
62+
fixed="No"
63+
else
64+
fixed="Yes"
65+
fi
66+
echo fixed=$fixed" >> "$GITHUB_OUTPUT"
67+
68+
- name: Create Issue
69+
id: create-issue
70+
uses: dacbd/create-issue-action@main
71+
with:
72+
token: ${{ github.token }}
73+
title: |
74+
CVEs found in latest RIE release
75+
body: |
76+
## CVEs found in latest RIE release:
77+
> **${{ needs.check-binary.outputs.report_contents }}**
5678
79+
#### Is this fixed by updating to the latest Go version (${{steps.check-new-version.outputs.latest_version}})?):
80+
${{ steps.check-new-version.outputs.fixed }}

Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -73,4 +73,4 @@ integ-tests-with-docker-old:
7373

7474
check-binaries: prep-python
7575
.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
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)