@highflame/policy 2.2.33 → 2.2.35

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.
Files changed (32) hide show
  1. package/_schemas/agent_ops/templates/ported/agent-security/agent_identity_multi_agent_safety.cedar +3 -17
  2. package/_schemas/agent_ops/templates/ported/threat-detection/security_patterns.cedar +7 -19
  3. package/_schemas/agent_ops/templates/ported/threat-detection/semantic_defaults.cedar +7 -33
  4. package/_schemas/agent_ops/templates/templates.json +4 -6
  5. package/_schemas/ai_gateway/templates/defaults/tools.cedar +3 -17
  6. package/_schemas/ai_gateway/templates/templates.json +1 -2
  7. package/_schemas/guardrails/templates/defaults/security_patterns.cedar +7 -19
  8. package/_schemas/guardrails/templates/profiles/multi_agent/agent_safety.cedar +3 -17
  9. package/_schemas/guardrails/templates/templates.json +4 -6
  10. package/_schemas/overwatch/context.json +222 -0
  11. package/_schemas/overwatch/schema.cedarschema +72 -0
  12. package/_schemas/sentry/templates/templates.json +0 -14
  13. package/dist/aarm-annotation.d.ts +18 -0
  14. package/dist/aarm-annotation.js +36 -1
  15. package/dist/aarm-annotations.gen.js +21 -0
  16. package/dist/agent_ops-defaults.gen.js +25 -79
  17. package/dist/ai_gateway-defaults.gen.js +6 -21
  18. package/dist/ai_gateway-detectors.gen.js +2 -2
  19. package/dist/guardrails-defaults.gen.js +18 -46
  20. package/dist/guardrails-detectors.gen.js +2 -2
  21. package/dist/overwatch-context.gen.d.ts +2 -1
  22. package/dist/overwatch-context.gen.js +2 -0
  23. package/dist/overwatch-defaults.gen.js +105 -42
  24. package/dist/overwatch-detectors.gen.js +2 -2
  25. package/dist/overwatch-entities.gen.js +5 -1
  26. package/dist/sentry-defaults.gen.d.ts +1 -1
  27. package/dist/sentry-defaults.gen.js +0 -56
  28. package/dist/sentry-detectors.gen.js +2 -2
  29. package/dist/service-schemas.gen.d.ts +1 -1
  30. package/dist/service-schemas.gen.js +114 -0
  31. package/package.json +1 -1
  32. package/_schemas/sentry/templates/defaults/file_safety.cedar +0 -31
@@ -23,11 +23,6 @@
23
23
  "name": "Content Safety",
24
24
  "description": "Block violent, harmful, hateful, sexual, or profane content."
25
25
  },
26
- {
27
- "id": "file-safety",
28
- "name": "File & Attachment Safety",
29
- "description": "Block file uploads containing secrets or PII."
30
- },
31
26
  {
32
27
  "id": "clipboard",
33
28
  "name": "Clipboard Policy",
@@ -146,15 +141,6 @@
146
141
  "compliance:hipaa"
147
142
  ]
148
143
  },
149
- {
150
- "id": "file-safety.block-upload-secrets",
151
- "name": "File & Attachment Safety",
152
- "description": "Block file uploads containing secrets in document content.",
153
- "category": "file-safety",
154
- "file": "defaults/file_safety.cedar",
155
- "severity": "critical",
156
- "tags": ["category:file-safety", "threat:secrets"]
157
- },
158
144
  {
159
145
  "id": "clipboard.defaults",
160
146
  "name": "Clipboard Policy",
@@ -59,6 +59,23 @@ export interface DeferUntilContextDirective {
59
59
  /** Dotted Cedar context-attribute path (e.g. "session_max_sensitivity"). */
60
60
  field: string;
61
61
  }
62
+ /**
63
+ * How a transform rule rewrites the spans its detector matched. A forbid
64
+ * carrying this annotation is allow-class: Shield emits decision=modify with
65
+ * redacted_content instead of blocking.
66
+ */
67
+ export interface RedactionStrategyDirective {
68
+ /**
69
+ * One of redact | mask | anonymize | replace. Case-sensitive.
70
+ *
71
+ * An unrecognized value is rejected at parse time: Shield treats any
72
+ * non-empty strategy as "redact" and an unknown one falls through to the
73
+ * generic [REDACTED] label, so a typo would produce the wrong redaction
74
+ * rather than the intended masking. An EMPTY value instead reverts the rule
75
+ * to a hard forbid.
76
+ */
77
+ strategy: string;
78
+ }
62
79
  /**
63
80
  * Every typed AARM directive parsed from a single policy's annotation map.
64
81
  * Each field is present iff the corresponding annotation was present and
@@ -69,6 +86,7 @@ export interface AARMDirectives {
69
86
  deferOnConflict?: DeferOnConflictDirective;
70
87
  deferBelowConfidence?: DeferBelowConfidenceDirective;
71
88
  deferUntilContext?: DeferUntilContextDirective;
89
+ redactionStrategy?: RedactionStrategyDirective;
72
90
  }
73
91
  /** True iff at least one AARM directive was parsed. */
74
92
  export declare function hasAnyAARMDirective(d: AARMDirectives | null | undefined): boolean;
@@ -44,7 +44,8 @@ export function hasAnyAARMDirective(d) {
44
44
  return (d.stepUpRequired !== undefined ||
45
45
  d.deferOnConflict !== undefined ||
46
46
  d.deferBelowConfidence !== undefined ||
47
- d.deferUntilContext !== undefined);
47
+ d.deferUntilContext !== undefined ||
48
+ d.redactionStrategy !== undefined);
48
49
  }
49
50
  /**
50
51
  * Structured error for a malformed AARM annotation. Mirrors Go's
@@ -134,6 +135,14 @@ export function parseAARMAnnotations(raw) {
134
135
  directives.deferUntilContext = r.directive;
135
136
  break;
136
137
  }
138
+ case 'redaction_strategy': {
139
+ const r = buildRedactionStrategy(def, params, value);
140
+ if (r.error)
141
+ errors.push(r.error);
142
+ else
143
+ directives.redactionStrategy = r.directive;
144
+ break;
145
+ }
137
146
  default:
138
147
  // Registry entry exists but no typed extractor is wired here — a
139
148
  // programming error in highflame-policy. Fail closed at runtime.
@@ -286,6 +295,32 @@ function buildDeferBelowConfidence(def, params, raw) {
286
295
  return { error: bounds };
287
296
  return { directive: { threshold: threshold.value } };
288
297
  }
298
+ /**
299
+ * Mirrors the enum in schemas/annotations.json. Kept here because
300
+ * AARMParameterDef carries no enum field, so the generated registry cannot.
301
+ */
302
+ const REDACTION_STRATEGIES = ['redact', 'mask', 'anonymize', 'replace'];
303
+ function buildRedactionStrategy(def, params, raw) {
304
+ const strategy = requireStringParam(def, params, 'strategy', raw);
305
+ if ('error' in strategy)
306
+ return { error: strategy.error };
307
+ // Fail closed, matching this module's documented posture. Known hazard tracked
308
+ // separately: Shield's syncer drops the ENTIRE policy on an annotation error,
309
+ // so a typo removes the redaction rule from enforcement. The fix belongs on the
310
+ // Shield side — keep the policy, drop only the offending directive.
311
+ if (!REDACTION_STRATEGIES.includes(strategy.value)) {
312
+ return {
313
+ error: new AARMAnnotationError({
314
+ key: def.key,
315
+ parameter: 'strategy',
316
+ rawValue: raw,
317
+ reason: 'strategy must be one of redact, mask, anonymize, replace; ' +
318
+ 'values are case-sensitive',
319
+ }),
320
+ };
321
+ }
322
+ return { directive: { strategy: strategy.value } };
323
+ }
289
324
  function buildDeferUntilContext(def, params, raw) {
290
325
  const field = requireStringParam(def, params, 'field', raw);
291
326
  if ('error' in field)
@@ -64,6 +64,27 @@ export const AARM_ANNOTATIONS = [
64
64
  },
65
65
  ],
66
66
  },
67
+ {
68
+ key: 'redaction_strategy',
69
+ description: 'Rewrite the matched content instead of blocking. A determining forbid carrying this annotation makes Shield emit decision=modify with redacted_content, replacing every detected span using the named strategy. Redaction is allow-class and applies regardless of posture — there is no shadow redaction — but most-restrictive-wins still applies, so a co-firing hard forbid in enforce posture beats it and blocks. Shield treats any non-empty strategy as a redaction and falls through to a generic replacement label for a value it does not recognize, so an out-of-enum value produces the wrong redaction rather than the author\'s intent; an empty value reverts the rule to a hard forbid. The enum is enforced by the typed extractor in the Go and TypeScript packages, which reject a policy carrying an unrecognized value.',
70
+ aarmRequirement: 'R3',
71
+ promotesCapability: 'CAP-ENF-003',
72
+ decisionEffect: 'modify',
73
+ parameters: [
74
+ {
75
+ name: 'strategy',
76
+ type: 'string',
77
+ required: true,
78
+ positional: true,
79
+ description: 'How to rewrite each detected span. redact removes it entirely; replace substitutes a single generic label; mask preserves a recognizable shape (the producing detector may supply its own mask); anonymize substitutes a realistic fake. Case-sensitive — an out-of-enum value is rejected at parse time.',
80
+ default: null,
81
+ min: null,
82
+ max: null,
83
+ pattern: '',
84
+ valueSource: '',
85
+ },
86
+ ],
87
+ },
67
88
  {
68
89
  key: 'step_up_required',
69
90
  description: 'Suspend the action pending human approval from an approver with the named role. AARM R4 STEP_UP decision: Shield issues an OpenID CIBA bc-authorize challenge and the action does not execute until an approver carrying the role resolves it (POST /oauth2/bc-authorize/{auth_req_id}/approve via AuthN), OR timeout_seconds elapses (fail-closed: timeout DENYs the action, never permits).',
@@ -1263,38 +1263,26 @@ when {
1263
1263
  const AGENT_OPS_SECURITY_PATTERNS_CEDAR = `// =============================================================================
1264
1264
  // Security Pattern Detection (Default)
1265
1265
  // =============================================================================
1266
- // Blocks command injection, path traversal, and SQL injection using
1267
- // regex-based pattern detection from Shield's security detectors.
1266
+ // Blocks path traversal and SQL injection using regex-based pattern detection
1267
+ // from Shield's security detectors.
1268
+ //
1269
+ // The command-injection rule was removed while that detector is disabled, so
1270
+ // this template cannot instantiate a rule that can never fire. See
1271
+ // highflame-shield#386; restore the rule when the detector is re-enabled.
1268
1272
  //
1269
1273
  // Context keys consumed:
1270
- // - command_injection_detected: Bool
1271
1274
  // - path_traversal_detected: Bool
1272
1275
  // - path_traversal_severity: String
1273
1276
  // - sql_injection_detected: Bool
1274
1277
  // - sql_injection_score: Long (0-100)
1275
1278
  //
1276
1279
  // Compliance:
1277
- // - MITRE T1059 (Command Injection), T1005 (Data from Local System)
1280
+ // - MITRE T1005 (Data from Local System)
1278
1281
  //
1279
1282
  // Category: security
1280
1283
  // Namespace: AgentOps
1281
1284
  // =============================================================================
1282
1285
 
1283
- @id("security.block-command-injection")
1284
- @name("Block command injection")
1285
- @description("Blocks process_prompt and call_tool when command_injection_detected is true.")
1286
- @severity("critical")
1287
- @tags("category:security,threat:command-injection,detection:pattern,mitre:t1059")
1288
- @reject_message("Request blocked: command injection pattern detected — reverse shell, destructive command, or privilege escalation.")
1289
- forbid (
1290
- principal,
1291
- action in [AgentOps::Action::"process_prompt", AgentOps::Action::"call_tool"],
1292
- resource
1293
- )
1294
- when {
1295
- context has command_injection_detected && context.command_injection_detected == true
1296
- };
1297
-
1298
1286
  @id("security.block-path-traversal")
1299
1287
  @name("Block path traversal")
1300
1288
  @description("Blocks process_prompt, call_tool, read_file, and write_file when path_traversal_detected is true and severity is high or critical.")
@@ -2552,7 +2540,6 @@ const AGENT_OPS_AGENT_IDENTITY_MULTI_AGENT_SAFETY_CEDAR = `// ==================
2552
2540
  // - agent_trust_level, agent_type, tool_name, tool_is_sensitive
2553
2541
  // - session_pii_detected, session_pii_types
2554
2542
  // - session_secrets_detected, session_injection_detected
2555
- // - session_command_injection
2556
2543
  // - session_threat_turns: Long
2557
2544
  // - session_cumulative_risk_score: Long
2558
2545
  // - suspicious_pattern: Bool
@@ -2648,22 +2635,9 @@ when {
2648
2635
  context has session_injection_detected && context.session_injection_detected == true
2649
2636
  };
2650
2637
 
2651
- @id("agent-identity.multi-agent-post-command-injection-shell")
2652
- @name("Block shell after command injection in session")
2653
- @description("Blocks call_tool when session_command_injection is true and tool_name is a shell tool.")
2654
- @severity("critical")
2655
- @tags("category:agent-identity,threat:command-injection,scope:per-agent,detection:aggregate,surface:call-tool,mitre:t1059")
2656
- @reject_message("Tool execution blocked: command injection was detected earlier in this session — no agent may execute shell commands afterwards.")
2657
- forbid (
2658
- principal is AgentOps::Agent,
2659
- action == AgentOps::Action::"call_tool",
2660
- resource
2661
- )
2662
- when {
2663
- context has session_command_injection && context.session_command_injection == true &&
2664
- context has tool_name &&
2665
- (context.tool_name == "shell" || context.tool_name == "execute_command" || context.tool_name == "bash")
2666
- };
2638
+ // The post-command-injection shell rule was removed while that detector is
2639
+ // disabled, so this template cannot instantiate a rule that can never fire.
2640
+ // See highflame-shield#386; restore it when the detector is re-enabled.
2667
2641
 
2668
2642
  // ---------------------------------------------------------------------------
2669
2643
  // Section 4: Cumulative risk circuit breakers
@@ -3918,11 +3892,15 @@ when {
3918
3892
  const AGENT_OPS_SEMANTIC_DEFAULTS_CEDAR = `// =============================================================================
3919
3893
  // Semantic Threat Detection (Default)
3920
3894
  // =============================================================================
3921
- // Blocks injection attacks (command, SQL, path traversal), prompt injection,
3922
- // jailbreak attempts, and encoded payloads using two detection tiers:
3895
+ // Blocks injection attacks (SQL, path traversal), prompt injection, jailbreak
3896
+ // attempts, and encoded payloads using two detection tiers:
3923
3897
  //
3924
3898
  // Tier 1 — Pattern-based (always available, no external dependency)
3925
- // command_injection, sql_injection, path_traversal, detect_encoded
3899
+ // sql_injection, path_traversal, detect_encoded
3900
+ //
3901
+ // The command-injection rules were removed while that detector is disabled, so
3902
+ // this template cannot instantiate rules that can never fire. See
3903
+ // highflame-shield#386; restore them when the detector is re-enabled.
3926
3904
  //
3927
3905
  // Tier 2 — ML classifiers (require Highflame API token)
3928
3906
  // injection_score, jailbreak_score
@@ -3947,36 +3925,6 @@ const AGENT_OPS_SEMANTIC_DEFAULTS_CEDAR = `// ==================================
3947
3925
  // Tier 1: Pattern-based injection detection
3948
3926
  // ---------------------------------------------------------------------------
3949
3927
 
3950
- @id("semantic.block-command-injection-tool")
3951
- @name("Block command injection in tool calls")
3952
- @description("Blocks call_tool when detected_threats contains \\"command_injection\\".")
3953
- @severity("critical")
3954
- @tags("category:semantic,threat:command-injection,detection:pattern,surface:call-tool,mitre:t1059,owasp:asi02")
3955
- @reject_message("Tool execution blocked: command injection pattern detected — reverse shell, destructive command, or privilege escalation.")
3956
- forbid (
3957
- principal,
3958
- action == AgentOps::Action::"call_tool",
3959
- resource
3960
- )
3961
- when {
3962
- context has detected_threats && context.detected_threats.contains("command_injection")
3963
- };
3964
-
3965
- @id("semantic.block-command-injection-prompt")
3966
- @name("Block command injection in prompts")
3967
- @description("Blocks process_prompt when detected_threats contains \\"command_injection\\".")
3968
- @severity("critical")
3969
- @tags("category:semantic,threat:command-injection,detection:pattern,surface:process-prompt,mitre:t1059")
3970
- @reject_message("Prompt blocked: command injection pattern detected.")
3971
- forbid (
3972
- principal,
3973
- action == AgentOps::Action::"process_prompt",
3974
- resource
3975
- )
3976
- when {
3977
- context has detected_threats && context.detected_threats.contains("command_injection")
3978
- };
3979
-
3980
3928
  @id("semantic.block-sql-injection-tool")
3981
3929
  @name("Block SQL injection in tool calls")
3982
3930
  @description("Blocks call_tool when detected_threats contains \\"sql_injection\\".")
@@ -4690,11 +4638,11 @@ export const AGENT_OPS_TEMPLATES = [
4690
4638
  {
4691
4639
  id: 'security.patterns',
4692
4640
  name: 'Security Pattern Detection',
4693
- description: 'Block command injection, path traversal, and SQL injection using regex-based pattern detection.',
4641
+ description: 'Block path traversal and SQL injection using regex-based pattern detection.',
4694
4642
  category: 'threat-detection',
4695
4643
  cedarText: AGENT_OPS_SECURITY_PATTERNS_CEDAR,
4696
- severity: 'critical',
4697
- tags: ['category:security', 'threat:command-injection', 'threat:sql-injection', 'threat:path-traversal', 'detection:pattern', 'mitre:t1059'],
4644
+ severity: 'high',
4645
+ tags: ['category:security', 'threat:sql-injection', 'threat:path-traversal', 'detection:pattern'],
4698
4646
  },
4699
4647
  {
4700
4648
  id: 'trust-safety.semantic',
@@ -4924,7 +4872,7 @@ export const AGENT_OPS_TEMPLATES = [
4924
4872
  {
4925
4873
  id: 'semantic.defaults',
4926
4874
  name: 'Semantic Threat Detection',
4927
- description: 'Block injection attacks (command, SQL, path, encoded) plus ML-detected prompt injection and jailbreak attempts.',
4875
+ description: 'Block injection attacks (SQL, path, encoded) plus ML-detected prompt injection and jailbreak attempts.',
4928
4876
  category: 'threat-detection',
4929
4877
  cedarText: AGENT_OPS_SEMANTIC_DEFAULTS_CEDAR,
4930
4878
  severity: 'critical',
@@ -5251,17 +5199,15 @@ export const AGENT_OPS_TEMPLATES_JSON = `{
5251
5199
  {
5252
5200
  "id": "security.patterns",
5253
5201
  "name": "Security Pattern Detection",
5254
- "description": "Block command injection, path traversal, and SQL injection using regex-based pattern detection.",
5202
+ "description": "Block path traversal and SQL injection using regex-based pattern detection.",
5255
5203
  "category": "threat-detection",
5256
5204
  "file": "ported/threat-detection/security_patterns.cedar",
5257
- "severity": "critical",
5205
+ "severity": "high",
5258
5206
  "tags": [
5259
5207
  "category:security",
5260
- "threat:command-injection",
5261
5208
  "threat:sql-injection",
5262
5209
  "threat:path-traversal",
5263
- "detection:pattern",
5264
- "mitre:t1059"
5210
+ "detection:pattern"
5265
5211
  ]
5266
5212
  },
5267
5213
  {
@@ -5610,7 +5556,7 @@ export const AGENT_OPS_TEMPLATES_JSON = `{
5610
5556
  {
5611
5557
  "id": "semantic.defaults",
5612
5558
  "name": "Semantic Threat Detection",
5613
- "description": "Block injection attacks (command, SQL, path, encoded) plus ML-detected prompt injection and jailbreak attempts.",
5559
+ "description": "Block injection attacks (SQL, path, encoded) plus ML-detected prompt injection and jailbreak attempts.",
5614
5560
  "category": "threat-detection",
5615
5561
  "file": "ported/threat-detection/semantic_defaults.cedar",
5616
5562
  "severity": "critical",
@@ -168,7 +168,6 @@ const AI_GATEWAY_TOOLS_DEFAULTS_CEDAR = `// ====================================
168
168
  // - Computed risk score (tool_risk_score)
169
169
  // - Detector category labels (tool_category, tool_is_sensitive)
170
170
  // - Threat aggregation (threat_count, max_threat_severity)
171
- // - Detection rule triggers (detected_threats)
172
171
  //
173
172
  // Context keys consumed:
174
173
  // - tool_risk_score: Long (0-100)
@@ -176,11 +175,9 @@ const AI_GATEWAY_TOOLS_DEFAULTS_CEDAR = `// ====================================
176
175
  // - tool_is_sensitive: Bool
177
176
  // - threat_count: Long
178
177
  // - max_threat_severity: Long (0-4)
179
- // - detected_threats: Set<String>
180
178
  //
181
179
  // Compliance:
182
180
  // - OWASP LLM06, OWASP ASI02
183
- // - MITRE T1059
184
181
  //
185
182
  // Category: tools
186
183
  // Namespace: AIGateway
@@ -248,20 +245,9 @@ when {
248
245
  context.threat_count >= 1 && context.max_threat_severity >= 3
249
246
  };
250
247
 
251
- @id("tools.block-command-injection")
252
- @name("Block command injection")
253
- @description("Blocks call_tool when detected_threats contains \\"command_injection\\".")
254
- @severity("critical")
255
- @tags("category:tools,threat:command-injection,detection:rule,surface:call-tool,mitre:t1059,owasp:asi02")
256
- @reject_message("Tool execution blocked: command injection pattern detected in tool arguments.")
257
- forbid (
258
- principal,
259
- action == AIGateway::Action::"call_tool",
260
- resource
261
- )
262
- when {
263
- context has detected_threats && context.detected_threats.contains("command_injection")
264
- };
248
+ // The command-injection rule was removed while that detector is disabled, so
249
+ // this template cannot instantiate a rule that can never fire. See
250
+ // highflame-shield#386; restore it when the detector is re-enabled.
265
251
  `;
266
252
  const AI_GATEWAY_AGENT_SECURITY_DEFAULTS_CEDAR = `// =============================================================================
267
253
  // Agent Security (Default)
@@ -1411,11 +1397,11 @@ export const AI_GATEWAY_TEMPLATES = [
1411
1397
  {
1412
1398
  id: 'tools.defaults',
1413
1399
  name: 'Tool Permissioning',
1414
- description: 'Enforce tool risk scoring, block dangerous tools, and detect command injection in MCP tool arguments.',
1400
+ description: 'Enforce tool risk scoring and block dangerous tools in MCP tool arguments.',
1415
1401
  category: 'tools',
1416
1402
  cedarText: AI_GATEWAY_TOOLS_DEFAULTS_CEDAR,
1417
1403
  severity: 'critical',
1418
- tags: ['category:tools', 'threat:command-injection', 'owasp:llm06', 'owasp:asi02'],
1404
+ tags: ['category:tools', 'owasp:llm06', 'owasp:asi02'],
1419
1405
  },
1420
1406
  {
1421
1407
  id: 'agent-security.defaults',
@@ -1571,13 +1557,12 @@ export const AI_GATEWAY_TEMPLATES_JSON = `{
1571
1557
  {
1572
1558
  "id": "tools.defaults",
1573
1559
  "name": "Tool Permissioning",
1574
- "description": "Enforce tool risk scoring, block dangerous tools, and detect command injection in MCP tool arguments.",
1560
+ "description": "Enforce tool risk scoring and block dangerous tools in MCP tool arguments.",
1575
1561
  "category": "tools",
1576
1562
  "file": "defaults/tools.cedar",
1577
1563
  "severity": "critical",
1578
1564
  "tags": [
1579
1565
  "category:tools",
1580
- "threat:command-injection",
1581
1566
  "owasp:llm06",
1582
1567
  "owasp:asi02"
1583
1568
  ]
@@ -51,8 +51,8 @@ export const AI_GATEWAY_DETECTORS = [
51
51
  inhouse: false,
52
52
  model: null,
53
53
  latencyP50Ms: 2,
54
- emits: [{ name: "secrets_detected", type: "Bool", modifiable: false, semantic: "boolean_flag" }, { name: "secret_types", type: "Set<String>", modifiable: false, semantic: "category_set" }, { name: "secret_count", type: "Long", modifiable: false, semantic: "count" }],
55
- supportedModes: ["enforce", "monitor", "alert"],
54
+ emits: [{ name: "secrets_detected", type: "Bool", modifiable: false, semantic: "boolean_flag" }, { name: "secret_types", type: "Set<String>", modifiable: true, semantic: "category_set" }, { name: "secret_count", type: "Long", modifiable: false, semantic: "count" }],
55
+ supportedModes: ["enforce", "monitor", "alert", "modify"],
56
56
  defendsAgainst: ["credential_leakage", "prompt_leakage"],
57
57
  exampleAttacks: [],
58
58
  },
@@ -808,38 +808,26 @@ when {
808
808
  const GUARDRAILS_SECURITY_PATTERNS_CEDAR = `// =============================================================================
809
809
  // Security Pattern Detection (Default)
810
810
  // =============================================================================
811
- // Blocks command injection, path traversal, and SQL injection using
812
- // regex-based pattern detection from Shield's security detectors.
811
+ // Blocks path traversal and SQL injection using regex-based pattern detection
812
+ // from Shield's security detectors.
813
+ //
814
+ // The command-injection rule was removed while that detector is disabled, so
815
+ // this template cannot instantiate a rule that can never fire. See
816
+ // highflame-shield#386; restore the rule when the detector is re-enabled.
813
817
  //
814
818
  // Context keys consumed:
815
- // - command_injection_detected: Bool
816
819
  // - path_traversal_detected: Bool
817
820
  // - path_traversal_severity: String
818
821
  // - sql_injection_detected: Bool
819
822
  // - sql_injection_score: Long (0-100)
820
823
  //
821
824
  // Compliance:
822
- // - MITRE T1059 (Command Injection), T1005 (Data from Local System)
825
+ // - MITRE T1005 (Data from Local System)
823
826
  //
824
827
  // Category: security
825
828
  // Namespace: Guardrails
826
829
  // =============================================================================
827
830
 
828
- @id("security.block-command-injection")
829
- @name("Block command injection")
830
- @description("Blocks process_prompt and call_tool when command_injection_detected is true.")
831
- @severity("critical")
832
- @tags("category:security,threat:command-injection,detection:pattern,mitre:t1059")
833
- @reject_message("Request blocked: command injection pattern detected — reverse shell, destructive command, or privilege escalation.")
834
- forbid (
835
- principal,
836
- action in [Guardrails::Action::"process_prompt", Guardrails::Action::"call_tool"],
837
- resource
838
- )
839
- when {
840
- context has command_injection_detected && context.command_injection_detected == true
841
- };
842
-
843
831
  @id("security.block-path-traversal")
844
832
  @name("Block path traversal")
845
833
  @description("Blocks process_prompt, call_tool, read_file, and write_file when path_traversal_detected is true and severity is high or critical.")
@@ -2097,7 +2085,6 @@ const GUARDRAILS_AGENT_IDENTITY_MULTI_AGENT_SAFETY_CEDAR = `// =================
2097
2085
  // - agent_trust_level, agent_type, tool_name, tool_is_sensitive
2098
2086
  // - session_pii_detected, session_pii_types
2099
2087
  // - session_secrets_detected, session_injection_detected
2100
- // - session_command_injection
2101
2088
  // - session_threat_turns: Long
2102
2089
  // - session_cumulative_risk_score: Long
2103
2090
  // - suspicious_pattern: Bool
@@ -2193,22 +2180,9 @@ when {
2193
2180
  context has session_injection_detected && context.session_injection_detected == true
2194
2181
  };
2195
2182
 
2196
- @id("agent-identity.multi-agent-post-command-injection-shell")
2197
- @name("Block shell after command injection in session")
2198
- @description("Blocks call_tool when session_command_injection is true and tool_name is a shell tool.")
2199
- @severity("critical")
2200
- @tags("category:agent-identity,threat:command-injection,scope:per-agent,detection:aggregate,surface:call-tool,mitre:t1059")
2201
- @reject_message("Tool execution blocked: command injection was detected earlier in this session — no agent may execute shell commands afterwards.")
2202
- forbid (
2203
- principal is Guardrails::Agent,
2204
- action == Guardrails::Action::"call_tool",
2205
- resource
2206
- )
2207
- when {
2208
- context has session_command_injection && context.session_command_injection == true &&
2209
- context has tool_name &&
2210
- (context.tool_name == "shell" || context.tool_name == "execute_command" || context.tool_name == "bash")
2211
- };
2183
+ // The post-command-injection shell rule was removed while that detector is
2184
+ // disabled, so this template cannot instantiate a rule that can never fire.
2185
+ // See highflame-shield#386; restore it when the detector is re-enabled.
2212
2186
 
2213
2187
  // ---------------------------------------------------------------------------
2214
2188
  // Section 4: Cumulative risk circuit breakers
@@ -3464,7 +3438,7 @@ when {
3464
3438
  // CATEGORIES
3465
3439
  // =============================================================================
3466
3440
  export const GUARDRAILS_CATEGORIES = [
3467
- { id: 'security', name: 'Security', description: 'Block prompt injection, jailbreak attempts, command injection, path traversal, and SQL injection.' },
3441
+ { id: 'security', name: 'Security', description: 'Block prompt injection, jailbreak attempts, path traversal, and SQL injection.' },
3468
3442
  { id: 'privacy', name: 'Privacy', description: 'Block personally identifiable information (PII) in prompts and responses.' },
3469
3443
  { id: 'data-protection', name: 'Data Protection', description: 'Block secrets, API keys, tokens, and bulk credential exposure.' },
3470
3444
  { id: 'trust-safety', name: 'Trust & Safety', description: 'Block toxic, violent, hateful, sexual, or profane content; restrict regulated topics.' },
@@ -3577,11 +3551,11 @@ export const GUARDRAILS_TEMPLATES = [
3577
3551
  {
3578
3552
  id: 'security.patterns',
3579
3553
  name: 'Security Pattern Detection',
3580
- description: 'Block command injection, path traversal, and SQL injection using regex-based pattern detection.',
3554
+ description: 'Block path traversal and SQL injection using regex-based pattern detection.',
3581
3555
  category: 'security',
3582
3556
  cedarText: GUARDRAILS_SECURITY_PATTERNS_CEDAR,
3583
- severity: 'critical',
3584
- tags: ['category:security', 'threat:command-injection', 'threat:sql-injection', 'threat:path-traversal', 'detection:pattern', 'mitre:t1059'],
3557
+ severity: 'high',
3558
+ tags: ['category:security', 'threat:sql-injection', 'threat:path-traversal', 'detection:pattern'],
3585
3559
  },
3586
3560
  {
3587
3561
  id: 'trust-safety.semantic',
@@ -3821,7 +3795,7 @@ export const GUARDRAILS_TEMPLATES_JSON = `{
3821
3795
  {
3822
3796
  "id": "security",
3823
3797
  "name": "Security",
3824
- "description": "Block prompt injection, jailbreak attempts, command injection, path traversal, and SQL injection."
3798
+ "description": "Block prompt injection, jailbreak attempts, path traversal, and SQL injection."
3825
3799
  },
3826
3800
  {
3827
3801
  "id": "privacy",
@@ -4000,17 +3974,15 @@ export const GUARDRAILS_TEMPLATES_JSON = `{
4000
3974
  {
4001
3975
  "id": "security.patterns",
4002
3976
  "name": "Security Pattern Detection",
4003
- "description": "Block command injection, path traversal, and SQL injection using regex-based pattern detection.",
3977
+ "description": "Block path traversal and SQL injection using regex-based pattern detection.",
4004
3978
  "category": "security",
4005
3979
  "file": "defaults/security_patterns.cedar",
4006
- "severity": "critical",
3980
+ "severity": "high",
4007
3981
  "tags": [
4008
3982
  "category:security",
4009
- "threat:command-injection",
4010
3983
  "threat:sql-injection",
4011
3984
  "threat:path-traversal",
4012
- "detection:pattern",
4013
- "mitre:t1059"
3985
+ "detection:pattern"
4014
3986
  ]
4015
3987
  },
4016
3988
  {
@@ -23,8 +23,8 @@ export const GUARDRAILS_DETECTORS = [
23
23
  inhouse: false,
24
24
  model: null,
25
25
  latencyP50Ms: 2,
26
- emits: [{ name: "contains_secrets", type: "Bool", modifiable: false, semantic: "boolean_flag", description: "True iff at least one secret pattern matched." }, { name: "secret_types", type: "Set<String>", modifiable: false, semantic: "category_set", description: "Distinct secret types detected (e.g. aws_access_key, github_pat, stripe_key)." }, { name: "secret_count", type: "Long", modifiable: false, semantic: "count", description: "Total secret matches detected." }],
27
- supportedModes: ["enforce", "monitor", "alert"],
26
+ emits: [{ name: "contains_secrets", type: "Bool", modifiable: false, semantic: "boolean_flag", description: "True iff at least one secret pattern matched." }, { name: "secret_types", type: "Set<String>", modifiable: true, semantic: "category_set", description: "Distinct secret types detected (e.g. aws_access_key, github_pat, stripe_key)." }, { name: "secret_count", type: "Long", modifiable: false, semantic: "count", description: "Total secret matches detected." }],
27
+ supportedModes: ["enforce", "monitor", "alert", "modify"],
28
28
  defendsAgainst: ["credential_leakage", "prompt_leakage"],
29
29
  exampleAttacks: [{ title: "API key in content", vulnerabilityId: "credential_leakage", snippet: "Use my key sk-proj-AAbb1234567890ZZ for the API call.", expectedSignal: { "contains_secrets": true } }],
30
30
  },
@@ -10,6 +10,7 @@ export declare const OverwatchContextKey: {
10
10
  readonly Cwd: "cwd";
11
11
  readonly DetectedThreats: "detected_threats";
12
12
  readonly Event: "event";
13
+ readonly ExitCode: "exit_code";
13
14
  readonly HateSpeechScore: "hate_speech_score";
14
15
  readonly HighestSeverity: "highest_severity";
15
16
  readonly IndirectInjectionScore: "indirect_injection_score";
@@ -93,4 +94,4 @@ export type OverwatchContextKey = (typeof OverwatchContextKey)[keyof typeof Over
93
94
  * The full set of authorable context attribute keys for Overwatch.
94
95
  * Iterate this to enumerate the authorable surface (cockpit, conformance).
95
96
  */
96
- export declare const OverwatchContextKeys: readonly ["content", "crime_score", "cwd", "detected_threats", "event", "hate_speech_score", "highest_severity", "indirect_injection_score", "injection_deep_context_score", "injection_pulse_score", "injection_score", "invisible_chars_detected", "invisible_chars_score", "jailbreak_deep_context_score", "jailbreak_pulse_score", "jailbreak_score", "loop_count", "loop_detected", "loop_tool", "malicious_package_detected", "malicious_package_score", "malicious_packages", "max_threat_severity", "mcp_config_risk", "mcp_risk_score", "mcp_server", "mcp_server_verified", "mcp_tool", "package_advisory_count", "package_check_status", "package_ecosystems", "package_install_detected", "package_names", "package_risk_score", "packages_checked", "path", "pattern_type", "pii_count", "pii_detected", "pii_score", "pii_types", "privilege_scope", "profanity_score", "prompt_text", "response_content", "role", "rug_pull_detected", "rug_pull_score", "secret_count", "secret_types", "secrets_detected", "sequence_risk", "session_command_injection", "session_cumulative_risk_score", "session_injection_detected", "session_max_command_injection_score", "session_max_injection_score", "session_max_jailbreak_score", "session_max_pii_score", "session_max_secret_score", "session_pii_detected", "session_pii_types", "session_secret_types", "session_secrets_detected", "session_threat_turns", "sexual_score", "source", "suspicious_pattern", "threat_categories", "threat_count", "tool_category", "tool_is_builtin", "tool_is_sensitive", "tool_name", "tool_operation_classes", "tool_poisoning_detected", "tool_poisoning_score", "tool_risk_score", "user_email", "violence_score", "weapons_score", "workspace_root"];
97
+ export declare const OverwatchContextKeys: readonly ["content", "crime_score", "cwd", "detected_threats", "event", "exit_code", "hate_speech_score", "highest_severity", "indirect_injection_score", "injection_deep_context_score", "injection_pulse_score", "injection_score", "invisible_chars_detected", "invisible_chars_score", "jailbreak_deep_context_score", "jailbreak_pulse_score", "jailbreak_score", "loop_count", "loop_detected", "loop_tool", "malicious_package_detected", "malicious_package_score", "malicious_packages", "max_threat_severity", "mcp_config_risk", "mcp_risk_score", "mcp_server", "mcp_server_verified", "mcp_tool", "package_advisory_count", "package_check_status", "package_ecosystems", "package_install_detected", "package_names", "package_risk_score", "packages_checked", "path", "pattern_type", "pii_count", "pii_detected", "pii_score", "pii_types", "privilege_scope", "profanity_score", "prompt_text", "response_content", "role", "rug_pull_detected", "rug_pull_score", "secret_count", "secret_types", "secrets_detected", "sequence_risk", "session_command_injection", "session_cumulative_risk_score", "session_injection_detected", "session_max_command_injection_score", "session_max_injection_score", "session_max_jailbreak_score", "session_max_pii_score", "session_max_secret_score", "session_pii_detected", "session_pii_types", "session_secret_types", "session_secrets_detected", "session_threat_turns", "sexual_score", "source", "suspicious_pattern", "threat_categories", "threat_count", "tool_category", "tool_is_builtin", "tool_is_sensitive", "tool_name", "tool_operation_classes", "tool_poisoning_detected", "tool_poisoning_score", "tool_risk_score", "user_email", "violence_score", "weapons_score", "workspace_root"];
@@ -12,6 +12,7 @@ export const OverwatchContextKey = {
12
12
  Cwd: 'cwd',
13
13
  DetectedThreats: 'detected_threats',
14
14
  Event: 'event',
15
+ ExitCode: 'exit_code',
15
16
  HateSpeechScore: 'hate_speech_score',
16
17
  HighestSeverity: 'highest_severity',
17
18
  IndirectInjectionScore: 'indirect_injection_score',
@@ -100,6 +101,7 @@ export const OverwatchContextKeys = [
100
101
  OverwatchContextKey.Cwd,
101
102
  OverwatchContextKey.DetectedThreats,
102
103
  OverwatchContextKey.Event,
104
+ OverwatchContextKey.ExitCode,
103
105
  OverwatchContextKey.HateSpeechScore,
104
106
  OverwatchContextKey.HighestSeverity,
105
107
  OverwatchContextKey.IndirectInjectionScore,