@highflame/policy 2.1.7 → 2.1.8
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.
- package/_schemas/guardrails/context.json +78 -0
- package/_schemas/guardrails/schema.cedarschema +28 -1
- package/_schemas/guardrails/templates/profiles/a2a_security/cross_origin.cedar +105 -0
- package/_schemas/guardrails/templates/profiles/a2a_security/escalation_detection.cedar +113 -0
- package/_schemas/guardrails/templates/profiles/a2a_security/identity_enforcement.cedar +118 -0
- package/_schemas/guardrails/templates/profiles/a2a_security/inter_agent_injection.cedar +134 -0
- package/_schemas/guardrails/templates/profiles/a2a_security/supply_chain.cedar +117 -0
- package/_schemas/guardrails/templates/profiles/advanced_detection/pii.cedar +73 -0
- package/_schemas/guardrails/templates/profiles/advanced_detection/secrets.cedar +66 -0
- package/_schemas/guardrails/templates/profiles/advanced_detection/threat_severity.cedar +35 -0
- package/_schemas/guardrails/templates/profiles/code_agent/encoding.cedar +55 -0
- package/_schemas/guardrails/templates/profiles/code_agent/path_security.cedar +148 -0
- package/_schemas/guardrails/templates/profiles/code_agent/supply_chain.cedar +120 -0
- package/_schemas/guardrails/templates/templates.json +121 -6
- package/dist/guardrails-context.gen.d.ts +5 -0
- package/dist/guardrails-context.gen.js +5 -0
- package/dist/guardrails-defaults.gen.js +1315 -6
- package/dist/service-schemas.gen.d.ts +1 -1
- package/dist/service-schemas.gen.js +41 -1
- package/package.json +1 -1
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
// =============================================================================
|
|
2
|
+
// Code Agent — Supply Chain Security
|
|
3
|
+
// =============================================================================
|
|
4
|
+
// Detects and blocks MCP server poisoning, indirect prompt injection from tool
|
|
5
|
+
// outputs, credential theft chains, and destructive operation sequences.
|
|
6
|
+
//
|
|
7
|
+
// These are agentic AI-specific attack vectors where tool descriptions, server
|
|
8
|
+
// responses, or behavioral drift manipulate agent behavior.
|
|
9
|
+
//
|
|
10
|
+
// Adapted from Overwatch agent security and behavioral analysis policies for
|
|
11
|
+
// the Guardrails namespace.
|
|
12
|
+
//
|
|
13
|
+
// Compliance:
|
|
14
|
+
// OWASP ASI01 (Agent Goal Hijack)
|
|
15
|
+
// OWASP ASI02 (Tool Misuse)
|
|
16
|
+
// OWASP ASI04 (Supply Chain)
|
|
17
|
+
// OWASP LLM01 (Prompt Injection) — indirect variant
|
|
18
|
+
// OWASP MCP01-05
|
|
19
|
+
// MITRE ATLAS AML.T0051 (Prompt Injection)
|
|
20
|
+
// MITRE ATT&CK T1552 (Unsecured Credentials)
|
|
21
|
+
//
|
|
22
|
+
// Category: agentic_security
|
|
23
|
+
// Namespace: Guardrails
|
|
24
|
+
// =============================================================================
|
|
25
|
+
|
|
26
|
+
// ---------------------------------------------------------------------------
|
|
27
|
+
// Section 1: MCP Server Poisoning
|
|
28
|
+
// Blocks connections to MCP servers with poisoned tool descriptions.
|
|
29
|
+
// Lower threshold than tool-level poisoning since it affects all tools.
|
|
30
|
+
// ---------------------------------------------------------------------------
|
|
31
|
+
|
|
32
|
+
@id("code-block-server-poisoning")
|
|
33
|
+
@name("Block poisoned MCP servers")
|
|
34
|
+
@description("Block connections to MCP servers when tool poisoning patterns are detected in tool descriptions (score >= 60). Lower threshold than tool-level poisoning since server-level poisoning affects all tools on the server.")
|
|
35
|
+
@severity("critical")
|
|
36
|
+
@tags("profile,code-agent,supply-chain,tool-poisoning,mcp-security,owasp-asi04")
|
|
37
|
+
@reject_message("MCP server connection blocked: tool poisoning patterns detected in server tool descriptions. Review server tools before connecting.")
|
|
38
|
+
forbid (
|
|
39
|
+
principal,
|
|
40
|
+
action == Guardrails::Action::"connect_server",
|
|
41
|
+
resource
|
|
42
|
+
)
|
|
43
|
+
when {
|
|
44
|
+
context has tool_poisoning_score && context.tool_poisoning_score >= 60
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
// ---------------------------------------------------------------------------
|
|
48
|
+
// Section 2: Indirect Prompt Injection
|
|
49
|
+
// Blocks injection from tool outputs and retrieved content — not direct
|
|
50
|
+
// user input but external content that manipulates agent behavior.
|
|
51
|
+
// Ref: EchoLeak CVE-2025-32711, IDEsaster (30+ CVEs)
|
|
52
|
+
// ---------------------------------------------------------------------------
|
|
53
|
+
|
|
54
|
+
@id("code-block-indirect-injection")
|
|
55
|
+
@name("Block indirect prompt injection")
|
|
56
|
+
@description("Block tool execution when indirect prompt injection is detected in tool outputs, file contents, or retrieved documents (score >= 70). Defends against injection via external content that manipulates agent behavior.")
|
|
57
|
+
@severity("critical")
|
|
58
|
+
@tags("profile,code-agent,supply-chain,indirect-injection,owasp-llm01,owasp-asi01")
|
|
59
|
+
@reject_message("Content blocked: indirect prompt injection detected in tool output or retrieved content. An external source may be attempting to hijack agent behavior.")
|
|
60
|
+
forbid (
|
|
61
|
+
principal,
|
|
62
|
+
action == Guardrails::Action::"call_tool",
|
|
63
|
+
resource
|
|
64
|
+
)
|
|
65
|
+
when {
|
|
66
|
+
context has indirect_injection_score && context.indirect_injection_score >= 70
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
@id("code-block-indirect-injection-sensitive")
|
|
70
|
+
@name("Block indirect injection on sensitive tools")
|
|
71
|
+
@description("Lower threshold (>= 50) for indirect injection when the tool is classified as sensitive. Even moderate injection risk on sensitive tools (shell, file write, network) warrants blocking.")
|
|
72
|
+
@severity("critical")
|
|
73
|
+
@tags("profile,code-agent,supply-chain,indirect-injection,sensitive-tools,owasp-asi02")
|
|
74
|
+
@reject_message("Sensitive tool execution blocked: moderate indirect injection risk detected. Sensitive tools require higher confidence that content is safe.")
|
|
75
|
+
forbid (
|
|
76
|
+
principal,
|
|
77
|
+
action == Guardrails::Action::"call_tool",
|
|
78
|
+
resource
|
|
79
|
+
)
|
|
80
|
+
when {
|
|
81
|
+
context has indirect_injection_score && context.indirect_injection_score >= 50 &&
|
|
82
|
+
context has tool_is_sensitive && context.tool_is_sensitive == true
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
// ---------------------------------------------------------------------------
|
|
86
|
+
// Section 3: Behavioral Attack Patterns
|
|
87
|
+
// Detects multi-step attack chains targeting credentials and workspace integrity.
|
|
88
|
+
// ---------------------------------------------------------------------------
|
|
89
|
+
|
|
90
|
+
@id("code-block-credential-theft")
|
|
91
|
+
@name("Block credential theft chains")
|
|
92
|
+
@description("Block tool execution when a credential theft chain is detected — accessing SSH keys, cloud credentials, or API tokens followed by encoding, compression, or transfer operations. Multi-step attack pattern for autonomous credential harvesting.")
|
|
93
|
+
@severity("critical")
|
|
94
|
+
@tags("profile,code-agent,supply-chain,credential-theft,behavioral,mitre-t1552")
|
|
95
|
+
@reject_message("Tool execution blocked: credential theft chain detected. The agent is performing a multi-step operation to harvest and exfiltrate credentials.")
|
|
96
|
+
forbid (
|
|
97
|
+
principal,
|
|
98
|
+
action == Guardrails::Action::"call_tool",
|
|
99
|
+
resource
|
|
100
|
+
)
|
|
101
|
+
when {
|
|
102
|
+
context has suspicious_pattern && context.suspicious_pattern == true &&
|
|
103
|
+
context has pattern_type && context.pattern_type == "credential_theft"
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
@id("code-block-destructive-sequence")
|
|
107
|
+
@name("Block destructive operation sequences")
|
|
108
|
+
@description("Block tool execution when a destructive operation sequence is detected — bulk file deletions, permission changes, config overwrites, or repository manipulation patterns. Prevents agent-initiated workspace damage.")
|
|
109
|
+
@severity("critical")
|
|
110
|
+
@tags("profile,code-agent,supply-chain,destructive,behavioral,owasp-asi02")
|
|
111
|
+
@reject_message("Tool execution blocked: destructive operation sequence detected. The agent is performing a pattern of destructive operations that could damage the workspace.")
|
|
112
|
+
forbid (
|
|
113
|
+
principal,
|
|
114
|
+
action == Guardrails::Action::"call_tool",
|
|
115
|
+
resource
|
|
116
|
+
)
|
|
117
|
+
when {
|
|
118
|
+
context has suspicious_pattern && context.suspicious_pattern == true &&
|
|
119
|
+
context has pattern_type && context.pattern_type == "destructive_sequence"
|
|
120
|
+
};
|
|
@@ -224,6 +224,105 @@
|
|
|
224
224
|
"file": "profiles/multi_agent/agent_safety.cedar",
|
|
225
225
|
"severity": "critical",
|
|
226
226
|
"tags": ["profile", "multi-agent", "cross-turn", "a2a", "pii", "secrets", "injection", "circuit-breaker"]
|
|
227
|
+
},
|
|
228
|
+
{
|
|
229
|
+
"id": "code-agent-path-security",
|
|
230
|
+
"name": "Code Agent — Path Security",
|
|
231
|
+
"description": "Block access to .env files, credential files, system directories, credential directories, and destructive file operations for coding agents",
|
|
232
|
+
"category": "security",
|
|
233
|
+
"file": "profiles/code_agent/path_security.cedar",
|
|
234
|
+
"severity": "high",
|
|
235
|
+
"tags": ["profile", "code-agent", "path-security", "credentials", "system-paths"]
|
|
236
|
+
},
|
|
237
|
+
{
|
|
238
|
+
"id": "code-agent-supply-chain",
|
|
239
|
+
"name": "Code Agent — Supply Chain Security",
|
|
240
|
+
"description": "Block MCP server poisoning, indirect prompt injection from tool outputs, credential theft patterns, and destructive operation sequences for coding agents",
|
|
241
|
+
"category": "agentic_security",
|
|
242
|
+
"file": "profiles/code_agent/supply_chain.cedar",
|
|
243
|
+
"severity": "critical",
|
|
244
|
+
"tags": ["profile", "code-agent", "supply-chain", "tool-poisoning", "indirect-injection"]
|
|
245
|
+
},
|
|
246
|
+
{
|
|
247
|
+
"id": "code-agent-encoding",
|
|
248
|
+
"name": "Code Agent — Encoding Attacks",
|
|
249
|
+
"description": "Block invisible Unicode characters in tool arguments and file writes to prevent encoding-based prompt injection for coding agents",
|
|
250
|
+
"category": "security",
|
|
251
|
+
"file": "profiles/code_agent/encoding.cedar",
|
|
252
|
+
"severity": "high",
|
|
253
|
+
"tags": ["profile", "code-agent", "encoding", "unicode", "invisible-chars"]
|
|
254
|
+
},
|
|
255
|
+
{
|
|
256
|
+
"id": "advanced-detection-secrets",
|
|
257
|
+
"name": "Advanced Detection — Granular Secrets",
|
|
258
|
+
"description": "Granular secret type blocking for high-risk credentials (cloud provider keys, GitHub tokens, SSH keys, database URLs) and API keys/tokens",
|
|
259
|
+
"category": "security",
|
|
260
|
+
"file": "profiles/advanced_detection/secrets.cedar",
|
|
261
|
+
"severity": "critical",
|
|
262
|
+
"tags": ["profile", "advanced-detection", "secrets", "credentials", "cloud-keys"]
|
|
263
|
+
},
|
|
264
|
+
{
|
|
265
|
+
"id": "advanced-detection-pii",
|
|
266
|
+
"name": "Advanced Detection — PII",
|
|
267
|
+
"description": "Bulk PII exposure blocking, high-confidence ML PII detection, and PII in file operations for advanced threat detection",
|
|
268
|
+
"category": "privacy",
|
|
269
|
+
"file": "profiles/advanced_detection/pii.cedar",
|
|
270
|
+
"severity": "critical",
|
|
271
|
+
"tags": ["profile", "advanced-detection", "pii", "privacy", "ml-classifier"]
|
|
272
|
+
},
|
|
273
|
+
{
|
|
274
|
+
"id": "advanced-detection-threat-severity",
|
|
275
|
+
"name": "Advanced Detection — Threat Severity",
|
|
276
|
+
"description": "Block any content flagged with critical severity by detection engines as a catch-all safety net",
|
|
277
|
+
"category": "security",
|
|
278
|
+
"file": "profiles/advanced_detection/threat_severity.cedar",
|
|
279
|
+
"severity": "critical",
|
|
280
|
+
"tags": ["profile", "advanced-detection", "severity", "critical", "catch-all"]
|
|
281
|
+
},
|
|
282
|
+
{
|
|
283
|
+
"id": "a2a-cross-origin",
|
|
284
|
+
"name": "A2A Security — Cross-Origin Trust Boundaries",
|
|
285
|
+
"description": "Block confused deputy attacks and trust boundary violations from cross-system agent communication — critical cross-origin blocking, unverified agent restrictions, sensitive tool protection",
|
|
286
|
+
"category": "agent_identity",
|
|
287
|
+
"file": "profiles/a2a_security/cross_origin.cedar",
|
|
288
|
+
"severity": "critical",
|
|
289
|
+
"tags": ["profile", "a2a-security", "cross-origin", "confused-deputy", "trust-boundary"]
|
|
290
|
+
},
|
|
291
|
+
{
|
|
292
|
+
"id": "a2a-inter-agent-injection",
|
|
293
|
+
"name": "A2A Security — Inter-Agent Injection Defense",
|
|
294
|
+
"description": "Block indirect prompt injection via tool outputs, multi-turn progressive attacks using deep context models, and encoded payload delivery between independent agents",
|
|
295
|
+
"category": "agent_identity",
|
|
296
|
+
"file": "profiles/a2a_security/inter_agent_injection.cedar",
|
|
297
|
+
"severity": "critical",
|
|
298
|
+
"tags": ["profile", "a2a-security", "indirect-injection", "multi-turn", "encoded-injection", "deep-context"]
|
|
299
|
+
},
|
|
300
|
+
{
|
|
301
|
+
"id": "a2a-supply-chain",
|
|
302
|
+
"name": "A2A Security — Supply Chain & Behavioral Drift",
|
|
303
|
+
"description": "Block tool poisoning from external agent ecosystems, rug pull behavioral drift, and credential theft chains initiated by compromised agents",
|
|
304
|
+
"category": "agent_identity",
|
|
305
|
+
"file": "profiles/a2a_security/supply_chain.cedar",
|
|
306
|
+
"severity": "critical",
|
|
307
|
+
"tags": ["profile", "a2a-security", "supply-chain", "tool-poisoning", "rug-pull", "credential-theft"]
|
|
308
|
+
},
|
|
309
|
+
{
|
|
310
|
+
"id": "a2a-identity-enforcement",
|
|
311
|
+
"name": "A2A Security — Agent Identity Enforcement",
|
|
312
|
+
"description": "Enforce strict identity requirements for cross-system agents — block anonymous agents, require framework registration, prevent unverified autonomous agents",
|
|
313
|
+
"category": "agent_identity",
|
|
314
|
+
"file": "profiles/a2a_security/identity_enforcement.cedar",
|
|
315
|
+
"severity": "critical",
|
|
316
|
+
"tags": ["profile", "a2a-security", "identity", "spoofing", "framework", "autonomous"]
|
|
317
|
+
},
|
|
318
|
+
{
|
|
319
|
+
"id": "a2a-escalation-detection",
|
|
320
|
+
"name": "A2A Security — Escalation Detection & Circuit Breakers",
|
|
321
|
+
"description": "Detect progressive capability escalation across turns with session peak score monitoring and cumulative risk circuit breakers tuned for adversarial A2A communication",
|
|
322
|
+
"category": "agent_identity",
|
|
323
|
+
"file": "profiles/a2a_security/escalation_detection.cedar",
|
|
324
|
+
"severity": "critical",
|
|
325
|
+
"tags": ["profile", "a2a-security", "escalation", "circuit-breaker", "session-peak", "cumulative-risk"]
|
|
227
326
|
}
|
|
228
327
|
],
|
|
229
328
|
"profiles": [
|
|
@@ -238,10 +337,10 @@
|
|
|
238
337
|
{
|
|
239
338
|
"id": "code-agent",
|
|
240
339
|
"name": "Code Agent",
|
|
241
|
-
"description": "Optimized for coding assistants — tool risk controls, shell blocking, loop detection, exfiltration prevention, budget enforcement",
|
|
340
|
+
"description": "Optimized for coding assistants — tool risk controls, shell blocking, loop detection, exfiltration prevention, budget enforcement, path security, supply chain defense, and encoding attack protection",
|
|
242
341
|
"severity": "high",
|
|
243
|
-
"tags": ["code-agent", "tools", "agentic", "exfiltration"],
|
|
244
|
-
"template_ids": ["code-agent-agentic-security", "code-agent-security"]
|
|
342
|
+
"tags": ["code-agent", "tools", "agentic", "exfiltration", "path-security", "supply-chain", "encoding"],
|
|
343
|
+
"template_ids": ["code-agent-agentic-security", "code-agent-security", "code-agent-path-security", "code-agent-supply-chain", "code-agent-encoding"]
|
|
245
344
|
},
|
|
246
345
|
{
|
|
247
346
|
"id": "data-pipeline",
|
|
@@ -253,11 +352,27 @@
|
|
|
253
352
|
},
|
|
254
353
|
{
|
|
255
354
|
"id": "multi-agent",
|
|
256
|
-
"name": "Multi-Agent Orchestration",
|
|
257
|
-
"description": "Production-grade
|
|
355
|
+
"name": "Multi-Agent Orchestration (MAS)",
|
|
356
|
+
"description": "Production-grade guardrails for multi-agent systems with shared orchestration — tiered trust access control, autonomous agent safeguards, cross-turn PII/secrets containment, injection escalation response, cumulative risk circuit breakers. For independent agent-to-agent communication across separate trust domains, use the A2A Security profile",
|
|
258
357
|
"severity": "critical",
|
|
259
|
-
"tags": ["multi-agent", "
|
|
358
|
+
"tags": ["multi-agent", "mas", "trust", "cross-turn", "circuit-breaker"],
|
|
260
359
|
"template_ids": ["agent-identity-trust", "multi-agent-trust", "multi-agent-safety"]
|
|
360
|
+
},
|
|
361
|
+
{
|
|
362
|
+
"id": "a2a-security",
|
|
363
|
+
"name": "A2A Security",
|
|
364
|
+
"description": "Production-grade security for independent agent-to-agent communication across separate trust domains — cross-origin trust enforcement, inter-agent injection defense (indirect, multi-turn, encoded), supply chain protection (tool poisoning, rug pull), identity enforcement, and escalation circuit breakers",
|
|
365
|
+
"severity": "critical",
|
|
366
|
+
"tags": ["a2a-security", "cross-origin", "injection", "supply-chain", "identity", "escalation"],
|
|
367
|
+
"template_ids": ["a2a-cross-origin", "a2a-inter-agent-injection", "a2a-supply-chain", "a2a-identity-enforcement", "a2a-escalation-detection"]
|
|
368
|
+
},
|
|
369
|
+
{
|
|
370
|
+
"id": "advanced-detection",
|
|
371
|
+
"name": "Advanced Detection",
|
|
372
|
+
"description": "Production-grade advanced threat detection — granular secret type blocking, ML-based PII detection, bulk exposure prevention, and critical severity catch-all for high-security environments",
|
|
373
|
+
"severity": "critical",
|
|
374
|
+
"tags": ["advanced-detection", "secrets", "pii", "severity", "ml-detection"],
|
|
375
|
+
"template_ids": ["advanced-detection-secrets", "advanced-detection-pii", "advanced-detection-threat-severity"]
|
|
261
376
|
}
|
|
262
377
|
]
|
|
263
378
|
}
|
|
@@ -41,6 +41,9 @@ export declare const GuardrailsContextKey: {
|
|
|
41
41
|
readonly FactualityScore: "factuality_score";
|
|
42
42
|
readonly HallucinationScore: "hallucination_score";
|
|
43
43
|
readonly HateSpeechScore: "hate_speech_score";
|
|
44
|
+
readonly HighestSeverity: "highest_severity";
|
|
45
|
+
readonly IndirectInjectionScore: "indirect_injection_score";
|
|
46
|
+
readonly IndirectInjectionType: "indirect_injection_type";
|
|
44
47
|
readonly InjectionConfidence: "injection_confidence";
|
|
45
48
|
readonly InjectionDeepContextScore: "injection_deep_context_score";
|
|
46
49
|
readonly InjectionPulseScore: "injection_pulse_score";
|
|
@@ -65,11 +68,13 @@ export declare const GuardrailsContextKey: {
|
|
|
65
68
|
readonly McpServerVerified: "mcp_server_verified";
|
|
66
69
|
readonly McpTool: "mcp_tool";
|
|
67
70
|
readonly MultiTurnDetection: "multi_turn_detection";
|
|
71
|
+
readonly Path: "path";
|
|
68
72
|
readonly PathTraversalDetected: "path_traversal_detected";
|
|
69
73
|
readonly PathTraversalSeverity: "path_traversal_severity";
|
|
70
74
|
readonly PathTraversalType: "path_traversal_type";
|
|
71
75
|
readonly PatternType: "pattern_type";
|
|
72
76
|
readonly PhishingDetected: "phishing_detected";
|
|
77
|
+
readonly PiiConfidence: "pii_confidence";
|
|
73
78
|
readonly PiiCount: "pii_count";
|
|
74
79
|
readonly PiiDetected: "pii_detected";
|
|
75
80
|
readonly PiiTypes: "pii_types";
|
|
@@ -43,6 +43,9 @@ export const GuardrailsContextKey = {
|
|
|
43
43
|
FactualityScore: 'factuality_score',
|
|
44
44
|
HallucinationScore: 'hallucination_score',
|
|
45
45
|
HateSpeechScore: 'hate_speech_score',
|
|
46
|
+
HighestSeverity: 'highest_severity',
|
|
47
|
+
IndirectInjectionScore: 'indirect_injection_score',
|
|
48
|
+
IndirectInjectionType: 'indirect_injection_type',
|
|
46
49
|
InjectionConfidence: 'injection_confidence',
|
|
47
50
|
InjectionDeepContextScore: 'injection_deep_context_score',
|
|
48
51
|
InjectionPulseScore: 'injection_pulse_score',
|
|
@@ -67,11 +70,13 @@ export const GuardrailsContextKey = {
|
|
|
67
70
|
McpServerVerified: 'mcp_server_verified',
|
|
68
71
|
McpTool: 'mcp_tool',
|
|
69
72
|
MultiTurnDetection: 'multi_turn_detection',
|
|
73
|
+
Path: 'path',
|
|
70
74
|
PathTraversalDetected: 'path_traversal_detected',
|
|
71
75
|
PathTraversalSeverity: 'path_traversal_severity',
|
|
72
76
|
PathTraversalType: 'path_traversal_type',
|
|
73
77
|
PatternType: 'pattern_type',
|
|
74
78
|
PhishingDetected: 'phishing_detected',
|
|
79
|
+
PiiConfidence: 'pii_confidence',
|
|
75
80
|
PiiCount: 'pii_count',
|
|
76
81
|
PiiDetected: 'pii_detected',
|
|
77
82
|
PiiTypes: 'pii_types',
|