Skip to content

security: add CI security scanning and purge compromised trivy-action#123

Merged
fas89 merged 2 commits into
mainfrom
feat/security-scanning-hardening
May 16, 2026
Merged

security: add CI security scanning and purge compromised trivy-action#123
fas89 merged 2 commits into
mainfrom
feat/security-scanning-hardening

Conversation

@fas89

@fas89 fas89 commented May 16, 2026

Copy link
Copy Markdown
Collaborator

Summary

Hardens forge-cli's security posture and purges a supply-chain-compromised GitHub Action the CLI was shipping to its own users.

fluid generate ci emitted aquasecurity/trivy-action — compromised in March 2026 (CVE-2026-33634 / GHSA-69fq-xp46-6x23) — into every generated downstream pipeline. It is replaced with OSV-Scanner across all five CI-system generators. forge-cli's own CI/CD then gains layered, pinned scanning.

What's added

SAST

  • .semgrep/fluid-rules.yml — 3 custom rules encoding CLAUDE.md invariants (deleted-module imports, SQL-safety helper bypass, copilot workspace_root confinement), gated in the existing security job. CodeQL is already provided by the repo's default setup — no workflow added here.

Supply chain

  • dependency-review job — blocks PRs adding vulnerable / disallowed-licence deps.
  • release.yml — Grype container scan (--fail-on high --only-fixed) before the GHCR push, plus a CycloneDX SBOM attached to every release.
  • scorecard.yml — weekly OpenSSF Scorecard.

Agentic layer

  • tests/cli/test_agentic_redteam.py — 35 deterministic, zero-token adversarial tests pinning the copilot's injection-redaction / workspace-confinement / typed-error defenses; new redteam pytest marker.

Docker

  • Upgrade pip/setuptools/wheel in the base image — clears 3 fixable HIGH CVEs the new Grype gate flagged.

Every scanner is pinned by commit SHA or version+checksum. No third-party scanner Actions run in forge-cli's own CI.

Test plan

Verified locally before opening:

  • actionlint clean on all workflows
  • Semgrep — rules validate; gate scan 0 findings on the repo; all 3 rules confirmed firing on synthetic violations
  • bandit security scan passes
  • 1583 tests pass (tests/forge/, tests/cli/, generators, test_security.py); full suite (12,231) collects clean
  • release.yml Grype gate — built the prod image; grype --fail-on high --only-fixed exits 0 (3 fixable CVEs patched, 37 unfixable base-OS CVEs correctly excluded)
  • CycloneDX SBOM generation — valid CycloneDX 1.6
  • check_pinned_actions.py exit 0 — every action SHA-pinned
  • Security review of the diff — no HIGH/MEDIUM findings

Follow-ups (settings — for a maintainer, not code)

  • Settings -> Code security: enable secret scanning + push protection, and private vulnerability reporting.
  • After merge: add a main ruleset requiring Security Scan and Dependency Review as status checks.

Replace the supply-chain-compromised aquasecurity/trivy-action
(CVE-2026-33634) with OSV-Scanner across the `fluid generate ci`
generators — forge-cli was emitting the compromised action into
every downstream user's generated pipeline.

forge-cli's own CI/CD gains:
- CodeQL advanced setup (codeql.yml, security-extended query suite)
- Semgrep custom rules (.semgrep/fluid-rules.yml) for three CLAUDE.md
  structural invariants, wired into the existing security job
- a dependency-review job (blocks PRs adding vulnerable/bad-licence deps)
- a Grype container scan + CycloneDX SBOM in the release pipeline
- an OpenSSF Scorecard workflow
- deterministic agentic-layer adversarial tests
  (tests/cli/test_agentic_redteam.py) + a `redteam` pytest marker

Upgrade pip/setuptools/wheel in the Docker base so the Grype gate
(--fail-on high --only-fixed) passes clean. Every scanner is pinned by
commit SHA or version+checksum; no third-party scanner Actions run in
forge-cli's own CI.
@github-actions

Copy link
Copy Markdown

Welcome to FLUID Forge! Thanks for opening your first pull request.

Before we review, please make sure:

  • You've read the Contributing Guide
  • Tests pass locally (pytest)
  • Code is formatted (ruff check and black)
  • Documentation: If your change affects user-facing behaviour, please open a companion PR in the docs repo and link it in your PR description

A maintainer will review your PR soon. Thanks for contributing!

@github-actions github-actions Bot added the needs-docs Pull request needs a linked docs update or justification label May 16, 2026
@github-actions

Copy link
Copy Markdown

📄 Documentation Reminder

This PR appears to be missing a documentation reference. Our docs live in a separate repo.

Please update the PR description with one of:

  • Link a docs PR — check the "Docs PR linked" box and paste the URL
  • Mark as no docs needed — check "No docs needed" with a justification
  • Acknowledge docs TODO — check "Docs TODO" and create the docs PR before merge

See the Contributing Guide for details.

@github-actions github-actions Bot added ci Continuous integration and automation changes tests Test coverage or test infrastructure changes and removed needs-docs Pull request needs a linked docs update or justification labels May 16, 2026
@github-advanced-security

Copy link
Copy Markdown

You are seeing this message because GitHub Code Scanning has recently been set up for this repository, or this pull request contains the workflow file for the Code Scanning tool.

What Enabling Code Scanning Means:

  • The 'Security' tab will display more code scanning analysis results (e.g., for the default branch).
  • Depending on your configuration and choice of analysis tool, future pull requests will be annotated with code scanning analysis results.
  • You will be able to see the analysis results for the pull request's branch on this overview once the scans have completed and the checks have passed.

For more information about GitHub Code Scanning, check out the documentation.

The repo's CodeQL default setup is already configured (actions,
javascript, python, typescript). A committed advanced-setup workflow
duplicated the python analysis and produced a conflicting second
`Analyze (python)` check. Default setup covers more languages than the
python-only workflow did, so the workflow is removed in favour of it.

Semgrep custom rules, Grype, dependency-review, the SBOM and Scorecard
are unaffected — only the redundant CodeQL workflow is dropped.
@github-actions github-actions Bot added the needs-docs Pull request needs a linked docs update or justification label May 16, 2026
@fas89
fas89 merged commit efca06d into main May 16, 2026
26 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci Continuous integration and automation changes needs-docs Pull request needs a linked docs update or justification tests Test coverage or test infrastructure changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants