Files
Charon/docs/plans/archive/codeql-local-hygiene.md
akanealw eec8c28fb3
Some checks are pending
Go Benchmark / Performance Regression Check (push) Waiting to run
Cerberus Integration / Cerberus Security Stack Integration (push) Waiting to run
Upload Coverage to Codecov / Backend Codecov Upload (push) Waiting to run
Upload Coverage to Codecov / Frontend Codecov Upload (push) Waiting to run
CodeQL - Analyze / CodeQL analysis (go) (push) Waiting to run
CodeQL - Analyze / CodeQL analysis (javascript-typescript) (push) Waiting to run
CrowdSec Integration / CrowdSec Bouncer Integration (push) Waiting to run
Docker Build, Publish & Test / build-and-push (push) Waiting to run
Docker Build, Publish & Test / Security Scan PR Image (push) Blocked by required conditions
Quality Checks / Auth Route Protection Contract (push) Waiting to run
Quality Checks / Codecov Trigger/Comment Parity Guard (push) Waiting to run
Quality Checks / Backend (Go) (push) Waiting to run
Quality Checks / Frontend (React) (push) Waiting to run
Rate Limit integration / Rate Limiting Integration (push) Waiting to run
Security Scan (PR) / Trivy Binary Scan (push) Waiting to run
Supply Chain Verification (PR) / Verify Supply Chain (push) Waiting to run
WAF integration / Coraza WAF Integration (push) Waiting to run
changed perms
2026-04-22 18:19:14 +00:00

2.9 KiB
Executable File

Local Scan Hygiene (CodeQL + Trivy)

This plan captures local scan-hygiene items that are not the SSRF remediation itself, but commonly cause CI-aligned local security tasks to fail due to generated artifacts or scanning scope.

Goal

  • Keep local CI-aligned tasks deterministic and aligned with CI behavior.
  • Prevent generated artifacts (coverage, dist outputs, tool DBs) from being treated as source code during scans.

CodeQL JS: prevent scanning generated artifacts

Problem

Local CodeQL JS scans can fail if coverage/build artifacts exist on disk under frontend/ (example: a finding under frontend/coverage/lcov-report/...).

Plan

  • Ensure generated artifacts are not treated as source:
    • Confirm .gitignore excludes frontend/coverage/** and other build outputs.
  • Add a deterministic cleanup step in local CodeQL JS entrypoints:
    • Remove if present:
      • frontend/coverage/
      • frontend/dist/
      • playwright-report/
      • test-results/
      • coverage/ (root-level, if present)

Likely scripts involved (verify current wiring before editing):

Notes

  • .github/codeql/codeql-config.yml already has paths-ignore entries for several generated paths (e.g., frontend/coverage/**, frontend/dist/**, test-results/**). Cleanup is still recommended because it protects local runs even if a given invocation does not consistently apply a config file.

Trivy FS: exclude tool/cache databases from scan scope

Problem

Trivy can scan non-project directories and produce noise or scanner errors when it traverses:

  • local caches (.cache/, including Go module caches)
  • CodeQL databases (codeql-db-*)
  • agent outputs (codeql-agent-results/)

Plan

  • Update the local Trivy entrypoint to skip non-project directories using explicit --skip-dirs options.

Primary script:

Suggested skip set (keep explicit; no globs):

  • .cache/
  • codeql-db-go/
  • codeql-db-js/
  • my-codeql-db/
  • codeql-agent-results/
  • codeql-custom-queries-go/ (optional for noise/speed)
  • test-results/ (optional; only if it creates findings)

Keep local behavior CI-aligned

  • Ensure findings fail the scan without unnecessary noise:
    • Set --exit-code 1
    • Default severity threshold: CRITICAL,HIGH (allow override via TRIVY_SEVERITY)
  • Prefer skip-dirs for non-project content; use ignorefiles only for true false positives.

Repo hygiene follow-up (separate PR)

The repo root currently contains scan artifacts such as codeql-results-*.sarif and trivy-*.txt. Follow the repo structure guidance by moving these under test-results/ and/or adding appropriate .gitignore entries.