/** * Agent Chain Analysis * * Extends exfil-path-graph with multi-agent attack path analysis. * Models trust boundaries between agents and MCP servers to identify * attack paths that span multiple agent hops. * * @module scanners/agent/agent-chain-analysis */ import type { Severity } from "../../certification/types.js"; import type { MCPManifest } from "./types.js"; /** * Trust level for an agent or tool */ export type AgentTrustLevel = "high" | "medium" | "low" | "untrusted"; /** * Types of nodes in the agent graph */ export type AgentNodeType = "mcp-server" | "agent" | "tool" | "external-api" | "user" | "data-store"; /** * A node in the agent capability graph */ export interface AgentNode { /** Unique identifier */ id: string; /** Node type */ type: AgentNodeType; /** Human-readable name */ name: string; /** Trust level */ trustLevel: AgentTrustLevel; /** Capabilities this node has */ capabilities: string[]; /** Data types this node can access */ dataAccess: string[]; /** Whether this is an entry point (untrusted input) */ isEntryPoint: boolean; /** Whether this accesses sensitive data */ accessesSensitiveData: boolean; /** Risk score (0-100) */ riskScore: number; } /** * Connection types between agents */ export type AgentEdgeType = "calls" | "delegates" | "reads-from" | "writes-to" | "authenticates"; /** * An edge between nodes in the agent graph */ export interface AgentEdge { /** Source node ID */ from: string; /** Target node ID */ to: string; /** Connection type */ type: AgentEdgeType; /** Data types that flow across this edge */ dataTypes: string[]; /** Whether authentication is required */ requiresAuth: boolean; /** Trust boundary crossing (trust drops) */ crossesTrustBoundary: boolean; /** Description */ description?: string; } /** * The complete agent interaction graph */ export interface AgentGraph { /** All nodes */ nodes: AgentNode[]; /** All edges */ edges: AgentEdge[]; } /** * A multi-hop attack path through the agent graph */ export interface AttackPath { /** Unique path ID */ id: string; /** Human-readable title */ title: string; /** Nodes in the attack path */ steps: AgentNode[]; /** Edges traversed */ edgesTraversed: AgentEdge[]; /** Number of trust boundaries crossed */ trustBoundariesCrossed: number; /** Sensitive data exposed by this path */ dataExposed: string[]; /** Overall severity */ severity: Severity; /** Confidence (0-100) */ confidence: number; /** Attack narrative */ attackNarrative: string; /** Mitigation recommendations */ mitigation: string[]; /** MITRE ATT&CK techniques if applicable */ mitreTechniques?: string[]; } /** * Result of agent chain analysis */ export interface AgentChainAnalysisResult { /** The agent graph */ graph: AgentGraph; /** Identified attack paths */ attackPaths: AttackPath[]; /** Statistics */ stats: { totalNodes: number; totalEdges: number; entryPoints: number; sensitiveNodes: number; trustBoundaries: number; attackPaths: number; criticalPaths: number; highPaths: number; }; /** Mermaid diagram */ mermaidDiagram: string; } /** * Build agent graph from MCP manifests */ export declare function buildAgentGraph(manifests: Array<{ name: string; manifest: MCPManifest; }>, agentConfigs?: Array<{ name: string; trustLevel: AgentTrustLevel; }>): AgentGraph; /** * Find attack paths from entry points to sensitive data */ export declare function analyzeAgentChains(graph: AgentGraph): AttackPath[]; /** * Generate Mermaid diagram for agent graph */ export declare function generateAgentChainDiagram(graph: AgentGraph, attackPaths: AttackPath[]): string; /** * Run full agent chain analysis */ export declare function runAgentChainAnalysis(manifests: Array<{ name: string; manifest: MCPManifest; }>, agentConfigs?: Array<{ name: string; trustLevel: AgentTrustLevel; }>): AgentChainAnalysisResult; //# sourceMappingURL=agent-chain-analysis.d.ts.map