From 26046e137cd022b96c51067c5bc04614d89da836 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 23 Nov 2025 11:48:18 +0000 Subject: [PATCH 1/4] Initial plan From b5e329ad2f89fb86f45de2eb13129388b3fcd6bc Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 23 Nov 2025 11:52:24 +0000 Subject: [PATCH 2/4] Add Trivy vulnerability scanning workflow and documentation Co-authored-by: TimInTech <129355283+TimInTech@users.noreply.github.com> --- .audit/README.md | 48 ++++++++++++++++++-- .github/workflows/trivy-scan.yml | 76 ++++++++++++++++++++++++++++++++ .gitignore | 5 +++ 3 files changed, 126 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/trivy-scan.yml diff --git a/.audit/README.md b/.audit/README.md index f1dbd5e..2595b0b 100644 --- a/.audit/README.md +++ b/.audit/README.md @@ -7,13 +7,55 @@ Repository checks and automation baselines. - `Sanity Checks` — runs `shellcheck` and `shfmt` on all tracked shell scripts. - `Link Check` — validates Markdown links with `lychee`. - `Release Drafter` — prepares changelog drafts for tagged releases. +- `Trivy Vulnerability Scan` — scans for vulnerabilities, secrets, and + misconfigurations using Trivy. Reports are saved to + `.audit/trivy-report.json` and `.audit/trivy-report.txt`. ## Manual Metrics -- Use `gh run list --limit 20 --json databaseId,createdAt,status,durationMs > .audit/ci_runs.json` to snapshot recent CI execution history. -- Add additional JSON or Markdown reports to this directory as new checks are introduced. +- Use `gh run list --limit 20 --json databaseId,createdAt,status,durationMs > + .audit/ci_runs.json` to snapshot recent CI execution history. +- Add additional JSON or Markdown reports to this directory as new checks are + introduced. + +## Vulnerability Scanning + +The repository uses Trivy for automated vulnerability scanning: + +- **Scan Scope**: Filesystem scan covering Bash scripts, dependencies, + secrets, and misconfigurations +- **Severity Levels**: CRITICAL, HIGH, MEDIUM, LOW +- **Scan Types**: + - Vulnerability detection + - Secret scanning + - Misconfiguration detection +- **Schedule**: Runs on every push to main, pull requests, and weekly on + Mondays +- **Reports**: + - `trivy-report.json` — Machine-readable JSON format + - `trivy-report.txt` — Human-readable table format + - SARIF results uploaded to GitHub Security tab + +To run Trivy scan locally: + +```bash +# Install Trivy (if not already installed) +# See https://aquasecurity.github.io/trivy/latest/getting-started/installation/ + +# Run scan +trivy fs --severity CRITICAL,HIGH,MEDIUM,LOW --scanners vuln,secret,misconfig . + +# Generate JSON report +trivy fs --severity CRITICAL,HIGH,MEDIUM,LOW --scanners vuln,secret,misconfig \ + --format json --output .audit/trivy-report.json . + +# Generate text report +trivy fs --severity CRITICAL,HIGH,MEDIUM,LOW --scanners vuln,secret,misconfig \ + --format table --output .audit/trivy-report.txt . +``` ## Security Controls - Security contacts and disclosure process live in `SECURITY.md`. -- Enable GitHub secret scanning, vulnerability alerts, and push protection in repository settings to complete the baseline. +- Enable GitHub secret scanning, vulnerability alerts, and push protection in + repository settings to complete the baseline. diff --git a/.github/workflows/trivy-scan.yml b/.github/workflows/trivy-scan.yml new file mode 100644 index 0000000..a427e02 --- /dev/null +++ b/.github/workflows/trivy-scan.yml @@ -0,0 +1,76 @@ +name: Trivy Vulnerability Scan + +on: + push: + branches: [main] + pull_request: + schedule: + # Run weekly on Mondays at 00:00 UTC + - cron: '0 0 * * 1' + workflow_dispatch: + +permissions: + contents: read + security-events: write + +jobs: + trivy-scan: + name: Trivy Security Scan + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Run Trivy vulnerability scanner in fs mode + uses: aquasecurity/trivy-action@master + with: + scan-type: 'fs' + scan-ref: '.' + format: 'sarif' + output: 'trivy-results.sarif' + severity: 'CRITICAL,HIGH,MEDIUM,LOW' + scanners: 'vuln,secret,misconfig' + + - name: Upload Trivy results to GitHub Security tab + uses: github/codeql-action/upload-sarif@v3 + with: + sarif_file: 'trivy-results.sarif' + + - name: Run Trivy vulnerability scanner for JSON report + uses: aquasecurity/trivy-action@master + with: + scan-type: 'fs' + scan-ref: '.' + format: 'json' + output: '.audit/trivy-report.json' + severity: 'CRITICAL,HIGH,MEDIUM,LOW' + scanners: 'vuln,secret,misconfig' + + - name: Run Trivy vulnerability scanner for human-readable report + uses: aquasecurity/trivy-action@master + with: + scan-type: 'fs' + scan-ref: '.' + format: 'table' + output: '.audit/trivy-report.txt' + severity: 'CRITICAL,HIGH,MEDIUM,LOW' + scanners: 'vuln,secret,misconfig' + + - name: Upload Trivy reports as artifacts + uses: actions/upload-artifact@v4 + if: always() + with: + name: trivy-reports + path: | + .audit/trivy-report.json + .audit/trivy-report.txt + trivy-results.sarif + + - name: Commit Trivy reports to repository + if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' || github.ref == 'refs/heads/main' + run: | + git config --local user.email "github-actions[bot]@users.noreply.github.com" + git config --local user.name "github-actions[bot]" + git add .audit/trivy-report.json .audit/trivy-report.txt || true + git diff --staged --quiet || git commit -m "chore: Update Trivy vulnerability scan reports" + git push || echo "No changes to push" diff --git a/.gitignore b/.gitignore index 5f95269..460a5a6 100644 --- a/.gitignore +++ b/.gitignore @@ -14,6 +14,11 @@ __pycache__/ .DS_Store Thumbs.db +# Trivy scan reports (committed via workflow) +.audit/trivy-report.json +.audit/trivy-report.txt +trivy-results.sarif + # Local test artifacts .bin/ out.json From b55eca8ff91edbc57fae3c1a16d66ccc826f09f9 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 23 Nov 2025 11:54:22 +0000 Subject: [PATCH 3/4] Simplify Trivy workflow to use artifacts only, update documentation Co-authored-by: TimInTech <129355283+TimInTech@users.noreply.github.com> --- .audit/README.md | 8 ++++---- .github/workflows/trivy-scan.yml | 9 --------- 2 files changed, 4 insertions(+), 13 deletions(-) diff --git a/.audit/README.md b/.audit/README.md index 2595b0b..edb5304 100644 --- a/.audit/README.md +++ b/.audit/README.md @@ -29,11 +29,11 @@ The repository uses Trivy for automated vulnerability scanning: - Vulnerability detection - Secret scanning - Misconfiguration detection -- **Schedule**: Runs on every push to main, pull requests, and weekly on - Mondays +- **Schedule**: Runs on every push to main, pull requests, weekly on Mondays, + and manual workflow dispatch - **Reports**: - - `trivy-report.json` — Machine-readable JSON format - - `trivy-report.txt` — Human-readable table format + - `trivy-report.json` — Machine-readable JSON format (workflow artifact) + - `trivy-report.txt` — Human-readable table format (workflow artifact) - SARIF results uploaded to GitHub Security tab To run Trivy scan locally: diff --git a/.github/workflows/trivy-scan.yml b/.github/workflows/trivy-scan.yml index a427e02..ce63f4b 100644 --- a/.github/workflows/trivy-scan.yml +++ b/.github/workflows/trivy-scan.yml @@ -65,12 +65,3 @@ jobs: .audit/trivy-report.json .audit/trivy-report.txt trivy-results.sarif - - - name: Commit Trivy reports to repository - if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' || github.ref == 'refs/heads/main' - run: | - git config --local user.email "github-actions[bot]@users.noreply.github.com" - git config --local user.name "github-actions[bot]" - git add .audit/trivy-report.json .audit/trivy-report.txt || true - git diff --staged --quiet || git commit -m "chore: Update Trivy vulnerability scan reports" - git push || echo "No changes to push" From b352a9f63a699af70e13c1751bf88a073968e451 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 23 Nov 2025 11:56:43 +0000 Subject: [PATCH 4/4] Pin Trivy action to specific version (0.28.0) for stability Co-authored-by: TimInTech <129355283+TimInTech@users.noreply.github.com> --- .github/workflows/trivy-scan.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/trivy-scan.yml b/.github/workflows/trivy-scan.yml index ce63f4b..93f946f 100644 --- a/.github/workflows/trivy-scan.yml +++ b/.github/workflows/trivy-scan.yml @@ -22,7 +22,7 @@ jobs: uses: actions/checkout@v4 - name: Run Trivy vulnerability scanner in fs mode - uses: aquasecurity/trivy-action@master + uses: aquasecurity/trivy-action@0.28.0 with: scan-type: 'fs' scan-ref: '.' @@ -37,7 +37,7 @@ jobs: sarif_file: 'trivy-results.sarif' - name: Run Trivy vulnerability scanner for JSON report - uses: aquasecurity/trivy-action@master + uses: aquasecurity/trivy-action@0.28.0 with: scan-type: 'fs' scan-ref: '.' @@ -47,7 +47,7 @@ jobs: scanners: 'vuln,secret,misconfig' - name: Run Trivy vulnerability scanner for human-readable report - uses: aquasecurity/trivy-action@master + uses: aquasecurity/trivy-action@0.28.0 with: scan-type: 'fs' scan-ref: '.'