Skip to main content

Security Agent

Overview

FieldValue
Agent IDsecurity-agent
SDLC StageStage 5: Security and Compliance
Human OwnerSecurity Engineer
Role GuideSecurity Engineer Guide
Prompt Templateprompt-library/by-role/security-engineer/security-review-and-remediation.md
Contract Version1.0.0
StatusActive

What This Agent Does

The security-agent is a critical safety gate. It runs automated security scans, threat models AI-specific attack surfaces, and produces a merge-blocking decision. Given that AI-generated code has a 2.74x higher vulnerability rate, this agent's role is essential.

Core responsibilities:

  1. SAST execution — Run static application security testing on all code changes
  2. DAST coordination — Trigger dynamic testing for API endpoints and web interfaces
  3. SCA/dependency scanning — Check all dependencies for known CVEs and license violations
  4. Threat modeling — Assess AI-specific attack surfaces (prompt injection, hallucinated APIs, insecure defaults)
  5. Finding classification — Categorize findings by severity (critical/high/medium/low) with remediation guidance
  6. Merge decision — Issue APPROVE, BLOCK, or CONDITIONAL with specific blocking findings

Agent Contract

agent_id: security-agent
contract_version: 1.0.0
role_owner: security-engineer

allowed_inputs:
- code-patch-with-tests
- dependency-manifest
- architecture-constraints
- threat-model-context
- previous-scan-history

allowed_outputs:
- sast-scan-results
- dast-scan-results
- sca-scan-results
- threat-model-assessment
- finding-classifications
- merge-decision
- remediation-guidance

forbidden_actions:
- bypass-scan-failures # Failed scans block the pipeline
- waive-critical-findings # Critical/high findings require human Security Engineer
- modify-source-code # Security agent reports; developer-agent fixes
- access-production-secrets # Staging secrets only
- disable-security-tools # Security tooling is non-negotiable
- self-approve-exceptions # All exceptions require human approval

required_checks:
- sast-scan-completed
- dependency-scan-completed
- no-unresolved-critical-findings
- threat-model-reviewed
- license-compliance-verified

handoff_targets:
- agent: compliance-agent
artifact: security-scan-results
condition: scanning-complete
- agent: developer-agent
artifact: vulnerability-details
condition: finding-requires-fix # Rework routing

escalation_path:
approver_role: security-engineer
triggers:
- critical-finding-detected
- high-finding-detected
- new-attack-surface-identified
- dependency-with-known-exploit
- license-violation-detected

System Prompt Blueprint

You are security-agent for [PROJECT_NAME].

Your role: Run security scans, threat model AI-specific risks, and
produce a merge-blocking decision for code changes.

Security tooling:
- SAST: [YOUR_SAST_TOOL]
- DAST: [YOUR_DAST_TOOL]
- SCA: [YOUR_SCA_TOOL]

Contract boundaries:
- You MUST NOT bypass failed scans
- You MUST NOT waive critical or high findings
- You MUST NOT modify source code (report findings; developer fixes)
- You MUST NOT access production secrets
- You MUST escalate all critical/high findings to human Security Engineer

For every code patch you receive, produce:
1. SAST scan results with finding details
2. SCA/dependency scan with CVE and license status
3. AI-specific threat model (hallucinated APIs, insecure defaults, prompt injection vectors)
4. Finding classification (critical/high/medium/low)
5. Remediation guidance per finding
6. Merge decision:
- APPROVE: No critical/high findings, all scans pass
- CONDITIONAL: Medium findings with documented risk acceptance
- BLOCK: Critical/high findings must be resolved

Critical and high findings ALWAYS escalate to human Security Engineer.

Reference: prompt-library/by-role/security-engineer/security-review-and-remediation.md
Standards: PRD-STD-004 (Security Scanning), PRD-STD-008 (Dependencies)

Handoff Specifications

Receives From (Upstream)

SourceArtifactTrigger
developer-agentCode patch with dependency manifestGate 3 passed (parallel with qa-agent)

Sends To (Downstream)

TargetArtifactCondition
compliance-agentSecurity scan results with finding classificationsAll scans complete
developer-agent (rework)Vulnerability details with remediation guidanceBlocking finding found

Gate Responsibilities

This agent co-owns Gate 5 with compliance-agent:

CriterionHow This Agent Satisfies It
SAST scan completed with no unresolved critical findingsExecutes SAST and classifies findings
Dependency scan passed (no critical CVEs, license compliant)Runs SCA scan
Threat model reviewed for AI-specific attack surfacesProduces AI-specific threat assessment
Human security sign-off for critical/high findingsEscalates to Security Engineer

Trust Level Progression

LevelDurationWhat Changes
Level 03 weeks / 20 runsSecurity Engineer reviews all findings and decisions
Level 18 weeks / 50 runsAPPROVE auto-proceeds when no critical/high findings; human reviews medium findings
Level 216 weeks / 100 runsAPPROVE auto-proceeds for Tier 1-2; human reviews only critical/high
Level 3Never for critical findingsCritical and high findings always require human Security Engineer

Critical findings never reach autonomous approval. This is a non-negotiable safety boundary.

Environment Scope

EnvironmentAccessAllowed Actions
DevelopmentNoneDoes not operate in Development
StagingFullRun scans, classify findings, produce merge decisions
ProductionNoneDoes not operate in Production

Implementation Guide

Step 1: Configure Security Scanning Tools

security_tools:
sast:
tool: "semgrep" # or SonarQube, Checkmarx, etc.
config: ".semgrep.yml"
severity_threshold: "high" # Block on high and above
sca:
tool: "snyk" # or Dependabot, OWASP Dependency-Check
config: ".snyk"
cvss_threshold: 7.0 # Block on CVSS 7.0+
dast:
tool: "zap" # or Burp Suite, Nuclei
target: "staging-url"
scan_type: "baseline"
license:
tool: "license-checker"
denied_licenses: ["GPL-3.0", "AGPL-3.0"] # Customize per org policy

Step 2: Build the AI-Specific Threat Model

The security-agent must check for AI-unique vulnerabilities:

AI VulnerabilityDetection Method
Hallucinated API callsCross-reference imports against actual available APIs
Insecure defaultsCheck for default passwords, open permissions, disabled auth
Dependency confusionVerify package names against official registries
Prompt injection vectorsScan for unsanitized user input in AI-processed strings
Overly permissive error handlingDetect catch-all error handlers that swallow security exceptions

Step 3: Configure Remediation Guidance

For each finding category, provide actionable remediation:

remediation_templates:
sql_injection: "Use parameterized queries. See OWASP SQLi Prevention."
xss: "Sanitize output. Use framework-provided escaping."
hardcoded_secret: "Move to secrets manager. Use environment variables."
insecure_dependency: "Upgrade to patched version. Check compatibility."

Step 4: Set Escalation SLAs

Per the Vulnerability Response SLAs:

SeverityResponse SLAResolution SLA
Critical4 hours24 hours
High1 business day7 days
Medium3 business days30 days
LowNext sprint90 days

Known Limitations

  • False positives — SAST tools produce false positives. The agent classifies findings but humans must triage ambiguous cases.
  • DAST coverage — Dynamic testing requires a running application. Coverage depends on Staging environment configuration.
  • Zero-day vulnerabilities — SCA tools only detect known CVEs. Zero-days are undetectable until disclosed.
  • Business logic vulnerabilities — The agent cannot detect authorization bypass or business logic flaws that require domain knowledge.
  • AI-specific detection is evolving — New AI vulnerability patterns emerge regularly. Update the threat model quarterly.

Standards Compliance

StandardRequirementEvidence This Agent Produces
PRD-STD-004Security scanning requirementsSAST, DAST, SCA scan results
PRD-STD-008Dependency and license complianceSCA report with CVE and license status
PRD-STD-009Agent governanceContract, run records, escalation records