This project runs dependency and secret scans on every PR to protect the supply chain from vulnerabilities and committed secrets.
- Runs: On every PR in
dependency-scanjob - Configuration:
.cargo/audit.toml - Threshold: High/Critical advisories fail the build
- Command:
cargo audit --deny warnings
Triaging a Cargo Audit Finding:
- Run locally:
cargo auditto view advisories - If false-positive or acceptable risk:
- Edit
.cargo/audit.toml - Add to
[advisories] ignore = ["RUSTSEC-XXXX-XXXX"]with ticket reference - Document justification in commit message
- Edit
- If dependency update available:
- Update
Cargo.tomlto a patched version - Run
cargo updateand test thoroughly - Commit with reference to advisory number
- Update
- Runs: On every PR for both frontend and indexer
- Threshold: High/Critical npm advisories fail the build
- Commands:
- Frontend:
npm audit --audit-level=highinfrontend/elcarehub-app/ - Indexer:
npm audit --audit-level=highinindexer/
- Frontend:
Triaging an npm Audit Finding:
- Run locally:
npm audit --audit-level=highin the affected directory - Check if
npm audit fixresolves it (test thoroughly):npm audit fix- Run full test suite:
npm run test - Commit with advisory reference
- If
npm audit fixdoesn't work or breaks something:- Document the issue in the PR with ticket reference
- Work with the maintainer of the dependency
- Request exception with security justification
- Runs: On every PR
- Configuration:
.gitleaks.toml(if custom config needed) - Action:
gitleaks/gitleaks-action@v2
Triaging a Gitleaks Finding:
- If accidental secret commit:
- DO NOT commit a fix to the branch
- IMMEDIATELY rotate the secret in production
- Contact repository administrators
- If false positive (e.g., test credentials):
- Add to
.gitleaks.tomlignore list with reason:
[[rules]] id = "gitleaks-rule-id" description = "False positive: test fixture in docs" path = "path/to/file"
- Document in commit message
- Add to
When a scan fails on a PR:
- Identify the failure: Check the CI logs in the PR checks section
- Assess the finding: Determine if it's a real vulnerability or false positive
- Choose remediation:
- Real vulnerability: Update dependency or remove secret
- False positive: Add to ignore list with documentation
- Test locally before pushing:
- Cargo:
cargo audit --deny warnings - npm:
npm audit --audit-level=high - Secrets:
gitleaks detect --verbose
- Cargo:
- Document the decision in commit message for audit trail
- High-severity vulnerabilities without fixes: Escalate to @admin
- Repeated violations from same dependency: File upstream issue
- Compromised external token: Security incident response protocol