@highflame/policy 2.1.13 → 2.1.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,37 @@
1
+ // Code generated by highflame-policy-codegen. DO NOT EDIT.
2
+ // Source: schemas/mcp_gateway/schema.cedarschema
3
+ /**
4
+ * McpGateway entity metadata for UI components.
5
+ * Extracted from Cedar schema appliesTo blocks.
6
+ */
7
+ export const MCP_GATEWAY_ENTITIES = {
8
+ principals: ['MCP_Client', 'User'],
9
+ resources: ['FilePath', 'LlmPrompt', 'Server', 'Tool'],
10
+ actions: ['call_tool', 'connect_server', 'process_prompt', 'read_file', 'write_file'],
11
+ };
12
+ /**
13
+ * Per-action entity mapping for McpGateway.
14
+ * Maps action names to their valid principals and resources.
15
+ */
16
+ export const MCP_GATEWAY_ACTION_ENTITIES = {
17
+ 'call_tool': {
18
+ principals: ['MCP_Client', 'User'],
19
+ resources: ['Tool'],
20
+ },
21
+ 'connect_server': {
22
+ principals: ['MCP_Client', 'User'],
23
+ resources: ['Server'],
24
+ },
25
+ 'process_prompt': {
26
+ principals: ['MCP_Client', 'User'],
27
+ resources: ['LlmPrompt'],
28
+ },
29
+ 'read_file': {
30
+ principals: ['MCP_Client', 'User'],
31
+ resources: ['FilePath'],
32
+ },
33
+ 'write_file': {
34
+ principals: ['MCP_Client', 'User'],
35
+ resources: ['FilePath'],
36
+ },
37
+ };
@@ -4,6 +4,12 @@
4
4
  * Full Cedar schema for guardrails, embedded at codegen time.
5
5
  */
6
6
  export declare const GUARDRAILS_SCHEMA = "// =============================================================================\n// Guardrails Cedar Schema\n// =============================================================================\n// Defines entity types, actions, and context attributes for the highflame-shield\n// guardrails service. This schema enables type-safe policy authoring and\n// validation in both Studio UI and backend.\n//\n// Service: highflame-shield (guardrails)\n// Namespace: Guardrails\n// =============================================================================\n\nnamespace Guardrails {\n // =========================================================================\n // Entity Types \u2014 ReBAC Hierarchy\n // =========================================================================\n // Entity hierarchy enables Cedar's `in` operator for policy scoping:\n // Account (org root)\n // \u2514\u2500\u2500 Project in [Account]\n // \u251C\u2500\u2500 App in [Project]\n // \u2502 \u2514\u2500\u2500 Session in [App, Agent]\n // \u2514\u2500\u2500 Agent in [Project]\n // \u2514\u2500\u2500 Session in [App, Agent]\n //\n // Policy scoping examples:\n // resource == Guardrails::App::\"<uuid>\" \u2192 app-scoped (app only)\n // resource == Guardrails::Agent::\"<agent_id>\" \u2192 agent-only (exact match)\n // resource in Guardrails::Agent::\"<agent_id>\" \u2192 agent + its sessions\n // resource in Guardrails::Project::\"<uuid>\" \u2192 project-wide (apps + agents)\n // resource in Guardrails::Account::\"<uuid>\" \u2192 org-wide\n // =========================================================================\n\n /// Account represents an organization (top-level tenant)\n entity Account;\n\n /// Project represents a project within an account\n entity Project in [Account];\n\n /// User represents a principal (human or service) making requests\n entity User;\n\n /// Agent represents an AI agent (Claude, Cursor, Copilot, etc.) making requests.\n /// Used as both principal (who is acting) and resource (policy scoping target).\n /// Agent + sessions: resource in Guardrails::Agent::\"<agent_id>\" (hierarchy match)\n /// Agent only: resource == Guardrails::Agent::\"<agent_id>\" (exact match)\n entity Agent in [Project];\n\n /// App represents a protected application (guardrails-enabled LLM app)\n entity App in [Project];\n\n /// Session represents an agentic conversation session with state tracking.\n /// Sessions can belong to either an App or an Agent.\n entity Session in [App, Agent];\n\n // =========================================================================\n // Actions\n // =========================================================================\n\n /// Process user prompts and AI responses for security threats and content violations\n action \"process_prompt\" appliesTo {\n principal: [User, Agent],\n resource: [App, Agent, Session],\n context: ProcessPromptContext\n };\n\n /// Execute tool calls (shell, file operations, MCP tools)\n action \"call_tool\" appliesTo {\n principal: [User, Agent],\n resource: [Agent, Session],\n context: CallToolContext\n };\n\n /// Read file operations\n action \"read_file\" appliesTo {\n principal: [User, Agent],\n resource: [Agent, Session],\n context: FileReadContext\n };\n\n /// Write file operations\n action \"write_file\" appliesTo {\n principal: [User, Agent],\n resource: [Agent, Session],\n context: FileWriteContext\n };\n\n /// Connect to an MCP server\n action \"connect_server\" appliesTo {\n principal: [User, Agent],\n resource: [Agent, Session],\n context: ConnectServerContext\n };\n\n // =========================================================================\n // Context Types (Action-Specific)\n // =========================================================================\n\n /// Context for process_prompt action (user prompts & AI responses)\n type ProcessPromptContext = {\n // Core metadata (required)\n \"request_id\": String,\n \"timestamp\": Long,\n \"direction\": String, // \"input\" | \"output\"\n \"content_type\": String, // \"prompt\" | \"response\" | \"tool_call\" | \"file\"\n \"detector_count\": Long,\n\n // Security - Injection & Jailbreak (optional)\n \"injection_confidence\"?: Long, // Combined injection confidence: MAX(pulse, deep_context)\n \"jailbreak_confidence\"?: Long, // Combined jailbreak confidence: MAX(pulse, deep_context)\n \"injection_pulse_score\"?: Long, // 0-100 Pulse single-turn classifier\n \"injection_deep_context_score\"?: Long, // 0-100 DeepContext multi-turn\n \"jailbreak_pulse_score\"?: Long, // 0-100 Pulse single-turn classifier\n \"jailbreak_deep_context_score\"?: Long, // 0-100 DeepContext multi-turn\n \"injection_type\"?: String, // \"prompt\" | \"sql\" | \"command\" | \"none\"\n\n // Privacy - Secrets (optional)\n \"contains_secrets\"?: Bool,\n \"secret_count\"?: Long,\n \"secret_types\"?: Set<String>, // [\"aws_access_key\", \"github_token\", ...]\n\n // Privacy - PII (optional)\n \"pii_detected\"?: Bool,\n \"pii_count\"?: Long,\n \"pii_types\"?: Set<String>, // [\"email\", \"phone\", \"ssn\", \"credit_card\", ...]\n \"pii_confidence\"?: Long, // PII ML classifier confidence (0-100) \u2014 catches novel PII patterns that escape regex detection\n\n // Threat Severity Aggregation (optional)\n \"highest_severity\"?: String, // Highest severity across all detectors: \"critical\" | \"high\" | \"medium\" | \"low\" | \"none\"\n\n // Trust & Safety - Toxicity (optional)\n \"violence_score\"?: Long, // 0-100\n \"hate_speech_score\"?: Long, // 0-100\n \"sexual_score\"?: Long, // 0-100\n \"weapons_score\"?: Long, // 0-100\n \"crime_score\"?: Long, // 0-100\n \"profanity_score\"?: Long, // 0-100\n\n // Semantic - Topic Classification (optional)\n \"content_topics\"?: Set<String>, // [\"controlled_substances\", \"weapons_manufacturing\", ...]\n \"topic_confidence\"?: Long, // 0-100\n\n // Security - Invisible Character Detection (optional)\n \"contains_invisible_chars\"?: Bool,\n \"invisible_chars_score\"?: Long, // 0-100\n\n // Security - Pattern Detection (optional)\n \"command_injection_detected\"?: Bool,\n \"command_injection_type\"?: String, // \"reverse_shell\" | \"privilege_escalation\" | \"code_execution\" | \"destructive_command\" | \"data_exfiltration\"\n \"command_injection_score\"?: Long, // 0-100\n \"path_traversal_detected\"?: Bool,\n \"path_traversal_severity\"?: String, // \"critical\" | \"high\" | \"medium\" | \"low\" | \"none\"\n \"path_traversal_type\"?: String,\n \"sql_injection_detected\"?: Bool,\n \"sql_injection_type\"?: String, // \"tautology\" | \"union_based\" | \"destructive\" | \"blind\" | \"error_based\"\n \"sql_injection_score\"?: Long, // 0-100\n\n // Security - Cross-Origin Escalation (optional)\n \"cross_origin_detected\"?: Bool,\n \"cross_origin_type\"?: String, // \"cross_origin_tool\" | \"cross_origin_server\" | \"none\"\n \"cross_origin_score\"?: Long, // 0-100\n\n // Security - Encoded Injection (optional)\n \"encoded_content_detected\"?: Bool,\n \"encoded_types\"?: Set<String>, // [\"base64\", \"hex\", \"unicode\", \"url\", ...]\n \"encoded_count\"?: Long,\n \"encoded_score\"?: Long, // 0-100\n\n // Language & Script Detection (optional)\n \"detected_language\"?: String, // ISO language code\n \"is_english\"?: Bool,\n \"language_confidence\"?: Long, // 0-100\n \"detected_script\"?: String, // \"latin\" | \"cyrillic\" | \"arabic\" | \"unknown\" | ...\n \"is_latin_script\"?: Bool,\n \"script_confidence\"?: Long, // 0-100\n\n // Content Analysis (optional)\n \"hallucination_score\"?: Long,\n \"factuality_score\"?: Long, // 0-100\n \"sentiment_score\"?: Long,\n \"contains_code\"?: Bool,\n \"code_languages\"?: Set<String>,\n \"code_ratio\"?: Long, // 0-100, percentage of content that is code\n \"keyword_matched\"?: Bool,\n \"keyword_categories\"?: Set<String>,\n \"keyword_count\"?: Long,\n \"contains_non_ascii\"?: Bool,\n \"phishing_detected\"?: Bool,\n \"content_safety_score\"?: Long, // 0-100\n \"content_safety_blocked\"?: Bool,\n\n // Agentic - Multi-Turn Context (optional)\n \"conversation_turn\"?: Long,\n \"multi_turn_detection\"?: Bool,\n\n // Session Detection History \u2014 cross-turn sticky flags (optional)\n \"session_pii_detected\"?: Bool,\n \"session_pii_types\"?: Set<String>,\n \"session_secrets_detected\"?: Bool,\n \"session_secret_types\"?: Set<String>,\n \"session_injection_detected\"?: Bool,\n \"session_command_injection\"?: Bool,\n \"session_threat_turns\"?: Long,\n \"session_max_injection_score\"?: Long,\n \"session_max_jailbreak_score\"?: Long,\n \"session_max_command_injection_score\"?: Long,\n \"session_max_pii_score\"?: Long,\n \"session_max_secret_score\"?: Long,\n \"session_cumulative_risk_score\"?: Long,\n\n // Agent Identity \u2014 authenticated agent principal metadata (optional)\n // Present when the request is made by an AI agent (API key or JWT with agent claims).\n // Empty strings for human user requests. Use these to write agent-specific policies.\n \"agent_id\"?: String, // Unique agent identifier (e.g., \"agent_research_v3\")\n \"agent_type\"?: String, // \"orchestrator\" | \"autonomous\" | \"tool_agent\" | \"human_proxy\"\n \"agent_trust_level\"?: String, // \"first_party\" | \"verified_third_party\" | \"unverified\"\n \"agent_framework\"?: String, // Agent framework (e.g., \"claude-code\", \"langchain\", \"crewai\")\n \"agent_publisher\"?: String, // Organization that published the agent\n\n };\n\n /// Context for call_tool action (agentic tool execution)\n type CallToolContext = {\n // Core metadata (required)\n \"request_id\": String,\n \"timestamp\": Long,\n\n // Tool Risk (optional)\n \"tool_name\"?: String, // \"shell\", \"write_file\", \"http_post\", etc.\n \"tool_risk_score\"?: Long, // 0-100\n \"tool_is_sensitive\"?: Bool,\n \"tool_category\"?: String, // \"safe\" | \"sensitive\" | \"dangerous\"\n \"tool_is_builtin\"?: Bool,\n\n // MCP context (optional \u2014 only present for MCP tool calls)\n \"mcp_server\"?: String, // MCP server name (e.g., \"github\", \"filesystem\")\n \"mcp_tool\"?: String, // MCP tool name within the server\n \"mcp_server_verified\"?: Bool, // Whether server is from verified registry\n\n // Agentic - Behavioral Patterns (optional)\n \"suspicious_pattern\"?: Bool,\n \"pattern_type\"?: String, // \"data_exfiltration\" | \"secret_exfiltration\" | \"db_exfiltration\" | \"credential_theft\" | \"destructive_sequence\" | \"none\"\n \"sequence_risk\"?: Long, // 0-100\n\n // Agentic - Loop Detection (optional)\n \"loop_detected\"?: Bool,\n \"loop_count\"?: Long,\n \"loop_tool\"?: String,\n\n // Agentic - Budget Control (optional)\n \"budget_remaining_pct\"?: Long, // 0-100\n \"budget_exceeded\"?: Bool,\n\n // Semantic - Topic Classification (optional)\n \"content_topics\"?: Set<String>, // [\"controlled_substances\", \"weapons_manufacturing\", ...]\n \"topic_confidence\"?: Long, // 0-100\n\n // Security checks on tool arguments (optional)\n \"contains_secrets\"?: Bool,\n \"secret_count\"?: Long,\n \"secret_types\"?: Set<String>,\n \"pii_detected\"?: Bool,\n \"pii_types\"?: Set<String>,\n \"pii_count\"?: Long, // Number of PII pattern matches in tool content\n \"pii_confidence\"?: Long, // PII ML classifier confidence (0-100)\n \"injection_confidence\"?: Long,\n \"injection_pulse_score\"?: Long, // 0-100 Pulse single-turn classifier\n \"injection_deep_context_score\"?: Long, // 0-100 DeepContext multi-turn\n\n // Security - Pattern Detection (optional)\n \"command_injection_detected\"?: Bool,\n \"command_injection_type\"?: String,\n \"command_injection_score\"?: Long, // 0-100\n \"path_traversal_detected\"?: Bool,\n \"path_traversal_severity\"?: String,\n \"path_traversal_type\"?: String,\n \"sql_injection_detected\"?: Bool,\n \"sql_injection_type\"?: String,\n \"sql_injection_score\"?: Long, // 0-100\n\n // Security - Cross-Origin Escalation (optional)\n \"cross_origin_detected\"?: Bool,\n \"cross_origin_type\"?: String,\n \"cross_origin_score\"?: Long, // 0-100\n\n // File & Path (optional \u2014 for path-based access control policies)\n \"path\"?: String, // File path when tool operates on files\n\n // Security - Invisible Character Detection in tool args (optional)\n \"contains_invisible_chars\"?: Bool, // Whether invisible Unicode chars detected in tool args\n \"invisible_chars_score\"?: Long, // Invisible character attack severity (0-100)\n\n // Security - Encoded Injection (optional)\n \"encoded_content_detected\"?: Bool,\n \"encoded_types\"?: Set<String>,\n \"encoded_count\"?: Long,\n \"encoded_score\"?: Long, // 0-100\n\n // Agentic - Agent Security (optional)\n \"tool_poisoning_detected\"?: Bool,\n \"tool_poisoning_score\"?: Long, // 0-100\n \"tool_poisoning_type\"?: String, // \"hidden_instructions\" | \"system_prompt_injection\" | \"authority_hijack\"\n \"rug_pull_detected\"?: Bool,\n \"rug_pull_score\"?: Long, // 0-100\n \"rug_pull_type\"?: String, // \"risk_spike\" | \"pattern_change\" | \"combined\" | \"none\"\n\n // Agentic - Indirect Prompt Injection (optional \u2014 injection via tool outputs/retrieved content)\n \"indirect_injection_score\"?: Long, // Indirect injection risk score (0-100)\n \"indirect_injection_type\"?: String, // Type of indirect injection detected\n\n // Agentic - MCP Risk (optional)\n \"mcp_config_risk\"?: Bool,\n \"mcp_risk_type\"?: String, // \"inline_execution\" | \"suspicious_url\" | \"cross_origin\"\n \"mcp_risk_score\"?: Long, // 0-100\n\n // Agentic - Multi-Turn Context (optional)\n \"conversation_turn\"?: Long,\n \"multi_turn_detection\"?: Bool,\n\n // Session Detection History \u2014 cross-turn sticky flags (optional)\n \"session_pii_detected\"?: Bool,\n \"session_pii_types\"?: Set<String>,\n \"session_secrets_detected\"?: Bool,\n \"session_secret_types\"?: Set<String>,\n \"session_injection_detected\"?: Bool,\n \"session_command_injection\"?: Bool,\n \"session_threat_turns\"?: Long,\n \"session_max_injection_score\"?: Long,\n \"session_max_jailbreak_score\"?: Long,\n \"session_max_command_injection_score\"?: Long,\n \"session_max_pii_score\"?: Long,\n \"session_max_secret_score\"?: Long,\n \"session_cumulative_risk_score\"?: Long,\n\n // Agent Identity \u2014 authenticated agent principal metadata (optional)\n \"agent_id\"?: String,\n \"agent_type\"?: String,\n \"agent_trust_level\"?: String,\n \"agent_framework\"?: String,\n \"agent_publisher\"?: String,\n\n };\n\n /// Context for read_file action\n type FileReadContext = {\n // Core metadata (required)\n \"request_id\": String,\n \"timestamp\": Long,\n\n // File path (optional \u2014 for path-based access control policies)\n \"path\"?: String, // File path being read\n\n // Security checks on file content (optional)\n \"contains_secrets\"?: Bool,\n \"secret_count\"?: Long,\n \"secret_types\"?: Set<String>,\n \"pii_detected\"?: Bool,\n \"pii_types\"?: Set<String>,\n\n // Security - Path Traversal (optional)\n \"path_traversal_detected\"?: Bool,\n \"path_traversal_severity\"?: String,\n \"path_traversal_type\"?: String,\n\n // Session Detection History \u2014 cross-turn sticky flags (optional)\n \"session_pii_detected\"?: Bool,\n \"session_pii_types\"?: Set<String>,\n \"session_secrets_detected\"?: Bool,\n \"session_secret_types\"?: Set<String>,\n \"session_injection_detected\"?: Bool,\n \"session_command_injection\"?: Bool,\n \"session_threat_turns\"?: Long,\n \"session_max_injection_score\"?: Long,\n \"session_max_jailbreak_score\"?: Long,\n \"session_max_command_injection_score\"?: Long,\n \"session_max_pii_score\"?: Long,\n \"session_max_secret_score\"?: Long,\n \"session_cumulative_risk_score\"?: Long,\n\n // Agent Identity \u2014 authenticated agent principal metadata (optional)\n \"agent_id\"?: String,\n \"agent_type\"?: String,\n \"agent_trust_level\"?: String,\n \"agent_framework\"?: String,\n \"agent_publisher\"?: String,\n\n };\n\n /// Context for write_file action\n type FileWriteContext = {\n // Core metadata (required)\n \"request_id\": String,\n \"timestamp\": Long,\n\n // File path (optional \u2014 for path-based access control policies)\n \"path\"?: String, // File path being written\n\n // Security - Invisible Character Detection in write content (optional)\n \"contains_invisible_chars\"?: Bool, // Whether invisible Unicode chars detected in write content\n \"invisible_chars_score\"?: Long, // Invisible character attack severity (0-100)\n\n // Security checks on content being written (optional)\n \"contains_secrets\"?: Bool,\n \"secret_count\"?: Long,\n \"secret_types\"?: Set<String>,\n \"pii_detected\"?: Bool,\n \"pii_types\"?: Set<String>,\n\n // Security - Path Traversal (optional)\n \"path_traversal_detected\"?: Bool,\n \"path_traversal_severity\"?: String,\n \"path_traversal_type\"?: String,\n\n // Session Detection History \u2014 cross-turn sticky flags (optional)\n \"session_pii_detected\"?: Bool,\n \"session_pii_types\"?: Set<String>,\n \"session_secrets_detected\"?: Bool,\n \"session_secret_types\"?: Set<String>,\n \"session_injection_detected\"?: Bool,\n \"session_command_injection\"?: Bool,\n \"session_threat_turns\"?: Long,\n \"session_max_injection_score\"?: Long,\n \"session_max_jailbreak_score\"?: Long,\n \"session_max_command_injection_score\"?: Long,\n \"session_max_pii_score\"?: Long,\n \"session_max_secret_score\"?: Long,\n \"session_cumulative_risk_score\"?: Long,\n\n // Agent Identity \u2014 authenticated agent principal metadata (optional)\n \"agent_id\"?: String,\n \"agent_type\"?: String,\n \"agent_trust_level\"?: String,\n \"agent_framework\"?: String,\n \"agent_publisher\"?: String,\n\n };\n\n /// Context for connect_server action (MCP server connections)\n type ConnectServerContext = {\n // Core metadata (required)\n \"request_id\": String,\n \"timestamp\": Long,\n\n // MCP context (optional)\n \"mcp_server\"?: String, // MCP server name (e.g., \"github\", \"filesystem\")\n \"mcp_server_verified\"?: Bool, // Whether server is from verified registry\n\n // Agentic - Agent Security (optional)\n \"tool_poisoning_detected\"?: Bool,\n \"tool_poisoning_score\"?: Long,\n \"tool_poisoning_type\"?: String,\n\n // Agentic - MCP Risk (optional)\n \"mcp_config_risk\"?: Bool,\n \"mcp_risk_type\"?: String,\n \"mcp_risk_score\"?: Long,\n\n // Security - Cross-Origin Escalation (optional)\n \"cross_origin_detected\"?: Bool,\n \"cross_origin_type\"?: String,\n \"cross_origin_score\"?: Long,\n\n // Session Detection History \u2014 cross-turn sticky flags (optional)\n \"session_pii_detected\"?: Bool,\n \"session_pii_types\"?: Set<String>,\n \"session_secrets_detected\"?: Bool,\n \"session_secret_types\"?: Set<String>,\n \"session_injection_detected\"?: Bool,\n \"session_command_injection\"?: Bool,\n \"session_threat_turns\"?: Long,\n \"session_max_injection_score\"?: Long,\n \"session_max_jailbreak_score\"?: Long,\n \"session_max_command_injection_score\"?: Long,\n \"session_max_pii_score\"?: Long,\n \"session_max_secret_score\"?: Long,\n \"session_cumulative_risk_score\"?: Long,\n\n // Agent Identity \u2014 authenticated agent principal metadata (optional)\n \"agent_id\"?: String,\n \"agent_type\"?: String,\n \"agent_trust_level\"?: String,\n \"agent_framework\"?: String,\n \"agent_publisher\"?: String,\n\n };\n}\n";
7
+ /**
8
+ * McpGateway Cedar schema
9
+ *
10
+ * Full Cedar schema for mcp_gateway, embedded at codegen time.
11
+ */
12
+ export declare const MCP_GATEWAY_SCHEMA = "// MCPGateway Cedar Schema\n// ===================================\n// MCP Gateway Security & Policy Enforcement\n//\n// MCPGateway protects MCP proxy operations (tool calls, server connections)\n// by evaluating threats detected by the Shield detection engine pipeline\n// against Cedar policies.\n//\n// Architecture:\n// MCP Client -> Firehog Proxy -> Shield (detection + Cedar) -> Allow/Deny\n//\n// Threat Coverage:\n// - OWASP Top 10 for LLM Applications 2025 (LLM01, LLM06)\n// - OWASP Top 10 for Agentic Applications (ASI01, ASI02, ASI04)\n// - OWASP MCP Top 10 (MCP01-MCP05)\n\nnamespace MCPGateway {\n\n// =============================================================================\n// ENTITIES - Tenant Hierarchy (ReBAC)\n// =============================================================================\n// MCPGateway does not use App/Session hierarchy.\n//\n// Entity hierarchy:\n// Account (org root)\n// -> Project in [Account]\n// -> Tool/Server in [Project]\n//\n// Policy scoping examples:\n// resource == MCPGateway::Tool::\"get_me\" -> specific tool\n// resource in MCPGateway::Project::\"<uuid>\" -> project-wide\n// resource in MCPGateway::Account::\"<uuid>\" -> org-wide\n\n/// Account represents an organization (top-level tenant)\nentity Account;\n\n/// Project represents a project within an account\nentity Project in [Account];\n\n// =============================================================================\n// ENTITIES - Principals\n// =============================================================================\n\n/// Human user authenticated via JWT or API key\nentity User;\n\n/// MCP client (default principal for unauthenticated requests)\nentity MCP_Client;\n\n// =============================================================================\n// ENTITIES - Resources (scoped under Project)\n// =============================================================================\n\n/// MCP tool -- resource for call_tool action\nentity Tool in [Project];\n\n/// MCP server -- resource for connect_server action\nentity Server in [Project];\n\n/// MCP prompt -- resource for process_prompt action\nentity LlmPrompt in [Project];\n\n/// File/resource path -- resource for read_file/write_file actions\nentity FilePath in [Project];\n\n// =============================================================================\n// ACTIONS\n// =============================================================================\n\n// Call an MCP tool\n// Threat focus: command injection, tool poisoning, rug pull, secrets, PII\naction call_tool appliesTo {\n principal: [User, MCP_Client],\n resource: [Tool],\n context: {\n // --- Content ---\n content: String, // Raw content being scanned\n\n // --- Tool & MCP ---\n tool_name?: String, // Tool name\n mcp_server?: String, // MCP server name\n mcp_tool?: String, // MCP tool name\n\n // --- Threat Detection (from Shield detection pipeline) ---\n threat_count?: Long, // Total threats detected\n highest_severity?: String, // \"critical\", \"high\", \"medium\", \"low\", \"none\"\n threat_categories?: Set<String>, // Threat category names\n detected_threats?: Set<String>, // Detection rule names that matched\n max_threat_severity?: Long, // Numeric severity (0=none, 1=low, 2=medium, 3=high, 4=critical)\n contains_secrets?: Bool, // Whether secrets/credentials detected\n\n // --- Secrets (granular) ---\n secret_types?: Set<String>,\n secret_count?: Long,\n\n // --- PII Detection ---\n pii_detected?: Bool,\n pii_types?: Set<String>,\n pii_count?: Long,\n\n // --- ML Detector Confidence Scores (0-100) ---\n injection_confidence?: Long, // Prompt injection classifier confidence\n jailbreak_confidence?: Long, // Jailbreak detection classifier confidence\n\n // --- Agent Security (0-100) ---\n tool_poisoning_score?: Long, // Hidden instructions in tool description/args\n tool_poisoning_detected?: Bool,\n rug_pull_score?: Long, // Tool behavior drift after trust establishment\n rug_pull_detected?: Bool,\n indirect_injection_score?: Long, // Indirect injection via tool output\n\n // --- Tool Risk Assessment ---\n tool_risk_score?: Long, // Computed tool risk (0-100)\n tool_category?: String, // \"safe\", \"sensitive\", \"dangerous\"\n tool_is_sensitive?: Bool,\n tool_is_builtin?: Bool,\n\n // --- MCP Trust ---\n mcp_server_verified?: Bool, // Whether server is from verified registry\n\n // --- Content Safety Scores (0-100) ---\n violence_score?: Long,\n weapons_score?: Long,\n hate_speech_score?: Long,\n crime_score?: Long,\n sexual_score?: Long,\n profanity_score?: Long,\n\n // --- Encoding & Unicode Attacks ---\n contains_invisible_chars?: Bool,\n invisible_chars_score?: Long,\n\n // --- Behavioral Analysis ---\n loop_detected?: Bool,\n loop_count?: Long,\n loop_tool?: String,\n suspicious_pattern?: Bool,\n pattern_type?: String,\n sequence_risk?: Long,\n },\n};\n\n// Connect to an MCP server\n// Threat focus: supply chain, tool poisoning, rug pull, config risk\naction connect_server appliesTo {\n principal: [User, MCP_Client],\n resource: [Server],\n context: {\n content?: String, // Server config content (if available)\n mcp_server?: String,\n\n // --- Threat Detection ---\n threat_count?: Long,\n highest_severity?: String,\n threat_categories?: Set<String>,\n max_threat_severity?: Long,\n\n // --- Agent Security (0-100) ---\n tool_poisoning_score?: Long,\n tool_poisoning_detected?: Bool,\n rug_pull_score?: Long,\n rug_pull_detected?: Bool,\n indirect_injection_score?: Long,\n\n // --- MCP Trust & Config Risk ---\n mcp_server_verified?: Bool,\n mcp_config_risk?: Bool,\n mcp_risk_score?: Long,\n },\n};\n\n// Process an MCP prompt (prompts/get, prompts/list)\n// Threat focus: injection, jailbreak, secrets, PII, content safety\naction process_prompt appliesTo {\n principal: [User, MCP_Client],\n resource: [LlmPrompt],\n context: {\n content: String,\n mcp_server?: String,\n\n // --- Threat Detection ---\n threat_count?: Long,\n highest_severity?: String,\n threat_categories?: Set<String>,\n detected_threats?: Set<String>,\n max_threat_severity?: Long,\n contains_secrets?: Bool,\n\n // --- Secrets ---\n secret_types?: Set<String>,\n secret_count?: Long,\n\n // --- PII Detection ---\n pii_detected?: Bool,\n pii_types?: Set<String>,\n pii_count?: Long,\n\n // --- ML Detector Confidence Scores (0-100) ---\n injection_confidence?: Long,\n jailbreak_confidence?: Long,\n\n // --- Content Safety Scores (0-100) ---\n violence_score?: Long,\n weapons_score?: Long,\n hate_speech_score?: Long,\n crime_score?: Long,\n sexual_score?: Long,\n profanity_score?: Long,\n\n // --- Encoding ---\n contains_invisible_chars?: Bool,\n invisible_chars_score?: Long,\n },\n};\n\n// Read an MCP resource (resources/read, resources/list)\n// Threat focus: secrets exposure, PII exposure, sensitive paths\naction read_file appliesTo {\n principal: [User, MCP_Client],\n resource: [FilePath],\n context: {\n content: String,\n mcp_server?: String,\n\n // --- Threat Detection ---\n threat_count?: Long,\n highest_severity?: String,\n threat_categories?: Set<String>,\n detected_threats?: Set<String>,\n max_threat_severity?: Long,\n contains_secrets?: Bool,\n\n // --- Secrets ---\n secret_types?: Set<String>,\n secret_count?: Long,\n\n // --- PII Detection ---\n pii_detected?: Bool,\n pii_types?: Set<String>,\n pii_count?: Long,\n },\n};\n\n// Write an MCP resource (resources/write)\n// Threat focus: secrets in output, PII in output\naction write_file appliesTo {\n principal: [User, MCP_Client],\n resource: [FilePath],\n context: {\n content: String,\n mcp_server?: String,\n\n // --- Threat Detection ---\n threat_count?: Long,\n highest_severity?: String,\n threat_categories?: Set<String>,\n detected_threats?: Set<String>,\n max_threat_severity?: Long,\n contains_secrets?: Bool,\n\n // --- Secrets ---\n secret_types?: Set<String>,\n secret_count?: Long,\n\n // --- PII Detection ---\n pii_detected?: Bool,\n pii_types?: Set<String>,\n pii_count?: Long,\n },\n};\n\n}\n";
7
13
  /**
8
14
  * Overwatch Cedar schema
9
15
  *
@@ -47,6 +53,10 @@ export interface ServiceContext {
47
53
  * Guardrails context metadata (parsed JSON)
48
54
  */
49
55
  export declare const GUARDRAILS_CONTEXT: ServiceContext;
56
+ /**
57
+ * McpGateway context metadata (parsed JSON)
58
+ */
59
+ export declare const MCP_GATEWAY_CONTEXT: ServiceContext;
50
60
  /**
51
61
  * Overwatch context metadata (parsed JSON)
52
62
  */
@@ -1,11 +1,12 @@
1
1
  // Code generated by highflame-policy-codegen. DO NOT EDIT.
2
- // Source: schemas/guardrails/schema.cedarschema, schemas/overwatch/schema.cedarschema, schemas/palisade/schema.cedarschema, schemas/sentry/schema.cedarschema
2
+ // Source: schemas/guardrails/schema.cedarschema, schemas/mcp_gateway/schema.cedarschema, schemas/overwatch/schema.cedarschema, schemas/palisade/schema.cedarschema, schemas/sentry/schema.cedarschema
3
3
  //
4
4
  // Service-specific Cedar schemas and context metadata.
5
5
  // Works in both browser and Node.js environments.
6
6
  //
7
7
  // Usage:
8
8
  // import { GUARDRAILS_SCHEMA, GUARDRAILS_CONTEXT } from '@highflame/policy/types';
9
+ // import { MCP_GATEWAY_SCHEMA, MCP_GATEWAY_CONTEXT } from '@highflame/policy/types';
9
10
  // import { OVERWATCH_SCHEMA, OVERWATCH_CONTEXT } from '@highflame/policy/types';
10
11
  // import { PALISADE_SCHEMA, PALISADE_CONTEXT } from '@highflame/policy/types';
11
12
  // import { SENTRY_SCHEMA, SENTRY_CONTEXT } from '@highflame/policy/types';
@@ -497,6 +498,284 @@ namespace Guardrails {
497
498
  "agent_publisher"?: String,
498
499
 
499
500
  };
501
+ }
502
+ `;
503
+ /**
504
+ * McpGateway Cedar schema
505
+ *
506
+ * Full Cedar schema for mcp_gateway, embedded at codegen time.
507
+ */
508
+ export const MCP_GATEWAY_SCHEMA = `// MCPGateway Cedar Schema
509
+ // ===================================
510
+ // MCP Gateway Security & Policy Enforcement
511
+ //
512
+ // MCPGateway protects MCP proxy operations (tool calls, server connections)
513
+ // by evaluating threats detected by the Shield detection engine pipeline
514
+ // against Cedar policies.
515
+ //
516
+ // Architecture:
517
+ // MCP Client -> Firehog Proxy -> Shield (detection + Cedar) -> Allow/Deny
518
+ //
519
+ // Threat Coverage:
520
+ // - OWASP Top 10 for LLM Applications 2025 (LLM01, LLM06)
521
+ // - OWASP Top 10 for Agentic Applications (ASI01, ASI02, ASI04)
522
+ // - OWASP MCP Top 10 (MCP01-MCP05)
523
+
524
+ namespace MCPGateway {
525
+
526
+ // =============================================================================
527
+ // ENTITIES - Tenant Hierarchy (ReBAC)
528
+ // =============================================================================
529
+ // MCPGateway does not use App/Session hierarchy.
530
+ //
531
+ // Entity hierarchy:
532
+ // Account (org root)
533
+ // -> Project in [Account]
534
+ // -> Tool/Server in [Project]
535
+ //
536
+ // Policy scoping examples:
537
+ // resource == MCPGateway::Tool::"get_me" -> specific tool
538
+ // resource in MCPGateway::Project::"<uuid>" -> project-wide
539
+ // resource in MCPGateway::Account::"<uuid>" -> org-wide
540
+
541
+ /// Account represents an organization (top-level tenant)
542
+ entity Account;
543
+
544
+ /// Project represents a project within an account
545
+ entity Project in [Account];
546
+
547
+ // =============================================================================
548
+ // ENTITIES - Principals
549
+ // =============================================================================
550
+
551
+ /// Human user authenticated via JWT or API key
552
+ entity User;
553
+
554
+ /// MCP client (default principal for unauthenticated requests)
555
+ entity MCP_Client;
556
+
557
+ // =============================================================================
558
+ // ENTITIES - Resources (scoped under Project)
559
+ // =============================================================================
560
+
561
+ /// MCP tool -- resource for call_tool action
562
+ entity Tool in [Project];
563
+
564
+ /// MCP server -- resource for connect_server action
565
+ entity Server in [Project];
566
+
567
+ /// MCP prompt -- resource for process_prompt action
568
+ entity LlmPrompt in [Project];
569
+
570
+ /// File/resource path -- resource for read_file/write_file actions
571
+ entity FilePath in [Project];
572
+
573
+ // =============================================================================
574
+ // ACTIONS
575
+ // =============================================================================
576
+
577
+ // Call an MCP tool
578
+ // Threat focus: command injection, tool poisoning, rug pull, secrets, PII
579
+ action call_tool appliesTo {
580
+ principal: [User, MCP_Client],
581
+ resource: [Tool],
582
+ context: {
583
+ // --- Content ---
584
+ content: String, // Raw content being scanned
585
+
586
+ // --- Tool & MCP ---
587
+ tool_name?: String, // Tool name
588
+ mcp_server?: String, // MCP server name
589
+ mcp_tool?: String, // MCP tool name
590
+
591
+ // --- Threat Detection (from Shield detection pipeline) ---
592
+ threat_count?: Long, // Total threats detected
593
+ highest_severity?: String, // "critical", "high", "medium", "low", "none"
594
+ threat_categories?: Set<String>, // Threat category names
595
+ detected_threats?: Set<String>, // Detection rule names that matched
596
+ max_threat_severity?: Long, // Numeric severity (0=none, 1=low, 2=medium, 3=high, 4=critical)
597
+ contains_secrets?: Bool, // Whether secrets/credentials detected
598
+
599
+ // --- Secrets (granular) ---
600
+ secret_types?: Set<String>,
601
+ secret_count?: Long,
602
+
603
+ // --- PII Detection ---
604
+ pii_detected?: Bool,
605
+ pii_types?: Set<String>,
606
+ pii_count?: Long,
607
+
608
+ // --- ML Detector Confidence Scores (0-100) ---
609
+ injection_confidence?: Long, // Prompt injection classifier confidence
610
+ jailbreak_confidence?: Long, // Jailbreak detection classifier confidence
611
+
612
+ // --- Agent Security (0-100) ---
613
+ tool_poisoning_score?: Long, // Hidden instructions in tool description/args
614
+ tool_poisoning_detected?: Bool,
615
+ rug_pull_score?: Long, // Tool behavior drift after trust establishment
616
+ rug_pull_detected?: Bool,
617
+ indirect_injection_score?: Long, // Indirect injection via tool output
618
+
619
+ // --- Tool Risk Assessment ---
620
+ tool_risk_score?: Long, // Computed tool risk (0-100)
621
+ tool_category?: String, // "safe", "sensitive", "dangerous"
622
+ tool_is_sensitive?: Bool,
623
+ tool_is_builtin?: Bool,
624
+
625
+ // --- MCP Trust ---
626
+ mcp_server_verified?: Bool, // Whether server is from verified registry
627
+
628
+ // --- Content Safety Scores (0-100) ---
629
+ violence_score?: Long,
630
+ weapons_score?: Long,
631
+ hate_speech_score?: Long,
632
+ crime_score?: Long,
633
+ sexual_score?: Long,
634
+ profanity_score?: Long,
635
+
636
+ // --- Encoding & Unicode Attacks ---
637
+ contains_invisible_chars?: Bool,
638
+ invisible_chars_score?: Long,
639
+
640
+ // --- Behavioral Analysis ---
641
+ loop_detected?: Bool,
642
+ loop_count?: Long,
643
+ loop_tool?: String,
644
+ suspicious_pattern?: Bool,
645
+ pattern_type?: String,
646
+ sequence_risk?: Long,
647
+ },
648
+ };
649
+
650
+ // Connect to an MCP server
651
+ // Threat focus: supply chain, tool poisoning, rug pull, config risk
652
+ action connect_server appliesTo {
653
+ principal: [User, MCP_Client],
654
+ resource: [Server],
655
+ context: {
656
+ content?: String, // Server config content (if available)
657
+ mcp_server?: String,
658
+
659
+ // --- Threat Detection ---
660
+ threat_count?: Long,
661
+ highest_severity?: String,
662
+ threat_categories?: Set<String>,
663
+ max_threat_severity?: Long,
664
+
665
+ // --- Agent Security (0-100) ---
666
+ tool_poisoning_score?: Long,
667
+ tool_poisoning_detected?: Bool,
668
+ rug_pull_score?: Long,
669
+ rug_pull_detected?: Bool,
670
+ indirect_injection_score?: Long,
671
+
672
+ // --- MCP Trust & Config Risk ---
673
+ mcp_server_verified?: Bool,
674
+ mcp_config_risk?: Bool,
675
+ mcp_risk_score?: Long,
676
+ },
677
+ };
678
+
679
+ // Process an MCP prompt (prompts/get, prompts/list)
680
+ // Threat focus: injection, jailbreak, secrets, PII, content safety
681
+ action process_prompt appliesTo {
682
+ principal: [User, MCP_Client],
683
+ resource: [LlmPrompt],
684
+ context: {
685
+ content: String,
686
+ mcp_server?: String,
687
+
688
+ // --- Threat Detection ---
689
+ threat_count?: Long,
690
+ highest_severity?: String,
691
+ threat_categories?: Set<String>,
692
+ detected_threats?: Set<String>,
693
+ max_threat_severity?: Long,
694
+ contains_secrets?: Bool,
695
+
696
+ // --- Secrets ---
697
+ secret_types?: Set<String>,
698
+ secret_count?: Long,
699
+
700
+ // --- PII Detection ---
701
+ pii_detected?: Bool,
702
+ pii_types?: Set<String>,
703
+ pii_count?: Long,
704
+
705
+ // --- ML Detector Confidence Scores (0-100) ---
706
+ injection_confidence?: Long,
707
+ jailbreak_confidence?: Long,
708
+
709
+ // --- Content Safety Scores (0-100) ---
710
+ violence_score?: Long,
711
+ weapons_score?: Long,
712
+ hate_speech_score?: Long,
713
+ crime_score?: Long,
714
+ sexual_score?: Long,
715
+ profanity_score?: Long,
716
+
717
+ // --- Encoding ---
718
+ contains_invisible_chars?: Bool,
719
+ invisible_chars_score?: Long,
720
+ },
721
+ };
722
+
723
+ // Read an MCP resource (resources/read, resources/list)
724
+ // Threat focus: secrets exposure, PII exposure, sensitive paths
725
+ action read_file appliesTo {
726
+ principal: [User, MCP_Client],
727
+ resource: [FilePath],
728
+ context: {
729
+ content: String,
730
+ mcp_server?: String,
731
+
732
+ // --- Threat Detection ---
733
+ threat_count?: Long,
734
+ highest_severity?: String,
735
+ threat_categories?: Set<String>,
736
+ detected_threats?: Set<String>,
737
+ max_threat_severity?: Long,
738
+ contains_secrets?: Bool,
739
+
740
+ // --- Secrets ---
741
+ secret_types?: Set<String>,
742
+ secret_count?: Long,
743
+
744
+ // --- PII Detection ---
745
+ pii_detected?: Bool,
746
+ pii_types?: Set<String>,
747
+ pii_count?: Long,
748
+ },
749
+ };
750
+
751
+ // Write an MCP resource (resources/write)
752
+ // Threat focus: secrets in output, PII in output
753
+ action write_file appliesTo {
754
+ principal: [User, MCP_Client],
755
+ resource: [FilePath],
756
+ context: {
757
+ content: String,
758
+ mcp_server?: String,
759
+
760
+ // --- Threat Detection ---
761
+ threat_count?: Long,
762
+ highest_severity?: String,
763
+ threat_categories?: Set<String>,
764
+ detected_threats?: Set<String>,
765
+ max_threat_severity?: Long,
766
+ contains_secrets?: Bool,
767
+
768
+ // --- Secrets ---
769
+ secret_types?: Set<String>,
770
+ secret_count?: Long,
771
+
772
+ // --- PII Detection ---
773
+ pii_detected?: Bool,
774
+ pii_types?: Set<String>,
775
+ pii_count?: Long,
776
+ },
777
+ };
778
+
500
779
  }
501
780
  `;
502
781
  /**
@@ -1778,6 +2057,149 @@ export const GUARDRAILS_CONTEXT = {
1778
2057
  }
1779
2058
  ]
1780
2059
  };
2060
+ /**
2061
+ * McpGateway context metadata (parsed JSON)
2062
+ */
2063
+ export const MCP_GATEWAY_CONTEXT = {
2064
+ "service": "mcp_gateway",
2065
+ "version": "1.0.0",
2066
+ "description": "Context attributes for MCPGateway Cedar policies",
2067
+ "actions": [
2068
+ {
2069
+ "name": "call_tool",
2070
+ "description": "Call an MCP tool — threat focus: command injection, tool poisoning, rug pull, secrets, PII",
2071
+ "context_attributes": [
2072
+ { "key": "content", "type": "string", "required": true, "description": "Raw content being scanned" },
2073
+ { "key": "tool_name", "type": "string", "required": false, "description": "Tool name" },
2074
+ { "key": "mcp_server", "type": "string", "required": false, "description": "MCP server name" },
2075
+ { "key": "mcp_tool", "type": "string", "required": false, "description": "MCP tool name" },
2076
+ { "key": "threat_count", "type": "number", "required": false, "description": "Total threats detected" },
2077
+ { "key": "highest_severity", "type": "string", "required": false, "description": "Highest threat severity" },
2078
+ { "key": "threat_categories", "type": "array", "required": false, "description": "Threat category names" },
2079
+ { "key": "detected_threats", "type": "array", "required": false, "description": "Detection rule names that matched" },
2080
+ { "key": "max_threat_severity", "type": "number", "required": false, "description": "Numeric severity (0-4)" },
2081
+ { "key": "contains_secrets", "type": "boolean", "required": false, "description": "Whether secrets/credentials detected" },
2082
+ { "key": "secret_types", "type": "array", "required": false, "description": "Types of secrets found" },
2083
+ { "key": "secret_count", "type": "number", "required": false, "description": "Number of distinct secrets" },
2084
+ { "key": "pii_detected", "type": "boolean", "required": false, "description": "Whether PII detected" },
2085
+ { "key": "pii_types", "type": "array", "required": false, "description": "Types of PII detected" },
2086
+ { "key": "pii_count", "type": "number", "required": false, "description": "Number of PII matches" },
2087
+ { "key": "injection_confidence", "type": "number", "required": false, "description": "Injection classifier confidence (0-100)" },
2088
+ { "key": "jailbreak_confidence", "type": "number", "required": false, "description": "Jailbreak classifier confidence (0-100)" },
2089
+ { "key": "tool_poisoning_score", "type": "number", "required": false, "description": "Tool poisoning risk score (0-100)" },
2090
+ { "key": "tool_poisoning_detected", "type": "boolean", "required": false, "description": "Tool poisoning detected flag" },
2091
+ { "key": "rug_pull_score", "type": "number", "required": false, "description": "Rug pull risk score (0-100)" },
2092
+ { "key": "rug_pull_detected", "type": "boolean", "required": false, "description": "Rug pull detected flag" },
2093
+ { "key": "indirect_injection_score", "type": "number", "required": false, "description": "Indirect injection score (0-100)" },
2094
+ { "key": "tool_risk_score", "type": "number", "required": false, "description": "Computed tool risk (0-100)" },
2095
+ { "key": "tool_category", "type": "string", "required": false, "description": "Tool category: safe/sensitive/dangerous" },
2096
+ { "key": "tool_is_sensitive", "type": "boolean", "required": false, "description": "Tool sensitivity flag" },
2097
+ { "key": "tool_is_builtin", "type": "boolean", "required": false, "description": "Built-in tool flag" },
2098
+ { "key": "mcp_server_verified", "type": "boolean", "required": false, "description": "Whether server is from verified registry" },
2099
+ { "key": "violence_score", "type": "number", "required": false, "description": "Violence content score (0-100)" },
2100
+ { "key": "weapons_score", "type": "number", "required": false, "description": "Weapons content score (0-100)" },
2101
+ { "key": "hate_speech_score", "type": "number", "required": false, "description": "Hate speech score (0-100)" },
2102
+ { "key": "crime_score", "type": "number", "required": false, "description": "Crime content score (0-100)" },
2103
+ { "key": "sexual_score", "type": "number", "required": false, "description": "Sexual content score (0-100)" },
2104
+ { "key": "profanity_score", "type": "number", "required": false, "description": "Profanity score (0-100)" },
2105
+ { "key": "contains_invisible_chars", "type": "boolean", "required": false, "description": "Invisible Unicode chars detected" },
2106
+ { "key": "invisible_chars_score", "type": "number", "required": false, "description": "Unicode attack severity (0-100)" },
2107
+ { "key": "loop_detected", "type": "boolean", "required": false, "description": "Tool call loop detected" },
2108
+ { "key": "loop_count", "type": "number", "required": false, "description": "Consecutive repeat calls" },
2109
+ { "key": "suspicious_pattern", "type": "boolean", "required": false, "description": "Data exfiltration or attack sequence detected" },
2110
+ { "key": "pattern_type", "type": "string", "required": false, "description": "Pattern type" },
2111
+ { "key": "sequence_risk", "type": "number", "required": false, "description": "Sequence risk score (0-100)" }
2112
+ ]
2113
+ },
2114
+ {
2115
+ "name": "connect_server",
2116
+ "description": "Connect to an MCP server — threat focus: supply chain, tool poisoning, config risk",
2117
+ "context_attributes": [
2118
+ { "key": "content", "type": "string", "required": false, "description": "Server config content" },
2119
+ { "key": "mcp_server", "type": "string", "required": false, "description": "MCP server name" },
2120
+ { "key": "threat_count", "type": "number", "required": false, "description": "Total threats detected" },
2121
+ { "key": "highest_severity", "type": "string", "required": false, "description": "Highest threat severity" },
2122
+ { "key": "threat_categories", "type": "array", "required": false, "description": "Threat category names" },
2123
+ { "key": "max_threat_severity", "type": "number", "required": false, "description": "Numeric severity (0-4)" },
2124
+ { "key": "tool_poisoning_score", "type": "number", "required": false, "description": "Tool poisoning risk (0-100)" },
2125
+ { "key": "tool_poisoning_detected", "type": "boolean", "required": false, "description": "Tool poisoning detected" },
2126
+ { "key": "rug_pull_score", "type": "number", "required": false, "description": "Rug pull risk (0-100)" },
2127
+ { "key": "rug_pull_detected", "type": "boolean", "required": false, "description": "Rug pull detected" },
2128
+ { "key": "indirect_injection_score", "type": "number", "required": false, "description": "Indirect injection score (0-100)" },
2129
+ { "key": "mcp_server_verified", "type": "boolean", "required": false, "description": "Verified registry status" },
2130
+ { "key": "mcp_config_risk", "type": "boolean", "required": false, "description": "Risky server config detected" },
2131
+ { "key": "mcp_risk_score", "type": "number", "required": false, "description": "Config risk severity (0-100)" }
2132
+ ]
2133
+ },
2134
+ {
2135
+ "name": "process_prompt",
2136
+ "description": "Process an MCP prompt — threat focus: injection, jailbreak, secrets, PII, content safety",
2137
+ "context_attributes": [
2138
+ { "key": "content", "type": "string", "required": true, "description": "Raw content being scanned" },
2139
+ { "key": "mcp_server", "type": "string", "required": false, "description": "MCP server name" },
2140
+ { "key": "threat_count", "type": "number", "required": false, "description": "Total threats detected" },
2141
+ { "key": "highest_severity", "type": "string", "required": false, "description": "Highest threat severity" },
2142
+ { "key": "threat_categories", "type": "array", "required": false, "description": "Threat category names" },
2143
+ { "key": "detected_threats", "type": "array", "required": false, "description": "Detection rule names that matched" },
2144
+ { "key": "max_threat_severity", "type": "number", "required": false, "description": "Numeric severity (0-4)" },
2145
+ { "key": "contains_secrets", "type": "boolean", "required": false, "description": "Whether secrets/credentials detected" },
2146
+ { "key": "secret_types", "type": "array", "required": false, "description": "Types of secrets found" },
2147
+ { "key": "secret_count", "type": "number", "required": false, "description": "Number of distinct secrets" },
2148
+ { "key": "pii_detected", "type": "boolean", "required": false, "description": "Whether PII detected" },
2149
+ { "key": "pii_types", "type": "array", "required": false, "description": "Types of PII detected" },
2150
+ { "key": "pii_count", "type": "number", "required": false, "description": "Number of PII matches" },
2151
+ { "key": "injection_confidence", "type": "number", "required": false, "description": "Injection classifier confidence (0-100)" },
2152
+ { "key": "jailbreak_confidence", "type": "number", "required": false, "description": "Jailbreak classifier confidence (0-100)" },
2153
+ { "key": "violence_score", "type": "number", "required": false, "description": "Violence content score (0-100)" },
2154
+ { "key": "weapons_score", "type": "number", "required": false, "description": "Weapons content score (0-100)" },
2155
+ { "key": "hate_speech_score", "type": "number", "required": false, "description": "Hate speech score (0-100)" },
2156
+ { "key": "crime_score", "type": "number", "required": false, "description": "Crime content score (0-100)" },
2157
+ { "key": "sexual_score", "type": "number", "required": false, "description": "Sexual content score (0-100)" },
2158
+ { "key": "profanity_score", "type": "number", "required": false, "description": "Profanity score (0-100)" },
2159
+ { "key": "contains_invisible_chars", "type": "boolean", "required": false, "description": "Invisible Unicode chars detected" },
2160
+ { "key": "invisible_chars_score", "type": "number", "required": false, "description": "Unicode attack severity (0-100)" }
2161
+ ]
2162
+ },
2163
+ {
2164
+ "name": "read_file",
2165
+ "description": "Read an MCP resource — threat focus: secrets exposure, PII exposure",
2166
+ "context_attributes": [
2167
+ { "key": "content", "type": "string", "required": true, "description": "Raw content being scanned" },
2168
+ { "key": "mcp_server", "type": "string", "required": false, "description": "MCP server name" },
2169
+ { "key": "threat_count", "type": "number", "required": false, "description": "Total threats detected" },
2170
+ { "key": "highest_severity", "type": "string", "required": false, "description": "Highest threat severity" },
2171
+ { "key": "threat_categories", "type": "array", "required": false, "description": "Threat category names" },
2172
+ { "key": "detected_threats", "type": "array", "required": false, "description": "Detection rule names that matched" },
2173
+ { "key": "max_threat_severity", "type": "number", "required": false, "description": "Numeric severity (0-4)" },
2174
+ { "key": "contains_secrets", "type": "boolean", "required": false, "description": "Whether secrets/credentials detected" },
2175
+ { "key": "secret_types", "type": "array", "required": false, "description": "Types of secrets found" },
2176
+ { "key": "secret_count", "type": "number", "required": false, "description": "Number of distinct secrets" },
2177
+ { "key": "pii_detected", "type": "boolean", "required": false, "description": "Whether PII detected" },
2178
+ { "key": "pii_types", "type": "array", "required": false, "description": "Types of PII detected" },
2179
+ { "key": "pii_count", "type": "number", "required": false, "description": "Number of PII matches" }
2180
+ ]
2181
+ },
2182
+ {
2183
+ "name": "write_file",
2184
+ "description": "Write an MCP resource — threat focus: secrets in output, PII in output",
2185
+ "context_attributes": [
2186
+ { "key": "content", "type": "string", "required": true, "description": "Raw content being scanned" },
2187
+ { "key": "mcp_server", "type": "string", "required": false, "description": "MCP server name" },
2188
+ { "key": "threat_count", "type": "number", "required": false, "description": "Total threats detected" },
2189
+ { "key": "highest_severity", "type": "string", "required": false, "description": "Highest threat severity" },
2190
+ { "key": "threat_categories", "type": "array", "required": false, "description": "Threat category names" },
2191
+ { "key": "detected_threats", "type": "array", "required": false, "description": "Detection rule names that matched" },
2192
+ { "key": "max_threat_severity", "type": "number", "required": false, "description": "Numeric severity (0-4)" },
2193
+ { "key": "contains_secrets", "type": "boolean", "required": false, "description": "Whether secrets/credentials detected" },
2194
+ { "key": "secret_types", "type": "array", "required": false, "description": "Types of secrets found" },
2195
+ { "key": "secret_count", "type": "number", "required": false, "description": "Number of distinct secrets" },
2196
+ { "key": "pii_detected", "type": "boolean", "required": false, "description": "Whether PII detected" },
2197
+ { "key": "pii_types", "type": "array", "required": false, "description": "Types of PII detected" },
2198
+ { "key": "pii_count", "type": "number", "required": false, "description": "Number of PII matches" }
2199
+ ]
2200
+ }
2201
+ ]
2202
+ };
1781
2203
  /**
1782
2204
  * Overwatch context metadata (parsed JSON)
1783
2205
  */
package/dist/types.d.ts CHANGED
@@ -7,19 +7,23 @@ export * from './errors.js';
7
7
  export * from './annotations.js';
8
8
  export * from './explain.js';
9
9
  export * from './condition-groups.js';
10
- export { GUARDRAILS_SCHEMA, GUARDRAILS_CONTEXT, OVERWATCH_SCHEMA, OVERWATCH_CONTEXT, PALISADE_SCHEMA, PALISADE_CONTEXT, SENTRY_SCHEMA, SENTRY_CONTEXT, } from './service-schemas.gen.js';
10
+ export { GUARDRAILS_SCHEMA, GUARDRAILS_CONTEXT, MCP_GATEWAY_SCHEMA, MCP_GATEWAY_CONTEXT, OVERWATCH_SCHEMA, OVERWATCH_CONTEXT, PALISADE_SCHEMA, PALISADE_CONTEXT, SENTRY_SCHEMA, SENTRY_CONTEXT, } from './service-schemas.gen.js';
11
11
  export type { ContextAttribute, ActionContext, ServiceContext, } from './service-schemas.gen.js';
12
12
  export { GuardrailsContextKey } from './guardrails-context.gen.js';
13
+ export { McpGatewayContextKey } from './mcp_gateway-context.gen.js';
13
14
  export { OverwatchContextKey } from './overwatch-context.gen.js';
14
15
  export { PalisadeContextKey } from './palisade-context.gen.js';
15
16
  export { SentryContextKey } from './sentry-context.gen.js';
16
17
  export { GUARDRAILS_ENTITIES, GUARDRAILS_ACTION_ENTITIES, } from './guardrails-entities.gen.js';
18
+ export { MCP_GATEWAY_ENTITIES, MCP_GATEWAY_ACTION_ENTITIES, } from './mcp_gateway-entities.gen.js';
17
19
  export { OVERWATCH_ENTITIES, OVERWATCH_ACTION_ENTITIES, } from './overwatch-entities.gen.js';
18
20
  export { PALISADE_ENTITIES, PALISADE_ACTION_ENTITIES, } from './palisade-entities.gen.js';
19
21
  export { SENTRY_ENTITIES, SENTRY_ACTION_ENTITIES, } from './sentry-entities.gen.js';
20
22
  export type { ServiceEntityMetadata, ActionEntityMetadata } from './entity-metadata-types.gen.js';
21
23
  export { GUARDRAILS_DEFAULTS, GUARDRAILS_TEMPLATES, GUARDRAILS_CATEGORIES, GUARDRAILS_TEMPLATES_JSON, getGuardrailsDefaultsByCategory, getGuardrailsTemplatesByCategory, getGuardrailsTemplateById, } from './guardrails-defaults.gen.js';
22
24
  export type { GuardrailsCategory, GuardrailsCategoryInfo, GuardrailsDefaultPolicy, GuardrailsTemplate, } from './guardrails-defaults.gen.js';
25
+ export { MCP_GATEWAY_DEFAULTS, MCP_GATEWAY_TEMPLATES, MCP_GATEWAY_CATEGORIES, MCP_GATEWAY_TEMPLATES_JSON, getMcpGatewayDefaultsByCategory, getMcpGatewayTemplatesByCategory, getMcpGatewayTemplateById, } from './mcp_gateway-defaults.gen.js';
26
+ export type { McpGatewayCategory, McpGatewayCategoryInfo, McpGatewayDefaultPolicy, McpGatewayTemplate, } from './mcp_gateway-defaults.gen.js';
23
27
  export { OVERWATCH_DEFAULTS, OVERWATCH_TEMPLATES, OVERWATCH_CATEGORIES, OVERWATCH_TEMPLATES_JSON, getOverwatchDefaultsByCategory, getOverwatchTemplatesByCategory, getOverwatchTemplateById, } from './overwatch-defaults.gen.js';
24
28
  export type { OverwatchCategory, OverwatchCategoryInfo, OverwatchDefaultPolicy, OverwatchTemplate, } from './overwatch-defaults.gen.js';
25
29
  export { SENTRY_DEFAULTS, SENTRY_TEMPLATES, SENTRY_CATEGORIES, SENTRY_TEMPLATES_JSON, getSentryDefaultsByCategory, getSentryTemplatesByCategory, getSentryTemplateById, } from './sentry-defaults.gen.js';