/devsecops-skills:sast-integrationfrom devsecops-skills
Guides adding, tuning, and triaging SAST in a codebase or CI/CD pipeline using Semgrep, CodeQL, SonarQube, Bandit, gosec, or ESLint-security-plugin per language.
Ships in devsecops-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Static Application Security Testing (SAST) analyzes source code, bytecode, or binaries without executing them, looking for insecure coding patterns (SQL injection, command injection, hardcoded secrets, unsafe deserialization, path traversal, weak crypto, missing input validation, etc.). Integrating SAST into CI/CD shifts security feedback left — a developer sees a finding in a pull request diff within minutes instead of a pentester or auditor finding it months later in production. Done well, SAST becomes a fast, automated first-pass filter; done badly (noisy rules, no triage workflow, scanning the whole repo on every commit) it becomes an ignored gate that teams route around. This skill covers choosing a SAST tool, wiring it into CI/CD with sane defaults, tuning rules to keep signal-to-noise usable, and building a triage/suppression workflow that survives contact with a real codebase.
semgrep --config auto or pinned rulesets. Version
semgrep >= 1.45 for stable --baseline-commit diff-aware scanning..NET plugin.eslint-plugin-security/eslint-plugin-no-unsanitized for
JS/TS, brakeman for Rails) are lighter-weight and worth running in
addition to a general-purpose tool for language-specific idioms.Pick the tool(s) based on language mix and license constraints. For a typical polyglot service, a good default is Semgrep (fast, cheap, easy custom rules) plus one language-native linter for the primary language. Add CodeQL if the org already has GitHub Advanced Security or needs deep taint-tracking for compiled languages.
Run locally first to see real signal before wiring into CI:
# Semgrep, using the community "auto" ruleset plus OWASP Top 10 pack
semgrep --config auto --config p/owasp-top-ten --error --json -o semgrep-results.json .
Add a CI step scoped to the pull request diff, not the whole repo, for day-to-day gating (full-repo baseline scans run separately, e.g. nightly). Example, GitHub Actions:
name: sast
on:
pull_request:
jobs:
semgrep:
runs-on: ubuntu-latest
container:
image: semgrep/semgrep:1.78.0
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Run Semgrep (diff-aware)
run: |
semgrep ci \
--config p/owasp-top-ten \
--config p/secrets \
--baseline-commit "${{ github.event.pull_request.base.sha }}"
env:
SEMGREP_APP_TOKEN: ${{ secrets.SEMGREP_APP_TOKEN }}
Equivalent GitLab CI (SAST is built in as a template):
include:
- template: Security/SAST.gitlab-ci.yml
variables:
SAST_EXCLUDED_PATHS: "vendor, node_modules, test/fixtures"
Set severity thresholds for the merge gate, not "zero findings."
Start by failing the build only on ERROR/critical/high severity
findings in new code; route WARNING/medium and below to a
dashboard or PR comment (informational, non-blocking) until the team
has bandwidth to raise the bar.
Add an inline suppression mechanism with mandatory justification, not silent ignores. Semgrep example:
# nosemgrep: python.lang.security.audit.subprocess-shell-true
# Justification: `cmd` is built from a fixed allowlist, see ALLOWED_CMDS above.
subprocess.run(cmd, shell=True)
Require a linked ticket or comment for every suppression, and review suppressions periodically (e.g. quarterly) rather than letting them accumulate silently.
Wire results into the PR as inline review comments (most tools support SARIF upload to GitHub code scanning, or native PR comments) so developers see findings where they're already looking, not in a separate dashboard they have to remember to check.
Track a baseline and trend, not just pass/fail. Export SARIF or JSON to a central store (or the GitHub Security tab / SonarQube dashboard) so the team can see whether the finding count is trending down over time, and periodically schedule a full-repo scan to catch drift.
semgrep/semgrep:1.78.0, not
:latest) so rule updates don't silently change what fails a build
overnight.Symptom: The SAST gate is enabled, but every PR has 40+ findings and developers click "merge anyway" or disable the check. Fix: Switch to diff/baseline scanning so only new findings block, triage the existing backlog separately with its own remediation SLA, and cut the ruleset down to a curated, high-confidence set.
Symptom: CodeQL job fails with "no source code was seen during the
build" for a compiled language (Java, Go, C++).
Fix: CodeQL needs to observe an actual compilation to build its
database for compiled languages — replace autobuild with an explicit
build step (mvn compile, go build ./...) matching your real build,
and make sure the CodeQL init step's languages: list matches what you
actually build.
Symptom: A hardcoded-secret rule keeps firing on test fixtures and
example config files, and developers start blanket-suppressing the
whole rule.
Fix: Exclude fixture/test-data paths explicitly in tool config
(SAST_EXCLUDED_PATHS, .semgrepignore, paths.exclude in Sonar)
rather than suppressing the rule everywhere — fixtures are exactly
where accidentally-real secrets tend to leak.
Symptom: The pipeline takes 25 minutes longer after adding SAST, and teams complain about CI latency. Fix: Scope the scan to changed files/diff instead of full-repo, cache tool dependencies/rule bundles between runs, and move the full-repo deep scan to a nightly/weekly schedule instead of every PR.
Symptom: A finding is suppressed with // nosemgrep and no comment;
six months later nobody remembers why, and a real vulnerability with
the same pattern ships unnoticed.
Fix: Require a justification comment and a linked ticket for every
suppression as a matter of code review policy, and schedule periodic
suppression audits.
A Python/Flask service adds Semgrep as a blocking PR gate, with a one-time full-repo baseline scan run separately.
.github/workflows/sast.yml:
name: sast
on:
pull_request:
branches: [main]
jobs:
semgrep:
runs-on: ubuntu-latest
container:
image: semgrep/semgrep:1.78.0
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Semgrep diff-aware scan
run: |
semgrep ci \
--config p/owasp-top-ten \
--config p/python \
--config p/secrets \
--baseline-commit "${{ github.event.pull_request.base.sha }}" \
--sarif --output semgrep.sarif
continue-on-error: true
- name: Upload SARIF to code scanning
uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: semgrep.sarif
- name: Fail on new high/critical findings
run: |
python3 - <<'EOF'
import json, sys
with open("semgrep.sarif") as f:
sarif = json.load(f)
blocking = [
r for run in sarif["runs"] for r in run["results"]
if r.get("level") == "error"
]
if blocking:
print(f"{len(blocking)} blocking finding(s) in new code")
sys.exit(1)
EOF
Sample finding surfaced on a PR (SARIF excerpt, trimmed):
{
"ruleId": "python.flask.security.injection.sql-injection.flask-sqli",
"level": "error",
"message": { "text": "User-controlled data flows into a raw SQL query." },
"locations": [{ "physicalLocation": { "artifactLocation": { "uri": "app/views/search.py" }, "region": { "startLine": 42 } } }]
}
Remediation: parameterize the query (cursor.execute("... WHERE id = %s", (user_id,)))
instead of string-formatting user input into SQL, then re-run
semgrep ci --baseline-commit <base-sha> locally to confirm the finding
clears before pushing.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
sast, static-analysis, security-scanning, ci-cd-security, devsecops
npx claudepluginhub selvarajmurugesan90/ops-engineering-skills --plugin devsecops-skills17 skills in this plugin
/checkov-and-tfsec-iac-security-scanningConfigures Checkov and tfsec to scan Terraform/CloudFormation/Kubernetes IaC source for misconfigurations — hardcoded secrets, overly permissive IAM policies, unencrypted storage, open security groups — before `terraform apply` or `aws cloudformation deploy` ever runs. Use when a user asks to "scan my Terraform for security issues," "add Checkov/tfsec to CI," "find overly permissive IAM in my IaC," "write a Checkov suppression," "compare Checkov and tfsec," or "catch misconfigured cloud resources before they're provisioned."
/complete-devsecops-pipeline-for-kubernetes-from-scratchBuilds the complete security-gate sequence for a Kubernetes-targeted DevSecOps pipeline from scratch — SAST, SCA, container image scanning, a policy-as-code (OPA/Kyverno) admission gate placed before the GitOps handoff, and a secrets model where plaintext credentials never touch the pipeline because an External Secrets Operator pulls them cluster-side instead. Use when the user asks to "build a DevSecOps pipeline for Kubernetes from scratch," "add a policy gate before our GitOps commit," "make sure secrets never touch CI for our K8s deploys," or "sequence SAST/SCA/image-scan/policy gates for a container pipeline end-to-end."
Other plugins' skills for the same job