Verified by Garnet Grid

Application Security Testing: SAST, DAST & SCA

Build application security testing into development. Covers static analysis (SAST), dynamic testing (DAST), software composition analysis (SCA), security testing in CI/CD, and triage workflows.

Application security testing catches vulnerabilities before attackers find them. SAST scans source code without running it. DAST probes running applications like an attacker would. SCA identifies known vulnerabilities in your dependencies. Together, they form a defense-in-depth testing strategy that catches different classes of vulnerabilities at different stages.


Testing Types Compared

TypeWhat It TestsWhen It RunsFindsMisses
SASTSource code (static)At commit/PRCode-level flaws (SQLi, XSS patterns)Runtime issues, config problems
DASTRunning applicationPost-deploy (staging)Runtime vulnerabilities, misconfigsCode-level root cause
SCADependenciesAt buildKnown CVEs in librariesZero-days, custom code flaws
IASTInstrumented runtimeDuring testingBoth code and runtime issuesPerformance overhead
Secrets ScanningSource + historyAt commit/PRLeaked credentials, API keysEncrypted secrets

CI/CD Integration

security-pipeline:
  stages:
    - name: Pre-Commit
      tools:
        - gitleaks     # Secrets in code
        - pre-commit   # Formatting, basic checks
    
    - name: PR / Build (SAST + SCA)
      tools:
        - semgrep      # SAST - pattern-based code scanning
        - snyk-code    # SAST - AI-powered
        - npm-audit    # SCA - dependency vulnerabilities
        - trivy-fs     # SCA - filesystem scanning
      gate: "Block PR on HIGH/CRITICAL findings"
    
    - name: Build (Container)
      tools:
        - trivy-image  # Container image scanning
        - syft         # SBOM generation
      gate: "Block build on CRITICAL CVEs"
    
    - name: Staging (DAST)
      tools:
        - zap          # OWASP ZAP dynamic scanning
        - nuclei       # Template-based vulnerability scanning
      gate: "Alert on findings, manual review"
    
    - name: Production
      tools:
        - waf-rules    # Runtime protection
        - runtime-monitoring  # Anomaly detection

Semgrep SAST Rules

rules:
  - id: sql-injection
    patterns:
      - pattern: |
          cursor.execute(f"... {$USER_INPUT} ...")
      - pattern: |
          cursor.execute("... " + $USER_INPUT + " ...")
    message: "Possible SQL injection. Use parameterized queries."
    severity: ERROR
    languages: [python]
  
  - id: hardcoded-secret
    pattern: |
      $KEY = "sk_live_..."
    message: "Hardcoded API key detected. Use environment variables."
    severity: ERROR
    languages: [python, javascript, typescript]

Triage Workflow

SeverityResponse TimeAction
Critical< 24 hoursBlock deploy, immediate fix, incident process
High< 1 weekFix in current sprint, track in backlog
Medium< 1 monthSchedule in upcoming sprint
LowBest effortAdd to tech debt backlog
False PositiveImmediateSuppress with documented justification

Anti-Patterns

Anti-PatternProblemFix
Scan but never fixThousands of findings accumulateEnforce gates (block on CRITICAL/HIGH)
SAST onlyMisses runtime issues and dependency CVEsSAST + DAST + SCA together
Scan in production onlyVulnerabilities already deployedShift left: scan in CI/CD
No false positive managementAlert fatigue, teams ignore findingsTuned rules, suppression with justification
Security team owns all findingsBottleneck, no developer ownershipDevelopers own findings in their code

Checklist

  • SAST tool configured (Semgrep, SonarQube, CodeQL)
  • SCA tool configured (Snyk, Dependabot, Trivy)
  • DAST tool configured (OWASP ZAP, Nuclei)
  • Secrets scanning in pre-commit (Gitleaks, TruffleHog)
  • CI/CD gates: block on CRITICAL/HIGH findings
  • Triage process: defined SLAs per severity
  • False positive management: suppress with documentation
  • Developer training: secure coding practices
  • Regular review: rule tuning, new vulnerability patterns

:::note[Source] This guide is derived from operational intelligence at Garnet Grid Consulting. For application security consulting, visit garnetgrid.com. :::

Jakub Dimitri Rezayev
Jakub Dimitri Rezayev
Founder & Chief Architect • Garnet Grid Consulting

Jakub holds an M.S. in Customer Intelligence & Analytics and a B.S. in Finance & Computer Science from Pace University. With deep expertise spanning D365 F&O, Azure, Power BI, and AI/ML systems, he architects enterprise solutions that bridge legacy systems and modern technology — and has led multi-million dollar ERP implementations for Fortune 500 supply chains.

View Full Profile →