Skip to content

This guide helps you validate that Capsule policies are working correctly by running controlled test scenarios with your coding agents. Each scenario triggers a specific policy, so you can confirm your organization's security monitoring is functioning as expected.

Overview

Capsule monitors coding agent sessions in real time, analyzing messages, tool invocations, and agent configuration against your defined policies. Policies define what to look for and how to respond when a violation is detected.

This guide provides ready-to-use test scenarios for each policy. Each scenario walks you through the exact steps to trigger a detection, what to expect in the portal, and how to verify the result.

Important: Some test scenarios involve prompts that reference destructive commands (such as file deletion, database drops, or infrastructure changes). Always run these tests in a sandbox or isolated test environment - never against production systems or agents with live credentials. Policies in Monitoring mode will log violations but will not block the action, so a destructive command could execute before the violation is recorded.

Prerequisites

Before running test scenarios, make sure you have:

  • A sandbox or test environment - do not run these scenarios against production systems or agents with live infrastructure credentials
  • A Capsule Security account with access to the portal
  • At least one coding agent integration deployed (for example, Claude Code or Cursor)
  • At least one agent discovered in your Capsule portal (Inventory > Agents)
  • Default policies enabled in Monitoring mode (enabled by default)

How Policies Work

Policy Types

Capsule has two kinds of policies:

TypeEvaluatesTriggers on
PostureFindings on a resource - an agent, MCP server, skill, tool, or data sourceConfiguration changes, such as a new MCP server, skill, instruction file, or setting
RuntimeDetections in an agent session, optionally narrowed by the tool call inputSession activity - user messages, agent messages and reasoning, or tool invocations

Combined Conditions

Some policies list more than one finding or detection type, for example Prompt Injection with Intent Misalignment. These policies trigger only when all listed types are present:

  • Posture policies - every listed finding must be on the same resource
  • Runtime policies - every listed detection must occur in the same session on the same agent

This is why combined policies carry a higher severity than their single-condition counterparts: the combination indicates a real attack chain, not an isolated signal.

Tool Input Conditions

A runtime policy scoped to Tool call activity can narrow its detections to calls whose input matches. Capsule evaluates the condition deterministically in the hook before the detector runs, so a call outside the condition is never sent to the model for that policy.

The condition lives on the Tool scope and compares the serialized tool call arguments against a list of values, case-insensitive:

  • IS (contains): the input contains any of the values, for example rm -rf or git push --force
  • IS NOT (does not contain): the input contains none of the values, which is how an allow list is expressed, for example acme.com

When both are set, both must hold. A call that carries no input never matches. Combine the condition with the other Tool scope fields (tool type, tool name) to limit it to the tools it applies to.

The policy still needs at least one detection type: a call is blocked, or a violation raised, only when its input matches and the detection is raised on that same call.

Policy Modes

Each policy operates in one of three modes that determine how it responds to a violation:

ModeBehavior
MonitoringDetects and logs violations with no user-facing action
WarningDetects and alerts on violations
PreventionBlocks the action in real time

What Happens When a Policy Triggers

When a policy triggers, Capsule takes the following actions:

  • Creates a policy violation visible in the portal
  • Blocks the action in real time (Prevention mode only)

Posture violations resolve automatically once the underlying finding is gone, for example after you remove a risky MCP server or fix an insecure setting.

Out-of-the-Box Policies

All Capsule accounts come with pre-configured policies enabled in Monitoring mode. The tables below map each policy to the test scenario that validates it.

Data Exposure Policies

Policy NameSeverityTriggerTest Guide
Credentials Exposure in RuntimeMediumSession messagesTest this policy →
PII Exposure in RuntimeMediumSession messagesTest this policy →
PHI Exposure in RuntimeMediumSession messagesTest this policy →
PCI Exposure in RuntimeMediumSession messagesTest this policy →
PCI Exposure with Tool InvocationHighTool useTest this policy →
Business Intelligence Exposure in shared AgentsHighSession messagesTest this policy →

Data Exposure in Public Agents

Policy NameSeverityTriggerTest Guide
Credentials Exposure in Public AgentsCriticalSession messagesTest this policy →
PII Exposure in Public AgentsCriticalSession messagesTest this policy →
PHI Exposure in Public AgentsCriticalSession messagesTest this policy →
PCI Exposure in Public AgentsCriticalSession messagesTest this policy →

Data Exfiltration via Tools

Policy NameSeverityTriggerTest Guide
Credentials Exposure with External Data Exposure via ToolCriticalTool useTest this policy →
PII Exposure with External Data Exposure via ToolCriticalTool useTest this policy →
PHI Exposure with External Data Exposure via ToolCriticalTool useTest this policy →
PCI Exposure with External Data Exposure via ToolCriticalTool useTest this policy →

Prompt Security Policies

Policy NameSeverityTriggerTest Guide
Prompt Injection with Intent MisalignmentCriticalSession messagesTest this policy →
Prompt Injection with Dangerous ActionsCriticalSession messagesTest this policy →
Prompt Injection DetectedHighSession messagesTest this policy →

Operational Safety Policies

Policy NameSeverityTriggerTest Guide
Dangerous Actions with Intent MisalignmentHighTool useTest this policy →
Vulnerable Package InstallationHighTool useTest this policy →
Reconnaissance ActivityMediumTool useTest this policy →

Agent Configuration Policies

Policy NameSeverityTriggerTest Guide
Ungoverned Public Agent Vulnerable to ManipulationCriticalAgent config changeTest this policy →
Insecure Coding Agent ConfigurationHighAgent config changeTest this policy →
Agent Instruction PoisoningHighAgent config changeTest this policy →
Identity Security Risks in ToolsHighAgent config changeTest this policy →
Personal Account UsageHighAgent config changeTest this policy →
Externally Exposed Agent Without an OwnerHighAgent config changeTest this policy →
Public Agent Instruction VulnerabilitiesHighAgent config changeTest this policy →
Missing Agent OwnerMediumAgent config changeTest this policy →
Coding Agent Telemetry EnabledLowAgent config changeTest this policy →
Experimental Model UsageLowAgent config changeTest this policy →

Tool and Data Source Policies

Policy NameSeverityTriggerTest Guide
Tool Poisoning Attack RiskCriticalAgent config changeTest this policy →
Sensitive Data Exposure RiskHighAgent config changeTest this policy →
Excessive or Unused Tool PermissionsMediumAgent config changeTest this policy →

MCP Server Policies

Policy NameSeverityTriggerTest Guide
MCP Server with Malicious ReputationCriticalAgent config changeTest this policy →
MCP Hidden InstructionsHighAgent config changeTest this policy →
MCP Name SquattingHighAgent config changeTest this policy →
Over-Permissioned MCP Server Exposed to Untrusted ContentHighAgent config changeTest this policy →
Single-Server MCP Lethal TrifectaHighAgent config changeTest this policy →
MCP Server with Suspicious ReputationHighAgent config changeTest this policy →

Skill Policies

Policy NameSeverityTriggerTest Guide
Skill with Data ExfiltrationCriticalAgent config changeTest this policy →
Skill with Malicious ReputationCriticalAgent config changeTest this policy →
Skill with Hardcoded SecretsHighAgent config changeTest this policy →
Skill with Prompt InjectionHighAgent config changeTest this policy →
Skill with Suspicious ReputationHighAgent config changeTest this policy →

Verifying Results

Violations appear on two pages in the Capsule portal, depending on the policy type:

  • Posture - violations from configuration policies (agents, MCP servers, skills, tools, data sources)
  • Runtime - violations from session policies (data exposure, prompt injection, operational safety)

After running any test scenario:

  1. Open the Posture or Runtime page
  2. Look for a new violation matching the scenario you tested
  3. Click the violation to see:
    • Violation category - The specific violation category that was detected
    • Evidence - Quoted content from the session or configuration that triggered the detection
    • Policy - Which policy matched and its severity
    • Session - Link to the full agent session for context (runtime violations)

Tips for Testing

  • Run one scenario at a time for clear results
  • Allow some time after the agent session for analysis to complete
  • Start a new agent session after a configuration change, so Capsule picks up the new setup
  • Many detections are judged by an AI model against the full context, so a scenario that looks contrived may be classified differently from a realistic one. If a scenario doesn't trigger, make it more concrete rather than more extreme
  • Start with Monitoring mode - switch to Prevention mode only after validating detections work
  • Use a dedicated test environment or sandbox agent if available