Beyond SAST: 9 Essential Security Tests for Production AI Agents

Beyond SAST: 9 Essential Security Tests for Production AI Agents
10 mins read
Category:
Tech
October 3, 2026

​​​Introduction: Traditional Security Scanning Is No Longer Enough

AI agents are evolving from conversational interfaces into systems capable of executing code, accessing enterprise databases, invoking APIs, interacting with MCP servers, and performing multi-step workflows with varying levels of autonomy.

This introduces a fundamental challenge for engineering teams: How do we validate the security of systems whose execution paths are partially determined by an LLM?

Traditional application security practices such as Static Application Security Testing (SAST), dependency scanning, secrets detection, and Infrastructure as Code (IaC) validation remain essential. They help identify vulnerable code, exposed credentials, insecure dependencies, and misconfigured infrastructure.

However, these controls cannot fully capture the additional risks introduced by agentic systems.

Consider an AI agent that retrieves a document containing malicious instructions. The document influences the agent's tool selection, and the selected tool has excessive permissions to access internal APIs.

Each individual component might pass traditional security scans, while the combined workflow still creates a serious vulnerability.

Agent security therefore requires extending traditional DevSecOps with agent-aware architecture analysis, MCP security scanning, authorization testing, adversarial evaluations, and behavioral regression testing.

In this article, I'll outline nine essential scanning and testing areas, explain the tools available, and propose a practical approach to integrating them into an enterprise AI agent CI/CD pipeline.

AI Agent Security Scanning: Summary and Suggested Tools

The following table provides a practical reference checklist for engineering teams developing and deploying production AI agents.

Security Scan / Test What It Detects or Validates Suggested Tools & Frameworks
1. Traditional SAST Insecure Python and Node.js code, injection vulnerabilities, dangerous APIs, and unsafe execution paths. CodeQL, SonarQube, Semgrep
2. Secrets Scanning Hardcoded credentials, leaked API tokens, exposed secrets, and sensitive credentials committed to repositories. Trivy, Gitleaks
3. Dependency & Image Scanning Vulnerable packages, container images, known dependency vulnerabilities, and software supply-chain risks. Grype, Trivy
4. IaC Security Scanning Unsafe Docker, Kubernetes, Terraform, and network configurations, including excessive privileges and misconfigurations. Trivy
5. Agent Architecture Scanning Newly introduced tools, excessive permissions, dangerous execution paths, missing trust boundaries, and cross-layer agent risks. CSA MAESTRO-based checks, TITO (emerging approach)
6. MCP Security Scanning Suspicious MCP tool descriptions, tool poisoning, untrusted configurations, and unexpected tool capability changes. Cisco MCP Scanner, Snyk Agent Scan (formerly MCP-Scan)
7. Authorization Testing Unauthorized user or agent actions, privilege escalation, tenant isolation violations, and improper tool permissions. Pytest, Jest
8. Agent Adversarial Testing Prompt injection, RAG poisoning, tool misuse, data exfiltration, and adversarial agent behavior. Promptfoo, Microsoft PyRIT
9. Agent Quality Regression Incorrect tool selection, poor RAG answers, degraded task completion, and changes in agent performance or reliability. Ragas

Note: These are suggested technologies rather than mandatory products. TITO is an emerging MAESTRO-based source-analysis approach described in a Cloud Security Alliance article. Snyk Agent Scan is the current tool name for the MCP-Scan lineage. The appropriate implementation depends on the existing engineering stack, security requirements, and deployment environment.

1. Traditional Static Application Security Testing (SAST)

  • Security Area
    • AI agents are still software applications built using Python, JavaScript, TypeScript, and other programming languages.
    • Their orchestration frameworks, API integrations, and custom tools can contain conventional software vulnerabilities.
    • Insecure code may expose agents to command injection, SQL injection, path traversal, unsafe deserialization, or unauthorized filesystem access.
  • Best Practices
    • Integrate SAST into every pull request and main-branch build.
    • Scan agent orchestration code, backend APIs, MCP implementations, and custom tool handlers.
    • Identify dangerous execution patterns such as unvalidated shell commands or dynamic code execution.
    • Establish custom rules for high-risk agent capabilities, including arbitrary tool execution and unvalidated tool arguments.
    • Block newly introduced critical vulnerabilities and require reviews for justified exceptions.
  • Suggested Tools & Frameworks
    • CodeQL: GitHub's semantic code analysis engine that builds a queryable representation of source code. Useful for detecting complex data-flow vulnerabilities in Python, JavaScript/TypeScript, and other supported languages.
    • SonarQube: A code-quality and security analysis platform that helps detect vulnerabilities, bugs, and maintainability issues. Useful for centralized quality gates and engineering governance.
    • Semgrep: A static analysis platform that supports customizable rules for detecting insecure coding patterns. Particularly useful for writing organization-specific rules around AI agent tool implementations and framework usage.

Engineering takeaway: AI agents introduce new risks, but traditional software vulnerabilities remain just as relevant. SAST should be a foundational security control.

2. Secrets and Credential Scanning

  • Security Area
    • AI applications frequently require credentials for LLM providers, vector databases, cloud infrastructure, MCP servers, and enterprise APIs.
    • Hardcoded secrets in repositories, container filesystems, or configuration files may expose sensitive systems.
    • In agentic systems, leaked credentials are particularly concerning when they provide access to privileged tools.
  • Best Practices
    • Scan repositories and relevant Git history for exposed credentials.
    • Detect secrets in configuration files, scripts, Docker images, and infrastructure definitions.
    • Prevent credentials from being committed through local checks and CI pipelines.
    • Rotate and revoke confirmed exposed credentials; deleting the secret from the latest commit is not sufficient.
    • Use centralized secrets management and scoped, short-lived credentials wherever possible.
  • Suggested Tools & Frameworks
    • Gitleaks: An open-source secret detection tool designed to identify credentials, API keys, and tokens in Git repositories and files. Useful for pre-commit checks and CI/CD pipelines.
    • Trivy: A security scanner that can detect exposed secrets in repositories, filesystems, and container images alongside other vulnerability classes.

Engineering takeaway: Credentials should never become part of an agent's source code or model context. Prevent leaks before deployment, and treat confirmed exposures as incidents requiring remediation.

3. Dependency and Container Image Scanning

  • Security Area
    • AI agent platforms often depend on a large set of Python packages, Node.js modules, orchestration frameworks, model-serving libraries, and container images.
    • Vulnerabilities in these components can introduce security risks even when application code is correctly implemented.
    • Agent platforms may be particularly exposed when dependencies support shell execution, network access, document parsing, or plugin loading.
  • Best Practices
    • Continuously scan Python and Node.js dependencies for known vulnerabilities.
    • Scan container images before promoting them into production.
    • Pin dependency versions and use reproducible build processes.
    • Maintain software bills of materials (SBOMs) for deployed artifacts.
    • Prioritize remediation using severity, exploitability, exposure, and actual usage rather than CVSS alone.
    • Re-scan deployed images when vulnerability databases are updated.
  • Suggested Tools & Frameworks
    • Grype: An open-source vulnerability scanner developed by Anchore. It scans container images, filesystems, and SBOMs for known vulnerabilities in operating-system and language-specific packages.
    • Trivy: A versatile security scanner for container images, application dependencies, filesystems, and other artifacts. Useful when teams prefer a unified scanner across several DevSecOps categories.

Engineering takeaway: A secure agent cannot rely on an insecure software supply chain. Dependency and image scanning should continue throughout the application lifecycle.

4. Infrastructure as Code (IaC) Security Scanning

  • Security Area
    • AI agents are commonly deployed using Docker, Kubernetes, Terraform, and managed cloud services.
    • Insecure configurations can expose sensitive infrastructure, particularly when agents have code-execution or external-tool capabilities.
    • A correctly implemented agent may still be vulnerable if its container runs with excessive privileges or unrestricted network access.
  • Best Practices
    • Scan Dockerfiles, Kubernetes manifests, Terraform configurations, and related deployment files.
    • Detect privileged containers, unnecessary Linux capabilities, unsafe filesystem mounts, and overly broad access permissions.
    • Validate network policies and restrict unnecessary outbound connectivity.
    • Enforce resource limits and prefer non-root workloads.
    • Review service-account permissions, workload identities, and exposed network endpoints.
    • Apply policy checks before deploying infrastructure changes.
  • Suggested Tools & Frameworks
    • Trivy: Supports misconfiguration scanning across infrastructure definitions, including Kubernetes, Terraform, and container-related configurations. It can identify common unsafe configurations before deployment.

Engineering takeaway: Runtime isolation begins with infrastructure configuration. An agent sandbox is only as secure as the environment enforcing its boundaries.

5. Agent Architecture and Trust-Boundary Scanning

  • Security Area
    • Traditional code scanners evaluate vulnerabilities in individual functions, files, or software components.
    • AI agents introduce additional architectural risks arising from LLM-controlled tool selection, persistent memory, dynamically connected tools, and multi-agent interactions.
    • The most dangerous vulnerabilities may emerge from the combination of otherwise legitimate components.
  • Best Practices
    • Maintain an inventory of agents, tools, execution capabilities, permissions, memory systems, and external integrations.
    • Identify trust boundaries between user requests, model outputs, RAG content, tool execution, and backend services.
    • Detect newly introduced tools or permissions during pull-request reviews.
    • Identify execution paths where untrusted content can influence privileged actions.
    • Evaluate agent architectures against MAESTRO threat-modeling layers.
    • Document attack paths and validate that security enforcement exists at each critical boundary.
    • Supplement automated checks with architecture reviews for high-risk changes.
  • Suggested Tools & Frameworks
    • CSA MAESTRO: A threat-modeling framework from the Cloud Security Alliance for understanding threats across the layers of agentic AI systems. It is particularly useful for identifying risks created by interactions between models, orchestration components, tools, and external services.
    • TITO (Threat In and Threat Out): An emerging automated source-analysis and threat-modeling approach described in a February 2026 CSA article. It uses MAESTRO classifications and analyzes agentic patterns, data flows, and cross-layer attack paths to provide more architectural context than conventional static scanners.

Engineering takeaway: Traditional scanners identify insecure code. Agent-aware architecture analysis helps identify insecure relationships between components.

6. MCP Server and Tool Security Scanning

  • Security Area
    • Model Context Protocol (MCP) servers allow agents to discover and invoke external capabilities.
    • MCP tool descriptions, prompts, and configuration files can introduce new sources of untrusted instructions or unsafe capabilities.
    • Changes to tool definitions can alter an agent's behavior even without modifying the core agent application.
  • Best Practices
    • Scan MCP server configurations and tool definitions before registration.
    • Detect suspicious descriptions that attempt to override instructions or influence unrelated actions.
    • Maintain approved MCP server inventories and tool allowlists.
    • Compare tool definitions and permissions against previously approved versions.
    • Review newly introduced destructive operations, sensitive resource access, and unexpected external endpoints.
    • Scan third-party MCP configurations in isolated environments before permitting execution.
    • Revalidate MCP security whenever servers, tools, or connected capabilities change.
  • Suggested Tools & Frameworks
    • Cisco MCP Scanner: An open-source scanner from Cisco AI Defense that analyzes MCP servers and tools for potential security threats. It combines techniques including YARA rules, LLM-based inspection, and Cisco AI Defense analysis.
    • Snyk Agent Scan: A security scanner for discovering and assessing agent components, including MCP servers, tool definitions, and agent skills. It identifies risks such as prompt injection, suspicious capabilities, and unsafe handling of sensitive information. It succeeds the earlier MCP-Scan naming.

Engineering takeaway: An MCP server is not trustworthy simply because it is registered. Treat tool metadata and server configurations as part of the agent's security-sensitive supply chain.

Operational caution: Some MCP scanners connect to configured servers or execute local MCP startup commands to inspect tools. Untrusted configurations should be examined inside isolated environments rather than directly on developer machines or privileged CI runners.

7. Authorization and Permission Testing

  • Security Area
    • Agent authorization is different from checking whether the LLM follows an instruction.
    • Production systems must enforce permissions independently of the model's decisions.
    • Incorrect authorization can allow agents to invoke prohibited tools, access other tenants' data, or perform operations beyond a user's authority.
  • Best Practices
    • Build deterministic tests for agent, user, tenant, resource, and tool permissions.
    • Validate both successful and denied authorization scenarios.
    • Test cross-tenant access attempts, privilege escalation, and unauthorized tool invocations.
    • Ensure authorization checks apply to tool arguments, not just tool names.
    • Simulate expired credentials, missing identity context, and manipulated resource identifiers.
    • Verify that denied actions do not cause downstream side effects.
    • Run critical authorization tests on every pull request.
  • Suggested Tools & Frameworks
    • Pytest: A Python testing framework suitable for validating authorization logic, agent tool handlers, middleware, and backend API behavior. Particularly useful for LangGraph and FastAPI-based systems.
    • Jest: A JavaScript/TypeScript testing framework useful for testing Node.js agent services, MCP implementations, and authorization middleware.

Engineering takeaway: Authorization must be proven through deterministic tests, not inferred from the model's apparent compliance with security instructions.

8. Agent Adversarial Testing and Red Teaming

  • Security Area
    • Static scanning cannot determine every way an agent may behave when exposed to malicious content.
    • Prompt injection, RAG poisoning, malicious tool responses, and multi-step manipulation require behavioral testing against a running application.
    • The objective is to discover whether attackers can influence agents to perform unauthorized actions or disclose sensitive information.
  • Best Practices
    • Test direct and indirect prompt-injection scenarios.
    • Inject malicious content into controlled RAG documents and mock tool responses.
    • Evaluate whether agents attempt unauthorized API calls or tool executions.
    • Test attempts to exfiltrate sensitive information through allowed tool channels.
    • Include multi-turn attacks that exploit memory or earlier conversation state.
    • Run attacks in isolated test environments with synthetic data and mocked external side effects.
    • Track confirmed attack success rates and add reproducible failures to regression suites.
  • Suggested Tools & Frameworks
    • Promptfoo: An open-source evaluation and red-teaming platform that supports automated adversarial tests for LLM applications. It includes scenarios for prompt injection, RAG poisoning, MCP-related risks, and other application-layer vulnerabilities, with CI/CD integration.
    • Microsoft PyRIT: The Python Risk Identification Tool for generative AI, an open-source framework for systematic AI red teaming. Useful for developing repeatable attack scenarios, multi-turn adversarial workflows, and more extensive security assessments.

Engineering takeaway: Static scans reveal potential vulnerabilities. Adversarial testing demonstrates whether those vulnerabilities can influence a running agent.

9. Agent Quality and Behavioral Regression Testing

  • Security Area
    • AI agent reliability is an important part of production assurance.
    • Model upgrades, prompt changes, tool-schema modifications, and retrieval changes can alter agent behavior without introducing traditional software defects.
    • An agent may remain secure but become less accurate, choose incorrect tools, or fail to complete previously successful workflows.
  • Best Practices
    • Maintain a versioned evaluation dataset covering critical agent workflows.
    • Measure tool selection, tool-call argument accuracy, and task completion.
    • Evaluate RAG quality using retrieval and response metrics appropriate to the application.
    • Compare results against established baselines before promoting new models or agent configurations.
    • Include scenarios involving unavailable tools, incomplete context, and ambiguous requests.
    • Track evaluation variability and distinguish meaningful regressions from normal model nondeterminism.
    • Combine automated evaluation with human review for high-impact workflows.
  • Suggested Tools & Frameworks
    • Ragas: An open-source evaluation framework for RAG and agentic AI applications. It provides metrics for retrieval quality, response faithfulness, tool-call accuracy, and agent goal completion.

Engineering takeaway: Passing security scans does not guarantee production readiness. Agents must also demonstrate consistent and reliable task execution.

‍

Practical Example: Securing a Document Research Agent

Consider an enterprise AI agent responsible for researching internal documents, extracting financial information, and generating summaries for authorized employees.

The agent uses RAG to retrieve documents and MCP tools to interact with internal APIs.

Now assume an engineering team introduces a new MCP tool that can retrieve documents and export their content.

A well-designed CI/CD pipeline should evaluate this change through multiple layers:

  • SAST: Detect whether the tool implementation includes unsafe file handling, injection risks, or insecure API usage.
  • Secrets scanning: Ensure API credentials are not embedded in the new tool configuration.
  • Dependency and image scanning: Identify known vulnerabilities in the MCP server's packages and container image.
  • IaC scanning: Verify that the service is not deployed with privileged permissions or unrestricted network connectivity.
  • Architecture analysis: Identify that the agent has gained a new capability to export documents, potentially crossing a previously protected trust boundary.
  • MCP security scanning: Inspect the new tool description, approved permissions, and potential prompt-injection risks.
  • Authorization tests: Confirm that the agent cannot export another tenant's documents, even when prompted to do so.
  • Adversarial testing: Introduce malicious instructions into synthetic retrieved documents and verify that they cannot trigger unauthorized exports.
  • Quality evaluation: Confirm that the agent still selects the correct tools, retrieves relevant documents, and generates accurate summaries.

This demonstrates why a single security scanner is insufficient.

Each testing layer validates a different part of the system, and the combined results provide stronger evidence of production readiness.

Production Readiness Checklist

Before deploying an enterprise AI agent into production, I would expect the engineering team to demonstrate:

  • SAST checks pass without unresolved release-blocking findings.
  • No confirmed exposed credentials remain active.
  • Dependencies and container images have been assessed for exploitable vulnerabilities.
  • Infrastructure configurations enforce the required runtime restrictions.
  • Agent tools, capabilities, permissions, and trust boundaries have been reviewed.
  • MCP integrations and tool-definition changes have been security-tested.
  • Unauthorized tool calls and cross-tenant access attempts are denied by deterministic controls.
  • Adversarial testing covers relevant prompt-injection, RAG poisoning, and tool misuse scenarios.
  • Agent quality evaluations meet established regression thresholds.
  • Security findings, accepted risks, and release approvals are recorded and attributable.

These checks should be backed by automated evidence wherever possible, rather than relying only on manual sign-off.

Final Thoughts: DevSecOps Must Evolve for Agentic AI

AI agents introduce a new dimension to software security.

Traditional scanners remain essential for detecting vulnerable code, exposed credentials, unsafe dependencies, and infrastructure misconfigurations.

But production agents also require architectural analysis, tool-governance checks, authorization testing, adversarial evaluations, and behavioral regression testing.

One of the most important lessons is that security is no longer only about whether the software contains a vulnerability; it is also about whether the agent can be influenced to perform an action it should never be allowed to perform.

This requires engineering teams to combine familiar DevSecOps practices with agent-specific validation and continuous evaluation.

From an Engineering Manager's perspective, I would make these controls part of the standard development and release process rather than treating AI security as a separate review performed immediately before deployment.

Scan the code. Validate the architecture. Test the permissions. Attack the agent. Evaluate its behavior.

That's how we move from functional AI agent prototypes to secure, reliable, production-ready enterprise systems.

References and Further Reading

Traditional Security Scanning

Agent Architecture and MCP Security

Adversarial Testing and Quality Evaluation

‍

Reveal other articles

Explore more