CAST — DevSecOps governance toolkit for GitHub Actions and GitLab CI
Project description
CAST — CI/CD Automation & Security Toolkit
One engineer's standards. Every team's pipeline.
English | 中文
CAST is a DevSecOps governance toolkit for GitHub Actions and GitLab CI — so a single DevOps engineer can enforce pipeline standards across every team, without personally reviewing every repository.
Table of Contents
- Why CAST
- What You Get
- Quick Start
- CLI Reference
- Templates
- Pipeline Architecture
- Contributing
- License
Why CAST
The problem isn't that teams lack security tools. It's that one DevOps engineer's standards can't reach every team's pipeline.
The typical situation: a DevOps engineer defines a secure, policy-compliant pipeline for one project. Other teams write their own — often AI-generated, often untested against security standards, always "good enough to push." The DevOps engineer can't review every PR across every repository. Pipeline quality varies. Security gaps accumulate silently.
CAST is the governance layer that changes this. It's not "DevSecOps for teams with no DevOps expertise." It's "DevSecOps standards that enforce themselves — without your personal attention on every repository."
- Zero configuration — auto-detects your stack and CI platform, writes the workflow file
- Security-first — secrets scanning, SAST, SCA, and container scanning out of the box
- Policy as Code — OPA/conftest gate replaces fragile shell logic; policies are versioned
- Compliance dashboard — static HTML red/green board deployable to GitHub Pages
- Multi-platform — GitHub Actions and GitLab CI supported with identical security coverage
What You Get
Each CAST template configures your repository with a full security stack:
| Layer | Tool | What It Does |
|---|---|---|
| Secrets Detection | Gitleaks | Scans entire git history for leaked credentials |
| SAST | Semgrep | Finds security bugs and anti-patterns in source code |
| SCA | pip-audit | Detects known vulnerabilities in dependencies |
| Container Security | Trivy | Scans Docker images for CVEs (skipped if no Dockerfile) |
| Code Quality | Ruff | Enforces code style and quality standards |
| Security Gate | conftest + OPA Rego | Policy-as-code gate; blocks merges on critical findings |
All findings surface in GitHub's Security tab or GitLab's Security dashboard. No external accounts, no SaaS dependencies.
Quick Start
Option A — CLI (Recommended)
pip install castops
cast init
CAST auto-detects your project type and CI platform. One command. Done.
For GitLab CI:
cast init --platform gitlab
Option B — Manual
- Copy the template for your stack:
curl -O https://raw.githubusercontent.com/castops/cast/main/src/cast_cli/templates/python/devsecops.yml
- Move it to your repository:
mkdir -p .github/workflows
mv devsecops.yml .github/workflows/
- Commit and push:
git add .github/workflows/devsecops.yml
git commit -m "ci: add CAST DevSecOps pipeline"
git push
Your pipeline is live. GitHub Actions will run all security checks on every push and pull request.
CLI Reference
The cast CLI is the fastest way to add a DevSecOps pipeline to any project.
Installation
pip install castops
Commands
cast init
Initialize a DevSecOps pipeline in the current directory.
Usage: cast init [OPTIONS]
Initialize a DevSecOps pipeline for your project.
Options:
-f, --force Overwrite existing workflow file.
-t, --type TEXT Project type (python/nodejs/go). Auto-detected if omitted.
-p, --platform TEXT CI platform (github/gitlab). Auto-detected if omitted.
--help Show this message and exit.
Examples:
# Auto-detect project type and platform
cast init
# Specify project type explicitly
cast init --type nodejs
# Generate a GitLab CI pipeline
cast init --platform gitlab
# Go project on GitLab
cast init --type go --platform gitlab
# Overwrite an existing workflow
cast init --force
Auto-detection logic:
CAST detects your project type and CI platform by looking for marker files:
| Project Type | Marker Files |
|---|---|
| Python | pyproject.toml, requirements.txt, setup.py, setup.cfg |
| Node.js | package.json |
| Go | go.mod |
| CI Platform | Detected by |
|---|---|
| GitLab | .gitlab-ci.yml exists |
| GitHub | .github/ directory exists (default) |
cast version
Display the installed version of castops.
cast version
# cast 0.1.0
Templates
CAST ships with production-tested workflow templates for multiple stacks.
GitHub Actions
| Stack | Security Tools | Status |
|---|---|---|
| Python | Gitleaks + Semgrep + pip-audit + Trivy + Ruff | ✅ Available |
| Node.js | Gitleaks + Semgrep + npm audit + Trivy + ESLint | ✅ Available |
| Go | Gitleaks + Semgrep + govulncheck + Trivy + staticcheck | ✅ Available |
GitLab CI
| Stack | Security Tools | Status |
|---|---|---|
| Python | Gitleaks + Semgrep + pip-audit + Trivy + Ruff | ✅ Available |
| Node.js | Gitleaks + Semgrep + npm audit + Trivy + ESLint | ✅ Available |
| Go | Gitleaks + Semgrep + govulncheck + Trivy + staticcheck | ✅ Available |
Security Gate Policies
| Policy | Blocks on | Activate via |
|---|---|---|
default |
CRITICAL findings | (default) |
strict |
HIGH + CRITICAL | CAST_POLICY=strict |
permissive |
Never (audit only) | CAST_POLICY=permissive |
See docs/policy-reference.md for custom policy authoring.
Pipeline Architecture
Each CAST pipeline runs 5 parallel security jobs followed by 1 gate job that controls whether a pull request can be merged. The example below shows the Python pipeline; Node.js and Go pipelines follow the same structure with stack-appropriate tools.
┌─────────────────────────────────────────────────────────────┐
│ CAST DevSecOps Pipeline │
│ │
│ ┌──────────────┐ ┌──────┐ ┌─────┐ ┌───────────┐ │
│ │ Secrets │ │ SAST │ │ SCA │ │ Container │ │
│ │ (Gitleaks) │ │(Semgrep)│ │(pip-│ │ (Trivy) │ │
│ │ │ │ │ │audit│ │ │ │
│ └──────┬───────┘ └──┬───┘ └──┬──┘ └─────┬─────┘ │
│ │ │ │ │ │
│ └─────────────┴────┬────┴────────────┘ │
│ │ │
│ ┌───────▼────────┐ │
│ │ Security Gate │ │
│ │ (blocks merge) │ │
│ └───────────────┘ │
│ │
│ ┌─────────────┐ │
│ │ Ruff │ (runs independently, informational) │
│ │ (Quality) │ │
│ └─────────────┘ │
└─────────────────────────────────────────────────────────────┘
Trigger Conditions
The pipeline runs on:
| Event | Branches |
|---|---|
push |
main, master |
pull_request |
main, master |
workflow_dispatch |
Any (manual trigger) |
Security Gate Logic
The gate job runs after all security checks complete, regardless of individual job results:
IF secrets == "failure" OR sast == "failure" OR sca == "failure"
→ Block merge (exit 1)
ELSE
→ Allow merge (exit 0)
Code quality failures (Ruff) do not block merges by default. Adjust the gate job's
needsarray in the workflow to change this behavior.
SARIF Integration
All security findings (Semgrep, Trivy) are uploaded to GitHub's Security tab via SARIF. This means:
- All vulnerabilities are tracked as GitHub Security alerts
- Developers see findings inline on pull request diffs
- Security history is retained without any external tools
Requirements
- GitHub or GitLab repository with CI/CD enabled
- Python 3.9+ (for CLI usage)
- No additional accounts, tokens, or external services required
Optional: Set
SEMGREP_APP_TOKENas a secret to enable Semgrep's cloud dashboard and additional rulesets.
Security Dashboard
CAST can generate a static HTML compliance dashboard — red/green status per project, collapsible finding details, zero JavaScript dependencies.
python dashboard/generate.py --sarif-dir sarif-results --output index.html
Deploy to GitHub Pages with the included workflow:
templates/github/publish-dashboard.yml → .github/workflows/publish-dashboard.yml
See docs/dashboard-guide.md for setup instructions.
Documentation
| Guide | Description |
|---|---|
| Getting Started | Step-by-step setup for your first pipeline |
| CLI Reference | Full cast command reference |
| Pipeline Reference | How each pipeline job works |
| GitLab Guide | GitLab CI setup and configuration |
| Policy Reference | Writing custom OPA/conftest policies |
| Plugin Guide | Extending CAST with custom security tools |
| Dashboard Guide | Security dashboard setup and GitHub Pages deployment |
Chinese documentation: docs/zh/
Contributing
We welcome contributions. See CONTRIBUTING.md for details on:
- Development setup
- Adding new language templates
- Running tests
- Submitting pull requests
Security
To report a security vulnerability in CAST itself, see SECURITY.md.
Philosophy
One engineer's standards. Every team's pipeline.
CAST is the answer to a scaling problem: a single DevOps engineer cannot personally review every CI/CD pipeline across every team. CAST packages expert-validated standards as executable templates and policy gates — so the standard is enforced by the pipeline itself, not by PR review.
AI can generate a pipeline that runs. CAST enforces a pipeline that complies.
License
Apache 2.0 — see LICENSE for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file castops-0.3.0.tar.gz.
File metadata
- Download URL: castops-0.3.0.tar.gz
- Upload date:
- Size: 114.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
80481fa9606c15b518bf94c1d4b0017e5bee25111b7aeccc997db0db13e24ad5
|
|
| MD5 |
4c5cca0e59ef9fcddebb83c87c3e03f4
|
|
| BLAKE2b-256 |
8033031cd93fc724e2ba440b427e9411854d2d0b57269322602b471c30acfc5d
|
Provenance
The following attestation bundles were made for castops-0.3.0.tar.gz:
Publisher:
publish.yml on castops/cast-cli
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
castops-0.3.0.tar.gz -
Subject digest:
80481fa9606c15b518bf94c1d4b0017e5bee25111b7aeccc997db0db13e24ad5 - Sigstore transparency entry: 1191412075
- Sigstore integration time:
-
Permalink:
castops/cast-cli@a58f2b275e9d498fa48bcf894ad9aa2c2d42cd1e -
Branch / Tag:
refs/tags/v0.3.0 - Owner: https://github.com/castops
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@a58f2b275e9d498fa48bcf894ad9aa2c2d42cd1e -
Trigger Event:
push
-
Statement type:
File details
Details for the file castops-0.3.0-py3-none-any.whl.
File metadata
- Download URL: castops-0.3.0-py3-none-any.whl
- Upload date:
- Size: 26.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
87a3444ce4755be5d5afb0c0787495f89f5401373efd3b9537d800b25ad5e2e5
|
|
| MD5 |
8403fbcd42569153fa8b6f29b3491d1b
|
|
| BLAKE2b-256 |
e1550185656c5e17a2f0ec02d88a474384f58b0785227d610395ba5560bd1174
|
Provenance
The following attestation bundles were made for castops-0.3.0-py3-none-any.whl:
Publisher:
publish.yml on castops/cast-cli
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
castops-0.3.0-py3-none-any.whl -
Subject digest:
87a3444ce4755be5d5afb0c0787495f89f5401373efd3b9537d800b25ad5e2e5 - Sigstore transparency entry: 1191412078
- Sigstore integration time:
-
Permalink:
castops/cast-cli@a58f2b275e9d498fa48bcf894ad9aa2c2d42cd1e -
Branch / Tag:
refs/tags/v0.3.0 - Owner: https://github.com/castops
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@a58f2b275e9d498fa48bcf894ad9aa2c2d42cd1e -
Trigger Event:
push
-
Statement type: