DevSecOps: Shift-Left Security, SAST, DAST, Secrets, Dependencies and Pipeline Gates

DevOps Certification 24 min min read Updated: Nov 17, 2026 Intermediate
DevSecOps: Shift-Left Security, SAST, DAST, Secrets, Dependencies and Pipeline Gates
Intermediate Topic 1 of 2

What Is DevSecOps?

In the old model, security teams reviewed software at the end, found problems late and slowed releases. DevSecOps adds security to every step of the pipeline and makes it everyone's job. Problems found early are cheaper to fix. This is called shifting left.

text Plan -> Code -> Build -> Test -> Release -> Deploy -> Operate | | | | | | | Threat IDE + SAST + DAST + Sign + IaC and Runtime model secrets SCA + API SBOM policy security, scan image tests checks monitoring

Types of Security Testing

TypeWhat it checksWhenTools
SAST (static analysis)Your source code for vulnerabilities (injection, weak crypto)Every commit and pull requestSemgrep, CodeQL, SonarQube, Bandit
SCA (software composition analysis)Known vulnerabilities and licenses in dependenciesEvery buildDependabot, Renovate, Trivy, Snyk, OWASP Dependency-Check
Secret scanningPasswords, tokens and keys in code and historyPre-commit and CIGitleaks, TruffleHog, GitHub secret scanning
Container scanningOS packages and libraries in imagesAfter image build, and on registryTrivy, Grype, Docker Scout
IaC scanningMisconfigurations in Terraform, Kubernetes YAML, DockerfilesPull requestCheckov, Trivy config, KICS, tfsec
DAST (dynamic)The running application from the outsideAgainst stagingOWASP ZAP, Nuclei
Runtime securitySuspicious behavior in productionAlwaysFalco, cloud threat detection, EDR

The OWASP Top 10 (Know the Themes)

  • Broken access control: users can reach data or actions they should not
  • Cryptographic failures: sensitive data not encrypted, weak algorithms
  • Injection: SQL, command, template injection from untrusted input
  • Insecure design, security misconfiguration: missing controls, default passwords, open buckets
  • Vulnerable and outdated components: old libraries
  • Authentication failures, integrity failures, logging and monitoring failures, SSRF

Check the OWASP website for the current edition of the list. The themes stay similar from version to version.

Secret Scanning

bash # Scan the working tree and full Git history gitleaks detect --source . --verbose # In CI, fail on any finding gitleaks detect --source . --redact --exit-code 1 trufflehog git file://. --only-verified
If a secret leaked: Revoke and rotate it immediately. Removing it from Git is not enough, because copies exist in clones, forks and caches. Then find out whether it was used.

SAST with Semgrep

bash pip install semgrep semgrep scan --config auto --error . # community rules, non-zero exit on findings semgrep scan --config p/owasp-top-ten --sarif -o semgrep.sarif .
yaml # A custom rule: ban eval() rules: - id: no-eval languages: [python] message: "Avoid eval(); it can execute attacker-controlled code" severity: ERROR pattern: eval(...)

CodeQL and Dependabot on GitHub

yaml # .github/workflows/codeql.yml name: CodeQL on: push: { branches: [main] } pull_request: { branches: [main] } schedule: [{ cron: "0 3 * * 1" }] permissions: security-events: write contents: read jobs: analyze: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: github/codeql-action/init@v3 with: { languages: python, javascript } - uses: github/codeql-action/analyze@v3
yaml # .github/dependabot.yml version: 2 updates: - package-ecosystem: pip directory: "/" schedule: { interval: weekly } - package-ecosystem: github-actions directory: "/" schedule: { interval: weekly } - package-ecosystem: docker directory: "/" schedule: { interval: weekly }

Dependency and Image Scanning

bash trivy fs --scanners vuln,secret,misconfig --severity HIGH,CRITICAL --exit-code 1 . trivy image --severity HIGH,CRITICAL --ignore-unfixed --exit-code 1 shop-api:1.0 npm audit --audit-level=high pip-audit
Make scanners practical: Fail the build only on HIGH and CRITICAL issues that have a fix (--ignore-unfixed), keep an ignore file with reasons and expiry dates, and report everything else as tickets.

IaC and Kubernetes Policy Scanning

bash checkov -d infra/ --framework terraform,kubernetes,dockerfile trivy config . kubesec scan deployment.yaml kube-linter lint k8s/

DAST with OWASP ZAP

bash # Baseline scan of a running staging site (passive checks, safe) docker run --rm -t -v $(pwd):/zap/wrk ghcr.io/zaproxy/zaproxy:stable \ zap-baseline.py -t https://staging.example.com -r zap-report.html # Active full scan only on test systems you own docker run --rm -t ghcr.io/zaproxy/zaproxy:stable zap-full-scan.py -t https://staging.example.com
Permission: Only scan systems you own or have written permission to test. Active scans can change data and trigger alarms.

A Secure Pipeline Example

yaml ame: secure-ci on: [pull_request] permissions: { contents: read } jobs: security: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 with: { fetch-depth: 0 } - name: Secret scan uses: gitleaks/gitleaks-action@v2 - name: SAST run: pipx run semgrep scan --config auto --error . - name: Filesystem + IaC scan uses: aquasecurity/trivy-action@master with: scan-type: fs scanners: vuln,secret,misconfig severity: HIGH,CRITICAL ignore-unfixed: true exit-code: "1" image: needs: security runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - run: docker build -t app:${{ github.sha }} . - uses: aquasecurity/trivy-action@master with: image-ref: app:${{ github.sha }} severity: HIGH,CRITICAL exit-code: "1"

Secrets Management

ApproachNotes
Environment variables from CI secret storeSimple, but static and broadly visible to jobs
Cloud secret managers (AWS Secrets Manager, Azure Key Vault, Google Secret Manager)Central, audited, rotation support
HashiCorp VaultDynamic short-lived database and cloud credentials, PKI, encryption as a service
Workload identity / OIDCNo stored secrets at all for cloud access
SOPS / Sealed SecretsEncrypted secrets in Git for GitOps
bash # Vault quick lab (dev mode: not for production) docker run -d --name vault -p 8200:8200 -e VAULT_DEV_ROOT_TOKEN_ID=root hashicorp/vault export VAULT_ADDR=http://127.0.0.1:8200 VAULT_TOKEN=root vault kv put secret/shop/db username=shop password=S3cr3t vault kv get -field=password secret/shop/db

Vulnerability Management Process

  1. Inventory: know what you run (SBOMs)
  2. Detect: continuous scanning in CI and on running images
  3. Prioritize: by severity, exploitability (is it reachable? is there a known exploit?), exposure and business impact
  4. Fix: upgrade, patch or mitigate within agreed deadlines (SLA by severity)
  5. Verify and report: track time to fix as a metric

Culture

  • Security champions inside development teams
  • Threat modeling for new features: STRIDE (spoofing, tampering, repudiation, information disclosure, denial of service, elevation of privilege)
  • Make the secure path the easy path: templates, base images and libraries that are already hardened
  • Teach by showing real findings, not by blocking without explanation

Practice Tasks

  1. Run Gitleaks against one of your repositories, including history
  2. Add Semgrep and Trivy to a pull request workflow and fix one finding
  3. Scan a Terraform folder with Checkov and fix an open security group
  4. Run ZAP baseline against a local test app you created
  5. Store a secret in Vault dev mode and read it from a script

Conclusion

DevSecOps puts automated security checks (secrets, SAST, dependency, image, IaC and DAST) into the pipeline, uses short-lived credentials and manages vulnerabilities by risk. Start small and make findings actionable.

Quick Summary: shift left; secrets scan; SAST/SCA; Trivy image; Checkov IaC; ZAP on staging; OIDC + Vault; fix by risk.

Get Newsletter

Subscibe to our newsletter and we will notify you about the newest updates on Edugators