Skip to content

feat: cast audit, upgrade, org audit, and baseline profiles#10

Merged
shenxianpeng merged 4 commits into
mainfrom
feature/cast-audit-and-profiles
May 25, 2026
Merged

feat: cast audit, upgrade, org audit, and baseline profiles#10
shenxianpeng merged 4 commits into
mainfrom
feature/cast-audit-and-profiles

Conversation

@shenxianpeng

Copy link
Copy Markdown
Member

Summary

This PR implements the key governance features recommended in the cast-cli strategic review, moving CAST from a template generator to a serious governance toolkit.

What's new

cast audit — Pipeline compliance checker

Checks the current repo against the CAST baseline:

cast audit

Output:

✓ Secrets scanning enabled
✓ SAST enabled  
✓ Dependency scanning (SCA) enabled
✓ Container scanning enabled
✓ Code quality enabled
✓ SARIF upload enabled
✓ Security gate enabled
⚠ Action pinning (SHA) — not pinned by commit SHA
⚠ OpenSSF Scorecard — not found
ℹ Branch protection — requires GitHub API

13 checks covering: secrets, SAST, SCA, container, quality, SARIF, gate, action pinning, permissions, Scorecard, and branch protection.

cast upgrade — Drift detection

Detects when a workflow has diverged from the latest CAST baseline:

cast upgrade
cast upgrade --diff  # show unified diff

cast org audit — Organization-level governance

Audit multiple repos at once:

cast org audit ~/my-repos/
cast org audit --json ~/my-repos/  # machine-readable

Output table: repo name | CAST installed | security gate | score

cast init --profile — Baseline profiles

Four pre-configured profiles:

Profile Policy Scorecard SLSA Use case
opensource permissive Public open-source
enterprise strict Enterprise compliance
strict strict Maximum security
ai-generated-code strict AI-generated codebases

cast profiles — List available profiles

Security fix

  • Pin trivy-action@master@0.29.0 in all 3 GitHub Actions templates (supply-chain security)

Positioning

  • README: documents CAST + OpenSSF Scorecard relationship
    "OpenSSF Scorecard tells you what is wrong. CAST helps you install and enforce the fix across CI/CD."

Files changed

  • src/cast_cli/audit.py — new: audit engine with 13 compliance checks
  • src/cast_cli/upgrade.py — new: drift detection via unified diff
  • src/cast_cli/profiles.py — new: 4 baseline profiles
  • src/cast_cli/main.py — add audit, upgrade, org, profiles commands + --profile flag
  • src/cast_cli/templates/{python,go,nodejs}/devsecops.yml — pin trivy-action
  • .github/workflows/devsecops.yml — regenerate with pinned trivy-action
  • tests/test_audit.py — 42 new tests
  • tests/test_upgrade.py — 9 new tests
  • README.md — document all new commands + Scorecard philosophy

Tests: 143 total (up from 65), all passing.

Add governance features that move CAST from template generator to
governance toolkit:

- cast audit: check repo pipeline compliance against CAST baseline
  (secrets, SAST, SCA, container, quality, SARIF, gate, pinning,
   permissions, Scorecard, branch protection)
- cast upgrade: detect drift between current workflow and latest
  CAST template, show unified diff
- cast org audit: audit multiple repos at once with score table
- cast init --profile: baseline profiles (opensource, enterprise,
  strict, ai-generated-code)
- cast profiles: list available profiles

Security fix:
- Pin trivy-action from @master to @0.29.0 in all templates

Positioning:
- README: document CAST + OpenSSF Scorecard relationship
- Philosophy: 'Scorecard tells you what is wrong. CAST helps you
  install and enforce the fix across CI/CD.'
- Remove unused typing.Optional from audit.py
- Remove unused dataclasses.field from profiles.py
- Remove unused pathlib.Path from test files
- Fix f-strings with no placeholders in main.py (use plain strings)
aquasecurity/trivy-action git tags use a 'v' prefix (v0.29.0),
but @0.29.0 (without the prefix) does not resolve as a valid
GitHub Actions version reference.
v0.29.0 references aquasecurity/setup-trivy@v0.2.2 which does not
exist on the registry. v0.36.0 is the latest stable release.
@shenxianpeng shenxianpeng merged commit 4b0e23e into main May 25, 2026
7 checks passed
@shenxianpeng shenxianpeng deleted the feature/cast-audit-and-profiles branch May 25, 2026 20:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant