-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* test sbomgen v1.2.0-beta * test Dockerfile with vulns * Add Dockerfile vulnerabilities (#51) * Add test image for rendering Dockerfile checks * ignore .DS_Store (macOS) * Added starter tests * check if components and vulns are present * Added Dockerfile vuln parser * dockerfile finding markdown conversion * refactor for cleanliness * Remove mock secrets so I can push changes * Updated test data * testing for regression * Integrated Dockerfile checks system-wide * saving work * added CSV and MD integration tests --------- Co-authored-by: Michael Long <[email protected]> * Add workflow to demo Dockerfile vulns * Display Dockerfile scan results * Output Dockerfile findings as CSV only (debugging) * Change action url to this branch * Fix CLI typo * display sbomgen download url * debugging * debugging * debugging * debugging * roll back debug logs * roll back check() macro * check() becomes require_true() * fix typos in dockerfile inputs * fix typo when posting dockerfile csv * debugging set_github_actions_output() * add header to Dockerfile MD report * Update Dockerfile header * update workflow metadata * Add Dockerfile reports as download artifacts * Rename Dockerfile report header * Display Dockerfile findings in job terminal * Set Dockerfile dst csv * Debugging dockerfile reports in GHA terminal * Debug Dockerfile output variables * Test no vulns * Remove 'cat <report>' commands --------- Co-authored-by: Michael Long <[email protected]>
- Loading branch information
1 parent
3820085
commit a18de02
Showing
53 changed files
with
177,682 additions
and
35,826 deletions.
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
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
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
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
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
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,77 @@ | ||
name: Test Dockerfile Vulnerabilities | ||
|
||
# This workflow tests that the action can successfully | ||
# scan a GitHub repository. This workflow runs automatically | ||
# every 6 hours, and on pushes. | ||
|
||
on: | ||
schedule: | ||
- cron: '0 */6 * * *' # runs every 6 hours | ||
push: | ||
branches: # | ||
- '*' | ||
|
||
jobs: | ||
daily_job: | ||
runs-on: ubuntu-latest | ||
environment: | ||
name: plugin-development | ||
|
||
steps: | ||
- name: Checkout this repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Configure AWS credentials | ||
uses: aws-actions/configure-aws-credentials@v4 | ||
with: | ||
aws-region: ${{ secrets.AWS_REGION }} | ||
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
role-to-assume: ${{ secrets.AWS_IAM_ROLE }} | ||
|
||
- name: Scan Dockerfiles | ||
id: inspector | ||
uses: aws-actions/vulnerability-scan-github-action-for-amazon-inspector@test_sbomgen_1.2.0-beta | ||
with: | ||
artifact_type: 'repository' | ||
artifact_path: './' | ||
display_vulnerability_findings: "enabled" | ||
sbomgen_version: "1.2.0-beta" | ||
|
||
- name: Display scan results (JSON) | ||
run: cat ${{ steps.inspector.outputs.inspector_scan_results }} | ||
|
||
- name: Display package vulns (CSV) | ||
run: cat ${{ steps.inspector.outputs.inspector_scan_results_csv }} | ||
|
||
- name: Display package vulns (MD) | ||
run: cat ${{ steps.inspector.outputs.inspector_scan_results_markdown }} | ||
|
||
- name: Display Dockerfile vulns (CSV) | ||
run: cat ${{ steps.inspector.outputs.inspector_dockerfile_scan_results_csv }} | ||
|
||
- name: Display Dockerfile vulns (MD) | ||
run: cat ${{ steps.inspector.outputs.inspector_dockerfile_scan_results_markdown }} | ||
|
||
- name: Validate scan content | ||
run: python3 validator/validate_inspector_scan.py --file ${{ steps.inspector.outputs.inspector_scan_results }} | ||
|
||
- name: Demonstrate Upload Scan Results | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: Inspector Scan SBOM Results | ||
path: | | ||
${{ steps.inspector.outputs.artifact_sbom }} | ||
${{ steps.inspector.outputs.inspector_scan_results }} | ||
${{ steps.inspector.outputs.inspector_scan_results_csv }} | ||
${{ steps.inspector.outputs.inspector_scan_results_markdown }} | ||
${{ steps.inspector.outputs.inspector_dockerile_scan_results_csv }} | ||
${{ steps.inspector.outputs.inspector_dockerile_scan_results_markdown }} | ||
# only run if the previous step failed | ||
- name: Notify maintainers of validation failure | ||
if: ${{ failure() }} | ||
run: echo "this feature is not implemented" | ||
# TODO: add steps to send notification to a Lambda to cut a ticket on job failure | ||
|
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
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,54 @@ | ||
name: Test No Vulns | ||
|
||
# confirm that reports are not displayed when no vulns are found | ||
|
||
on: | ||
push: | ||
branches: # | ||
- '*' | ||
|
||
jobs: | ||
daily_job: | ||
runs-on: ubuntu-latest | ||
environment: | ||
name: plugin-development | ||
|
||
steps: | ||
|
||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Configure AWS credentials | ||
uses: aws-actions/configure-aws-credentials@v4 | ||
with: | ||
aws-region: ${{ secrets.AWS_REGION }} | ||
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
role-to-assume: ${{ secrets.AWS_IAM_ROLE }} | ||
|
||
- name: Test binary scan | ||
id: inspector | ||
uses: aws-actions/vulnerability-scan-github-action-for-amazon-inspector@test_sbomgen_1.2.0-beta | ||
with: | ||
artifact_type: 'binary' | ||
artifact_path: 'entrypoint/tests/test_data/artifacts/binaries/test_go_binary' | ||
display_vulnerability_findings: "enabled" | ||
output_sbom_path: 'sbom.json' | ||
output_inspector_scan_path: 'inspector_scan.json' | ||
output_inspector_scan_path_csv: 'inspector_pkg_scan.csv' | ||
output_inspector_dockerfile_scan_path_csv: 'inspector_dockerfile_scan.csv' | ||
output_inspector_dockerfile_scan_path_markdown: 'inspector_dockerfile_scan.md' | ||
sbomgen_version: "1.2.0-beta" | ||
|
||
- name: Demonstrate Upload Scan Results | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: Inspector Scan SBOM Results | ||
path: | | ||
${{ steps.inspector.outputs.artifact_sbom }} | ||
${{ steps.inspector.outputs.inspector_scan_results }} | ||
${{ steps.inspector.outputs.inspector_scan_results_csv }} | ||
${{ steps.inspector.outputs.inspector_scan_results_markdown }} | ||
${{ steps.inspector.outputs.inspector_dockerile_scan_results_csv }} | ||
${{ steps.inspector.outputs.inspector_dockerile_scan_results_markdown }} | ||
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
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
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 |
---|---|---|
|
@@ -4,3 +4,4 @@ plan.txt | |
__pycache__ | ||
scripts/entrypoint/test_data | ||
.coverage | ||
.DS_Store |
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
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
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
Oops, something went wrong.