-
Notifications
You must be signed in to change notification settings - Fork 2
chore: Add Security Scan #14
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
saichandrapandraju
merged 8 commits into
trustyai-explainability:main
from
AmberJBlue:main
Sep 29, 2025
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
bdac6f1
update security-scan.yaml
AmberJBlue 3746750
update security-scan.yaml
AmberJBlue c87df5e
test grouping
AmberJBlue a24eec0
update security-scan.yaml
AmberJBlue 4ae63fa
Merge pull request #1 from AmberJBlue/security-scan
AmberJBlue 4957e14
Pin actions to SHA
AmberJBlue 515c227
enable pip cache for Trivy job
AmberJBlue 5318088
Upload bandit results to security tab
AmberJBlue 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,115 @@ | ||
| name: Security Scan | ||
|
|
||
| on: | ||
| push: | ||
| branches: [main] | ||
| pull_request: | ||
| branches: [main] | ||
| workflow_dispatch: | ||
|
|
||
| jobs: | ||
| trivy-scan: | ||
| name: Trivy | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: read | ||
| security-events: write | ||
| actions: read | ||
|
|
||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Set up Python | ||
| uses: actions/setup-python@v5 | ||
| with: | ||
| python-version: '3.11' | ||
| cache: "pip" | ||
|
|
||
| - name: Install dependencies | ||
| run: | | ||
| python -m pip install --upgrade pip | ||
| if [ -f pyproject.toml ]; then | ||
| pip install -e ".[dev]" | ||
| fi | ||
|
|
||
| - name: Run Trivy vulnerability scan | ||
| uses: aquasecurity/trivy-action@77137e9dc3ab1b329b7c8a38c2eb7475850a14e8 | ||
| with: | ||
| scan-type: 'fs' | ||
| scan-ref: '.' | ||
| format: 'sarif' | ||
| output: 'trivy-results.sarif' | ||
| severity: 'CRITICAL,HIGH,MEDIUM,LOW' | ||
| exit-code: '0' | ||
|
|
||
| - name: Check for critical and high vulnerabilities | ||
| uses: aquasecurity/trivy-action@77137e9dc3ab1b329b7c8a38c2eb7475850a14e8 | ||
| with: | ||
| scan-type: 'fs' | ||
| scan-ref: '.' | ||
| format: 'table' | ||
| severity: 'CRITICAL,HIGH' | ||
| exit-code: '1' | ||
|
|
||
| - name: Upload Trivy scan results to Security tab | ||
| uses: github/codeql-action/upload-sarif@v3 | ||
| if: always() | ||
| with: | ||
| sarif_file: 'trivy-results.sarif' | ||
| category: 'trivy-security-scan' | ||
|
|
||
| bandit-scan: | ||
| name: Bandit | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| security-events: write | ||
| actions: read | ||
| contents: read | ||
| checks: write | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - name: Set up Python | ||
| uses: actions/setup-python@v5 | ||
| with: | ||
| python-version: "3.11" | ||
| cache: "pip" | ||
|
|
||
| - name: Create virtual environment | ||
| run: | | ||
| python -m pip install --upgrade pip | ||
| python -m venv .venv | ||
|
|
||
| - name: Install dependencies | ||
| run: | | ||
| source .venv/bin/activate | ||
| pip install -e ".[dev]" | ||
|
|
||
| - name: Install Bandit | ||
| run: | | ||
| source .venv/bin/activate | ||
| pip install bandit[sarif] | ||
|
|
||
| - name: Run Bandit Security Scan | ||
| uses: PyCQA/bandit-action@67a458d90fa11fb1463e91e7f4c8f068b5863c7f | ||
| with: | ||
| targets: "." | ||
| exclude: "tests" | ||
|
|
||
| - name: Upload SARIF results to GitHub Security tab | ||
| if: github.ref == 'refs/heads/main' | ||
| uses: github/codeql-action/upload-sarif@86b04fb0e47484f7282357688f21d5d0e32175fe | ||
| with: | ||
| sarif_file: results.sarif | ||
| category: bandit-security-scan | ||
| continue-on-error: true | ||
|
|
||
| - name: Upload SARIF as artifact | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: bandit-sarif-results | ||
| path: results.sarif | ||
| retention-days: 30 | ||
| continue-on-error: true | ||
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.