-
Notifications
You must be signed in to change notification settings - Fork 99
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add automatic vulnerabilities check for released binaries #123
Merged
Merged
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
name: Check binaries | ||
|
||
on: | ||
workflow_dispatch: | ||
schedule: | ||
- cron: "0 16 * * 1-5" # min h d Mo DoW / 9am PST M-F | ||
|
||
jobs: | ||
check-for-vulnerabilities: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
report_contents: ${{ steps.save-output.outputs.report_contents }} | ||
steps: | ||
- uses: actions/setup-python@v5 | ||
with: | ||
python-version: '3.11' | ||
- uses: actions/checkout@v4 | ||
with: | ||
ref: main | ||
- uses: robinraju/[email protected] | ||
with: | ||
latest: true | ||
fileName: 'aws-lambda-rie*' | ||
out-file-path: "bin" | ||
- name: Run check for vulnerabilities | ||
id: check-binaries | ||
run: | | ||
make check-binaries | ||
- if: always() && failure() # Failure means there are vulnerabilities | ||
id: save-output | ||
name: Save output contents | ||
run: | | ||
report_csv="$(ls -tr output.cve-bin-*.csv 2>/dev/null | tail -n1)" # last file generated | ||
echo "Vulnerabilities stored in $report_csv" | ||
final_report="${report_csv}.txt" | ||
awk -F',' '{n=split($10, path, "/"); print $2,$3,$4,$5,path[n]}' "$report_csv" | column -t > "$final_report" # make the CSV nicer | ||
echo "report_contents<<EOF" >> "$GITHUB_OUTPUT" | ||
cat "$final_report" >> "$GITHUB_OUTPUT" | ||
echo "EOF" >> "$GITHUB_OUTPUT" | ||
- if: always() && steps.check-binaries.outcome == 'failure' | ||
name: Build new version and check | ||
id: check-new-version | ||
run: | | ||
mkdir ./bin2 | ||
mv ./bin/* ./bin2 | ||
make compile-with-docker-all | ||
latest_version=$(strings bin/aws-lambda-rie* | grep '^go1\.' | sort | uniq) | ||
echo "latest_version=$latest_version" >> "$GITHUB_OUTPUT" | ||
make check-binaries | ||
- if: always() && steps.check-binaries.outcome == 'failure' | ||
name: Save output for new version | ||
id: save-new-version | ||
run: | | ||
exit_code=$? | ||
if [ "${{ steps.check-new-version.outcome }}" == "failure" ]; then | ||
fixed="No" | ||
else | ||
fixed="Yes" | ||
fi | ||
echo "fixed=$fixed" >> "$GITHUB_OUTPUT" | ||
- if: always() && steps.check-binaries.outcome == 'failure' | ||
name: Create Issue | ||
id: create-issue | ||
uses: dacbd/create-issue-action@main | ||
with: | ||
token: ${{ github.token }} | ||
title: | | ||
CVEs found in latest RIE release | ||
body: | | ||
### CVEs found in latest RIE release | ||
``` | ||
${{ steps.save-output.outputs.report_contents }} | ||
``` | ||
|
||
#### Are these resolved by building with the latest patch version of Go (${{ steps.check-new-version.outputs.latest_version }})?: | ||
> **${{ steps.save-new-version.outputs.fixed }}** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is
always()
checking for? Edit: I see in the docs it's to have it run even if a previous step fails (https://docs.github.com/en/actions/learn-github-actions/expressions#status-check-functions) maybe we could add that as a comment here as well?