-
Notifications
You must be signed in to change notification settings - Fork 25
Add Security Scan workflow as part of the SSDLC requirements #603
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
Merged
Merged
Changes from 20 commits
Commits
Show all changes
32 commits
Select commit
Hold shift + click to select a range
15b2fc9
Add initial trivy config
srbouffard 3b9eb2a
Add workflow trigger on dispatch
srbouffard 74438eb
Add on push event
srbouffard 19e82bd
Remove image-enabled config
srbouffard e45eebd
Updated with test integration tests branch
srbouffard e00130e
Remove image-enabled config
srbouffard 438ceff
Try trivy fs scan
srbouffard b9588bf
Moved to simplified trivy fs scan
srbouffard 81d2887
Remove ignore file
srbouffard 4cb582c
Relax trivy constraints
srbouffard 4305050
Add sbom gen
srbouffard a6151b3
fix condition
srbouffard 0f80414
Enable push of results
srbouffard 92e66b5
Fix artefact name
srbouffard 22c0046
Add artefact upload of trivy scan
srbouffard 51f46c9
Add known vul to trigger report
srbouffard ab56e9e
Update logic when job is triggered
srbouffard f475e7b
Add back branch for testing
srbouffard cae077b
Remove test config
srbouffard 02051bd
Update trivy.yaml
srbouffard e15601c
Merge remote-tracking branch 'origin' into add-vulnurability-scan
yanksyoon 4fb7aa7
Fix missing EOF
srbouffard 45f4e4c
Update action tags to specific versions
srbouffard 063a713
Merge branch 'main' into add-vulnurability-scan
srbouffard e7f4ecd
Add missing license header
srbouffard 6a4ee75
Merge remote-tracking branch 'origin/main' into add-vulnurability-scan
srbouffard 6e0e373
Add trivyignore
srbouffard b26ca7d
Create empty trivy when not present
srbouffard 450b184
Remove local branch ref
srbouffard 37c715c
Removed UPLOAD_RESULTS variable
srbouffard 158d34a
Merge branch 'main' into add-vulnurability-scan
srbouffard e625899
Merge branch 'main' into add-vulnurability-scan
srbouffard 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 hidden or 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,83 @@ | ||
name: Security Scan | ||
srbouffard marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
on: | ||
push: | ||
branches: [main] | ||
pull_request: | ||
workflow_dispatch: | ||
inputs: | ||
upload_results: | ||
description: "Upload SARIF and SBOM results" | ||
required: false | ||
type: boolean | ||
default: false | ||
|
||
env: | ||
# This value is used for push and pull_request triggers | ||
UPLOAD_RESULTS: true | ||
srbouffard marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
jobs: | ||
trivy-scan: | ||
name: Run Trivy Security Scan | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
security-events: write | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
srbouffard marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
- name: Run Trivy scan for logs | ||
uses: aquasecurity/[email protected] | ||
with: | ||
scan-type: "fs" | ||
scan-ref: "." | ||
trivy-config: "trivy.yaml" | ||
|
||
- name: Run Trivy scan for SARIF report | ||
uses: aquasecurity/[email protected] | ||
with: | ||
scan-type: "fs" | ||
scan-ref: "." | ||
trivy-config: "trivy.yaml" | ||
format: "sarif" | ||
output: "trivy-results.sarif" | ||
|
||
- name: Upload SARIF to GitHub Security tab | ||
if: (github.event_name == 'workflow_dispatch' && inputs.upload_results == true) || (github.event_name != 'workflow_dispatch' && env.UPLOAD_RESULTS == 'true') | ||
uses: github/codeql-action/upload-sarif@v3 | ||
srbouffard marked this conversation as resolved.
Show resolved
Hide resolved
|
||
with: | ||
sarif_file: "trivy-results.sarif" | ||
|
||
- name: Upload diagnostic SARIF artifact | ||
if: (github.event_name == 'workflow_dispatch' && inputs.upload_results == true) || (github.event_name != 'workflow_dispatch' && env.UPLOAD_RESULTS == 'true') | ||
uses: actions/upload-artifact@v4 | ||
srbouffard marked this conversation as resolved.
Show resolved
Hide resolved
|
||
with: | ||
name: sarif-report | ||
path: "trivy-results.sarif" | ||
retention-days: 7 | ||
|
||
generate-sbom: | ||
name: Generate SBOM from Filesystem | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
srbouffard marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
- name: Run Trivy to generate SBOM | ||
uses: aquasecurity/[email protected] | ||
with: | ||
scan-type: "fs" | ||
scan-ref: "." | ||
trivy-config: "trivy.yaml" | ||
format: "spdx-json" | ||
output: "dependency-results.sbom.json" | ||
github-pat: ${{ secrets.GITHUB_TOKEN }} | ||
srbouffard marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
- name: Upload SBOM as an artifact | ||
if: (github.event_name == 'workflow_dispatch' && inputs.upload_results == true) || (github.event_name != 'workflow_dispatch' && env.UPLOAD_RESULTS == 'true') | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: sbom | ||
path: "dependency-results.sbom.json" | ||
retention-days: 7 | ||
srbouffard marked this conversation as resolved.
Show resolved
Hide resolved
|
This file contains hidden or 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,13 @@ | ||
# Copyright 2025 Canonical Ltd. | ||
# See LICENSE file for licensing details. | ||
|
||
timeout: 20m | ||
srbouffard marked this conversation as resolved.
Show resolved
Hide resolved
|
||
severity: | ||
- UNKNOWN | ||
- LOW | ||
- MEDIUM | ||
- HIGH | ||
- CRITICAL | ||
vulnerability: | ||
ignore-unfixed: false | ||
exit-code: 0 | ||
srbouffard marked this conversation as resolved.
Show resolved
Hide resolved
|
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.