DevSecOps Security Pipeline (SAST, SCA, Secrets)
DevSecOps means building security checks into the same pipeline that builds and deploys software: SAST on your code, SCA on dependencies, secret scanning, image/IaC checks where relevant, and controlled deploys with audit trails — so “we will harden later” stops being the default.
Friends! Friday-night prod hotfix without scans = classic regret. DevSecOps = security gates in CI/CD — SAST, SCA, secrets, image scan, then audited deploy. Defence pipeline; no attack PoC. Only repos and clusters you own / are authorised for.
मित्रांनो! Friday night prod hotfix without scans = classic regret. DevSecOps = security gates CI/CD मध्ये — SAST, SCA, secrets, image scan, then audited deploy. Defence pipeline; attack PoC नाही. Repos आणि clusters तुम्ही own / authorised करता तेचच.
मित्रों! Friday night prod hotfix without scans = classic regret. DevSecOps = security gates CI/CD में — SAST, SCA, secrets, image scan, then audited deploy. Defence pipeline; attack PoC नहीं. Repos और clusters जो आप own / authorised हैं वही.
Quick answer
DevSecOps security pipeline — vertical gates:
- Protect the repo: MFA, branch protection, signed commits if policy says so.
- On every PR: SAST + dependency SCA + secret scan (fail high-confidence secrets).
- Build artefacts once; promote the same artefact (no “rebuild differently in prod”).
- Scan container images / IaC templates before promote.
- Deploy with least-privilege CI identities (OIDC to cloud roles beats static keys).
- Keep pipeline logs and who approved prod.
- Fix findings with owners and SLAs — tools without tickets are wallpaper.
Tiny mental model:
Commit → SAST → SCA → Secrets → Image/IaC → Deploy (audited)
Broken pipe = “ship hope”
Keys in CI variables = incident queue
What do I need before this guide?
- Supply chain companion: SBOM, dependency risk and secret leaks.
- Vuln prioritisation: Vulnerability management CVE/KEV.
- Optional API tests in CI mindset: Secure REST APIs / OWASP API.
What belongs in a beginner-safe pipeline?
Commits flow through SAST, SCA, secret and image scan gates before an audited deploy with least-privilege CI identities.
Commits SAST, SCA, secret आणि image scan gates मधून जातात, मग least-privilege CI identities सह audited deploy.
Commits SAST, SCA, secret और image scan gates से गुज़रते हैं, फिर least-privilege CI identities के साथ audited deploy.
Practical gates (tool names vary; concepts transfer):
- Secret scanning — stop AKIA… / tokens at push or PR time.
- SCA — known CVEs in libraries; pin lockfiles.
- SAST — risky code patterns (injection sinks, unsafe deserialization themes) without turning CI into a red-team course.
- Unit/integration security tests — authz cases for APIs you own.
- Image scan — OS and library CVEs in containers you build.
- IaC scan — open security groups, public buckets (high-level misconfig).
- Deploy controls — environment protection rules, dual approval for prod.
Educational warning: run scanners against your repos and images. Pointing aggressive scanners or exploit frameworks at third-party sites is out of scope and often illegal.
Real incident: Codecov (2021) — pipeline trust themes
Public reporting on the Codecov 2021 bash uploader compromise described attackers altering a widely used CI helper so that CI secrets could be exfiltrated from customer pipelines. Blue-team lesson: the pipeline is part of your production attack surface. Third-party build steps need pinning, verification, least privilege, and monitoring for odd egress.
Takeaways (vertical):
- What happened — trusted CI component abuse with secret-exposure themes in public analyses.
- What went wrong (theme) — over-trust in mutable third-party scripts plus powerful CI credentials.
- Care-take — pin actions/orb/versions; verify checksums when vendors publish them.
- Care-take — CI roles get minimum cloud permissions; prefer OIDC federation.
- Care-take — alert on unexpected outbound traffic from build agents.
- Bonus parallel — SolarWinds 2020 reminds us build systems are crown jewels for nation-state and commodity actors alike.
Red Team vs Blue Team (awareness only)
Red Team — what attackers try
- Steal CI tokens from logs, pull requests, or compromised developer laptops.
- Modify build scripts to ship trojans (supply-chain theme).
- Abuse over-broad deploy keys to production.
- Tamper with mutable tags like
latestor floating action versions.
Blue Team — defend, detect, respond
- Branch protection + required reviews + status checks that actually block merge.
- Pin tools; generate SBOMs; sign artefacts when your org is ready.
- Rotate credentials on a schedule and on every suspected leak — revoke first.
- Separate build and deploy roles; prod deploy needs human approval.
- Monitor for unexpected workflow file changes.
How do I build the pipeline step by step?
Step 1 — Harden the source
- MFA on GitHub/GitLab/Bitbucket org owners.
- Protect
main: no direct push; require PR + green checks. - Restrict who can edit workflow files if your platform supports it.
Step 2 — Add secret and dependency gates
- Enable platform secret scanning + a local pre-commit hook for developers.
- Commit lockfiles; run SCA on PRs; fail fixable criticals on release branches.
- Generate an SBOM artefact per release and store it beside the build.
Step 3 — Add SAST and authz tests
- Start with a maintained SAST engine in CI; triage suppressions with expiry dates.
- Add automated tests that user A cannot read user B’s objects (API apps).
- Keep false-positive debt visible — ignored findings rot culture.
Step 4 — Secure the build agents
- Ephemeral runners when possible; patch persistent ones.
- No long-lived cloud access keys in variables if OIDC works.
- Egress allow-lists for package registries you actually need.
Step 5 — Image / IaC before prod
- Scan images you build; block known criticals with available fixes.
- Scan Terraform/CloudFormation/Kubernetes YAML for obvious public exposure.
- Promote by digest, not by mutable tag alone.
Step 6 — Deploy with audit and practice
- Environment protection: required reviewers for prod.
- Ticket link in the release notes.
- Tabletop: “CI secret leaked — revoke cloud keys, rotate registry creds, review deploys in the last 24h (IST labelled).”
- Only experiment on pipelines that deploy to accounts you own.
Minimal PR checklist (copy into your team wiki)
- Secrets scan clean?
- SCA criticals addressed or risk-accepted with expiry?
- SAST new highs triaged?
- Image/IaC scan attached?
- Prod approval named human?
Ravindra Bagale's Tip
💡 Students make a "DevSecOps" slide but leave main unprotected. In interviews be concrete: secret scan fails the merge, OIDC role, SBOM per release. Ticket SLA impresses more than tool logos. Got it?
Ravindra Bagale's Tip – मराठी
💡 Students "DevSecOps" slide बनवतात पण main unprotected ठेवतात. Interview मध्ये concrete बोला: secret scan fail merge, OIDC role, SBOM per release. Tool logo पेक्षा ticket SLA जास्त impressive. समजलं का?
Ravindra Bagale's Tip – हिंदी
💡 Students "DevSecOps" slide बनाते हैं लेकिन main unprotected रखते हैं. Interview में concrete बोलो: secret scan fail merge, OIDC role, SBOM per release. Tool logo से ticket SLA ज्यादा impressive. समझ में आया?
What “shift left” actually means here
- Catch secret leaks and dependency CVEs before merge — cheaper than prod IR.
- It does not mean dumping every scanner on day one until developers mute Slack.
- Start with secret scan + lockfile SCA + branch protection; add SAST once triage owners exist.
- Security partners write suppressions with expiry dates, not eternal
# nosecfolklore. - Prod still needs runtime controls (WAF-ish edge, EDR, IAM) — pipeline is necessary, not sufficient.
Care-take — culture that keeps gates honest
- Security findings get owners in the same sprint board as features.
- Break-glass deploy still logs who/when/why.
- Third-party GitHub Actions: prefer verified creators; pin full commit SHAs when risk is high.
- Never embed production secrets in fork PRs from outsiders.
- Measure mean time to remediate pipeline-blocker vulns.
- After Codecov-style news: inventory every CI secret your org stores.
How do I fix common DevSecOps mistakes?
Ghabru naka 😅 — these are the usual ones:
| Symptom | Likely cause | Fix |
|---|---|---|
| Scanners ignored | No owner / too noisy | Severity SLAs; tune; expire exceptions |
| Keys in Actions logs | echo / debug left on | Revoke; redact; ban printing secrets |
latest tag in prod |
Convenience | Pin digest; immutable promote |
| Fork PR steals secrets | Permissive workflows | Restrict secrets on forks |
| Green CI, breached box | Scans not covering authz | Add object-authz tests |
| Pipeline admin = god mode | Standing cluster-admin | Split roles; approve prod |
Try it at home
On a private repo you own:
- Turn on branch protection for
mainwith one required check. - Add a secret-scanning workflow or platform setting; commit a fake
AKIAEXAMPLEstring in a branch and prove the gate catches it, then remove it. - Run an SCA tool on a small Python/Node app; open one ticket-style note for a finding.
- Write three Codecov-2021 lesson bullets in your own words.
- Do not attack other organisations’ CI — practise on yours.
Learn it properly
Course lessons:
- What OWASP and the Top 10 are
- The rest — design, components, integrity, logging
- IAM done right
- Protecting data — S3, encryption and secrets
- CVE, CWE and CVSS
Related guides: SBOM / secrets · Vuln management · Secure REST APIs · Cloud IAM · K8s security basics
Got it? DevSecOps = secret/SAST/SCA/image gates + least-privilege deploy + owners. Codecov-era lesson: take the CI trust model seriously. Next: learn Python for SOC analysts.
समजलं का? DevSecOps = secret/SAST/SCA/image gates + least-privilege deploy + owners. Codecov-era lesson: CI trust model serious घ्या. आता Python for SOC analysts शिका.
समझ में आया? DevSecOps = secret/SAST/SCA/image gates + least-privilege deploy + owners. Codecov-era lesson: CI trust model serious लो. आगे Python for SOC analysts सीखो.
Frequently asked questions
What is DevSecOps in this guide?
Putting security gates in the same CI/CD path that builds and deploys — with owners for findings.
What is the difference between SAST and SCA?
SAST reviews your code patterns; SCA checks third-party dependencies for known CVEs.
Why pin CI actions and tools?
Floating tags and mutable helpers were abused in incidents such as Codecov 2021 themes.
Are static cloud keys in CI OK?
Prefer short-lived OIDC federation to cloud roles; rotate and minimise any remaining secrets.
Is scanning other companies’ sites allowed?
No. Run tools only on repositories, images and environments you own or may test in writing.
Where are deeper lessons?
SBOM/supply-chain guide, vuln management, OWASP integrity themes and IAM lessons.