ci(security): security-gates workflow (split 2/4 of #1317)#1463
ci(security): security-gates workflow (split 2/4 of #1317)#1463SharedQA wants to merge 4 commits into
Conversation
…#1317) Split out of constructorfabric#1317 per review. The security slice: - .github/workflows/security-gates.yml — blocking gates: TruffleHog (verified secrets), Semgrep SAST (report-only ratchet), cargo-audit + pip-audit (RUSTSEC/CVE), Trivy IaC+fs. Actions/images pinned to SHAs. - .trivyignore. Self-standing: runs the scanners directly (no Makefile), no docs/helm/release files. The unfixable airbyte-cdk transitive CVE waivers (nltk/cryptography) are included with their tracking references. Signed-off-by: Kenan Salim <ks@constructor.tech>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
✅ Files skipped from review due to trivial changes (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughAdds a new GitHub Actions security-gates workflow with blocking scans for secrets, SAST, dependency audits, and Trivy, plus documented Trivy waivers. ChangesSecurity Gates Workflow
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
… (split 4/4) Per review, constructorfabric#1317 was too big (docs/security/helm/release). The other three concerns moved to dedicated PRs: - docs-gates -> constructorfabric#1462 - security-gates -> constructorfabric#1463 - helm-validate -> constructorfabric#1464 constructorfabric#1317 now carries only the release/quality slice: - .github/workflows/release-train.yml (version/publish train) - .github/workflows/backend-checks.yml (coverage ratchet folded in) - .github/workflows/e2e-bronze-to-api.yml (coverage note) - scripts/ci/enforce-quality-gates.sh (required-checks bootstrap) - Makefile (the local dev-loop aggregator) Merge order: this slice lands LAST. The Makefile's aggregate targets (check/ci-pr) and the enforce script reference the gates that now live in Signed-off-by: Kenan Salim <ks@constructor.tech> constructorfabric#1462/constructorfabric#1463/constructorfabric#1464, so they resolve once those merge to main and this rebases.
There was a problem hiding this comment.
Actionable comments posted: 4
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In @.github/workflows/security-gates.yml:
- Around line 113-122: The manifest audit step in the security-gates workflow
can exit successfully without auditing anything when the find/filter pipeline
produces no files. Update the shell logic around the while/read loop and the rc
handling so it tracks whether at least one Python manifest was scanned, and
force a failure if none were found or audited; keep the existing pip-audit
execution paths for requirements files and pyproject.toml entries, but gate the
final exit on that new “found any manifest” state.
- Around line 42-44: The fetch-depth logic in the security-gates workflow is too
shallow for pull_request runs and can miss the full base.sha..head.sha range
used by TruffleHog. Update the fetch-depth expression so that schedule runs
still use full history and pull_request runs also fetch full history instead of
50, keeping the existing workflow job and the fetch-depth setting in sync with
the secrets scan requirements.
- Around line 4-7: The Semgrep gate is not currently enforcing the blocking
contract because the security-gates workflow runs the semgrep scan without a
failing exit on findings. Update the job in security-gates.yml around the
semgrep scan step to use the failing behavior (for example, the scan’s
error-on-findings mode) so the job exits nonzero when issues are found, or if
this is intentional temporary ratcheting, add a clearly documented exception
with owner and exit condition in the top-level contract.
- Line 139: The Trivy ignore entries are including inline rationale text, which
prevents the ignore IDs from matching correctly. Update the handling around the
`.trivyignore` entries so only the ignore IDs remain on each entry, and move any
explanatory text to a separate comment line before the entry. Use the existing
`trivyignores` configuration and the `.trivyignore` file format as the reference
points when making the change.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 6fd729dc-24fd-4f59-9294-0fb94a83a52c
📒 Files selected for processing (2)
.github/workflows/security-gates.yml.trivyignore
…ract honesty All four CodeRabbit findings verified against the code and applied: - deps-audit: count scanned manifests and FAIL if zero found. A gate that audits nothing (find/glob breaks, tree moves) was a silent bypass — exactly what this workflow's header forbids. - secrets-scan: fetch-depth 0 (was 50 on PRs). TruffleHog diffs base..head; a shallow clone drops the base commit on any PR longer than the depth, so the scan errors or scans incompletely. Correctness of a secrets gate > CI minutes. - header: document the Semgrep report-only ratchet as the ONE sanctioned non-blocking gate (owner + exit condition), so the 'no silent bypass' contract is honest rather than contradicted. (semgrep scan w/o --error exits 0 by design — intentional, now documented at the top, not just inline.) - .trivyignore: move rationale to its own comment line above each ID, so the IDs match regardless of Trivy's inline-comment handling (version-safe waivers). Verified: yaml parses; no-silent-pass logic exits 1 on zero manifests, 0 normally. Signed-off-by: Kenan Salim <ks@constructor.tech>
|
Closing without merging. The single bundled Follow-ups:
TruffleHog (secrets-scan) and cargo-audit/pip-audit (deps-audit) remain tracked under #1478 and will be split out as needed. The workflow YAML here stays available on branch |
Standalone semgrep.yml running p/default (secrets excluded — TruffleHog owns those) in report-only mode: findings upload to Code Scanning (SARIF) and a job-summary count, but no --error so the check never blocks. PR + nightly + dispatch triggers, digest-pinned image, SHA-pinned actions. Adds .semgrepignore for build/dep artifacts and waives the known JWT ValidateLifetime finding inline (#346). Split from #1463; part of #1478. Signed-off-by: Konstantin Tursunov <Konstantin.Tursunov@constructor.tech>
Split out of #1317 (too large to review as one). This is the security slice.
What
.github/workflows/security-gates.yml— mandatory gates, none usingcontinue-on-error:p/default(report-only during ratchet-in).cargo audit(RUSTSEC) +pip-audit(CVEs). Unfixable transitive CVEs are waived with tracking (nltk==3.9.1 / cryptography<47 pinned by airbyte-cdk)..trivyignore.Notes
Summary by CodeRabbit