@highflame/policy 2.2.34 → 2.2.36

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 (39) hide show
  1. package/_schemas/agent_ops/context.json +30 -0
  2. package/_schemas/agent_ops/schema.cedarschema +7 -0
  3. package/_schemas/agent_ops/templates/ported/agent-security/agent_identity_multi_agent_safety.cedar +3 -17
  4. package/_schemas/agent_ops/templates/ported/threat-detection/security_patterns.cedar +7 -19
  5. package/_schemas/agent_ops/templates/ported/threat-detection/semantic_defaults.cedar +7 -33
  6. package/_schemas/agent_ops/templates/templates.json +4 -6
  7. package/_schemas/ai_gateway/context.json +30 -0
  8. package/_schemas/ai_gateway/schema.cedarschema +7 -0
  9. package/_schemas/ai_gateway/templates/defaults/tools.cedar +3 -17
  10. package/_schemas/ai_gateway/templates/templates.json +1 -2
  11. package/_schemas/guardrails/context.json +30 -0
  12. package/_schemas/guardrails/schema.cedarschema +7 -0
  13. package/_schemas/guardrails/templates/defaults/security_patterns.cedar +7 -19
  14. package/_schemas/guardrails/templates/profiles/multi_agent/agent_safety.cedar +3 -17
  15. package/_schemas/guardrails/templates/templates.json +4 -6
  16. package/_schemas/overwatch/context.json +30 -0
  17. package/_schemas/overwatch/schema.cedarschema +7 -0
  18. package/_schemas/sentry/templates/templates.json +0 -14
  19. package/dist/agent_ops-context.gen.d.ts +6 -1
  20. package/dist/agent_ops-context.gen.js +10 -0
  21. package/dist/agent_ops-defaults.gen.js +25 -79
  22. package/dist/ai_gateway-context.gen.d.ts +6 -1
  23. package/dist/ai_gateway-context.gen.js +10 -0
  24. package/dist/ai_gateway-defaults.gen.js +6 -21
  25. package/dist/ai_gateway-detectors.gen.js +6 -1
  26. package/dist/guardrails-context.gen.d.ts +6 -1
  27. package/dist/guardrails-context.gen.js +10 -0
  28. package/dist/guardrails-defaults.gen.js +18 -46
  29. package/dist/guardrails-detectors.gen.js +6 -1
  30. package/dist/overwatch-context.gen.d.ts +6 -1
  31. package/dist/overwatch-context.gen.js +10 -0
  32. package/dist/overwatch-defaults.gen.js +11 -37
  33. package/dist/overwatch-detectors.gen.js +6 -1
  34. package/dist/sentry-defaults.gen.d.ts +1 -1
  35. package/dist/sentry-defaults.gen.js +0 -56
  36. package/dist/service-schemas.gen.d.ts +4 -4
  37. package/dist/service-schemas.gen.js +48 -0
  38. package/package.json +1 -1
  39. package/_schemas/sentry/templates/defaults/file_safety.cedar +0 -31
@@ -439,6 +439,13 @@ namespace AgentOps {
439
439
  // Tool Operation Classifier (optional)
440
440
  "tool_operation_classes"?: Set<String>,
441
441
 
442
+ // --- Bash AST resolved target paths (#411 / CAP-DET-007) — newline-delimited (leading+trailing \\n); Cedar \`like\` is anchored so patterns start with "*": sub-tree "*\\n/etc/*", bare dir "*\\n/etc\\n*", exact "*\\n/etc/passwd\\n*" ---
443
+ "resolved_target_paths"?: String, // union of resolved absolute target paths, any capability
444
+ "read_target_paths"?: String, // paths the command reads or enumerates
445
+ "write_target_paths"?: String, // paths the command writes, creates, or destroys
446
+ "exec_target_paths"?: String, // paths executed as a script
447
+ "unresolved_target"?: Bool, // a target hid behind a variable/glob/$()/inline code, or the path-list cap truncated
448
+
442
449
  // Agentic - Multi-Turn Context (optional)
443
450
  "conversation_turn"?: Long,
444
451
  "multi_turn_detection"?: Boolean,
@@ -1048,6 +1055,13 @@ action call_tool appliesTo {
1048
1055
  // --- Tool Operation Classifier ---
1049
1056
  tool_operation_classes?: Set<String>, // subset of {"readonly", "write_enabling", "execute_enabling", "network_access", "unknown"}
1050
1057
 
1058
+ // --- Bash AST resolved target paths (#411 / CAP-DET-007) — newline-delimited (leading+trailing \\n); Cedar \`like\` is anchored so patterns start with "*": sub-tree "*\\n/etc/*", bare dir "*\\n/etc\\n*", exact "*\\n/etc/passwd\\n*" ---
1059
+ resolved_target_paths?: String, // union of resolved absolute target paths, any capability
1060
+ read_target_paths?: String, // paths the command reads or enumerates
1061
+ write_target_paths?: String, // paths the command writes, creates, or destroys
1062
+ exec_target_paths?: String, // paths executed as a script
1063
+ unresolved_target?: Bool, // a target hid behind a variable/glob/$()/inline code, or the path-list cap truncated
1064
+
1051
1065
  // --- MCP Trust ---
1052
1066
  mcp_server_verified?: Bool, // Whether server is from verified registry
1053
1067
 
@@ -1821,6 +1835,13 @@ namespace Guardrails {
1821
1835
  // Tool Operation Classifier (optional) — populated by AST-based classifiers (bash, python, etc.)
1822
1836
  "tool_operation_classes"?: Set<String>, // subset of {"readonly", "write_enabling", "execute_enabling", "network_access", "unknown"}
1823
1837
 
1838
+ // --- Bash AST resolved target paths (#411 / CAP-DET-007) — newline-delimited (leading+trailing \\n); Cedar \`like\` is anchored so patterns start with "*": sub-tree "*\\n/etc/*", bare dir "*\\n/etc\\n*", exact "*\\n/etc/passwd\\n*" ---
1839
+ "resolved_target_paths"?: String, // union of resolved absolute target paths, any capability
1840
+ "read_target_paths"?: String, // paths the command reads or enumerates
1841
+ "write_target_paths"?: String, // paths the command writes, creates, or destroys
1842
+ "exec_target_paths"?: String, // paths executed as a script
1843
+ "unresolved_target"?: Bool, // a target hid behind a variable/glob/$()/inline code, or the path-list cap truncated
1844
+
1824
1845
  // Agentic - Multi-Turn Context (optional)
1825
1846
  "conversation_turn"?: Long,
1826
1847
  "multi_turn_detection"?: Bool,
@@ -2332,6 +2353,13 @@ action call_tool appliesTo {
2332
2353
  // --- Tool Operation Classifier ---
2333
2354
  tool_operation_classes?: Set<String>, // subset of {"readonly", "write_enabling", "execute_enabling", "network_access", "unknown"}
2334
2355
 
2356
+ // --- Bash AST resolved target paths (#411 / CAP-DET-007) — newline-delimited (leading+trailing \\n); Cedar \`like\` is anchored so patterns start with "*": sub-tree "*\\n/etc/*", bare dir "*\\n/etc\\n*", exact "*\\n/etc/passwd\\n*" ---
2357
+ resolved_target_paths?: String, // union of resolved absolute target paths, any capability
2358
+ read_target_paths?: String, // paths the command reads or enumerates
2359
+ write_target_paths?: String, // paths the command writes, creates, or destroys
2360
+ exec_target_paths?: String, // paths executed as a script
2361
+ unresolved_target?: Bool, // a target hid behind a variable/glob/$()/inline code
2362
+
2335
2363
  // --- Session Detection History (cross-turn sticky flags) ---
2336
2364
  session_pii_detected?: Bool,
2337
2365
  session_pii_types?: Set<String>,
@@ -3376,6 +3404,11 @@ export const AGENT_OPS_CONTEXT = {
3376
3404
  { "key": "encoded_count", "type": "number", "required": false, "description": "Number of encoded segments found in tool arguments" },
3377
3405
  { "key": "encoded_score", "type": "number", "required": false, "description": "Risk score for encoded injection in tool arguments (0-100)." },
3378
3406
  { "key": "tool_operation_classes", "type": "array", "required": false, "description": "All operation classes observed in the tool call, emitted by the AST command classifiers. Subset of: \'readonly\', \'write_enabling\', \'execute_enabling\', \'network_access\', \'unknown\'. A single command can carry several classes; combine with contains() to match shapes — e.g. tool_operation_classes.contains(\"network_access\") && tool_operation_classes.contains(\"execute_enabling\") catches download-and-run (curl | sh). \'unknown\' appears when any unrecognized or variable-expanded command was seen and should be treated as deny-worthy." },
3407
+ { "key": "resolved_target_paths", "type": "string", "required": false, "description": "Newline-delimited (leading+trailing \\n) union of the statically-resolved absolute target paths a shell command touches, any capability, emitted by the bash AST detector. Cedar like is full-string anchored and every value starts with the \\n delimiter, so patterns must begin with \'*\': anchored sub-tree \"*\\n/etc/*\" (matches only paths under /etc, unlike the loose \"*/etc/*\" which also hits a project etc/ dir at any depth), bare directory \"*\\n/etc\\n*\" (e.g. rm -rf /etc, no trailing slash), exact file \"*\\n/etc/passwd\\n*\". Resolution is purely lexical (cwd-join + path.Clean; quoting, escapes, wrappers, cd/VAR/bash -c normalized); remote endpoints and dynamic operands are never fabricated." },
3408
+ { "key": "read_target_paths", "type": "string", "required": false, "description": "Newline-delimited resolved absolute paths a shell command reads or enumerates, emitted by the bash AST detector. \\n-anchored: match with like patterns that begin with \'*\' (see resolved_target_paths)." },
3409
+ { "key": "write_target_paths", "type": "string", "required": false, "description": "Newline-delimited resolved absolute paths a shell command writes, creates, or destroys (redirects, cp/mv/dd, curl/wget -o, scp/rsync local dest, tar/unzip/cpio extraction, yq -i), emitted by the bash AST detector. \\n-anchored: e.g. write_target_paths like \"*\\n/etc/cron.d/*\"." },
3410
+ { "key": "exec_target_paths", "type": "string", "required": false, "description": "Newline-delimited resolved absolute paths a shell command executes as a script, emitted by the bash AST detector. \\n-anchored: match with like patterns that begin with \'*\' (see resolved_target_paths)." },
3411
+ { "key": "unresolved_target", "type": "boolean", "required": false, "description": "True when a shell command\'s target hid behind a variable, glob, command substitution, or inline shell code that static analysis could not resolve, or when the 64-path / 4096-byte path-list cap truncated the results. Benign dev traffic sets this frequently (variables, globs, and command substitution are everywhere, and the truncation cap trips it too), so it is NOT a deny signal on its own — combine it with a path or operation match, and reserve a blanket deny-on-unresolved rule for high-assurance or allowlisted environments." },
3379
3412
  { "key": "path", "type": "string", "required": false, "description": "File path targeted by the tool call" },
3380
3413
  { "key": "conversation_turn", "type": "number", "required": false, "description": "Current conversation turn number" },
3381
3414
  { "key": "multi_turn_detection", "type": "boolean", "required": false, "description": "Whether multi-turn injection patterns were detected across tool calls" },
@@ -3698,6 +3731,11 @@ export const AI_GATEWAY_CONTEXT = {
3698
3731
  { "key": "tool_is_sensitive", "type": "boolean", "required": false, "description": "Tool sensitivity flag" },
3699
3732
  { "key": "tool_is_builtin", "type": "boolean", "required": false, "description": "Built-in tool flag" },
3700
3733
  { "key": "tool_operation_classes", "type": "array", "required": false, "description": "All operation classes observed in the tool call, emitted by the AST command classifiers. Subset of: \'readonly\', \'write_enabling\', \'execute_enabling\', \'network_access\', \'unknown\'. A single command can carry several classes; combine with contains() to match shapes — e.g. tool_operation_classes.contains(\"network_access\") && tool_operation_classes.contains(\"execute_enabling\") catches download-and-run (curl | sh). \'unknown\' appears when any unrecognized or variable-expanded command was seen and should be treated as deny-worthy." },
3734
+ { "key": "resolved_target_paths", "type": "string", "required": false, "description": "Newline-delimited (leading+trailing \\n) union of the statically-resolved absolute target paths a shell command touches, any capability, emitted by the bash AST detector. Cedar like is full-string anchored and every value starts with the \\n delimiter, so patterns must begin with \'*\': anchored sub-tree \"*\\n/etc/*\" (matches only paths under /etc, unlike the loose \"*/etc/*\" which also hits a project etc/ dir at any depth), bare directory \"*\\n/etc\\n*\" (e.g. rm -rf /etc, no trailing slash), exact file \"*\\n/etc/passwd\\n*\". Resolution is purely lexical (cwd-join + path.Clean; quoting, escapes, wrappers, cd/VAR/bash -c normalized); remote endpoints and dynamic operands are never fabricated. NOTE (AI Gateway): declared ahead of runtime emission — the gateway does not populate this until the bash classifier is wired (#173); policies validate now but will not match in the interim." },
3735
+ { "key": "read_target_paths", "type": "string", "required": false, "description": "Newline-delimited resolved absolute paths a shell command reads or enumerates, emitted by the bash AST detector. \\n-anchored: match with like patterns that begin with \'*\' (see resolved_target_paths). NOTE (AI Gateway): declared ahead of runtime emission — the gateway does not populate this until the bash classifier is wired (#173); policies validate now but will not match in the interim." },
3736
+ { "key": "write_target_paths", "type": "string", "required": false, "description": "Newline-delimited resolved absolute paths a shell command writes, creates, or destroys (redirects, cp/mv/dd, curl/wget -o, scp/rsync local dest, tar/unzip/cpio extraction, yq -i), emitted by the bash AST detector. \\n-anchored: e.g. write_target_paths like \"*\\n/etc/cron.d/*\". NOTE (AI Gateway): declared ahead of runtime emission — the gateway does not populate this until the bash classifier is wired (#173); policies validate now but will not match in the interim." },
3737
+ { "key": "exec_target_paths", "type": "string", "required": false, "description": "Newline-delimited resolved absolute paths a shell command executes as a script, emitted by the bash AST detector. \\n-anchored: match with like patterns that begin with \'*\' (see resolved_target_paths). NOTE (AI Gateway): declared ahead of runtime emission — the gateway does not populate this until the bash classifier is wired (#173); policies validate now but will not match in the interim." },
3738
+ { "key": "unresolved_target", "type": "boolean", "required": false, "description": "True when a shell command\'s target hid behind a variable, glob, command substitution, or inline shell code that static analysis could not resolve, or when the 64-path / 4096-byte path-list cap truncated the results. Benign dev traffic sets this frequently (variables, globs, and command substitution are everywhere, and the truncation cap trips it too), so it is NOT a deny signal on its own — combine it with a path or operation match, and reserve a blanket deny-on-unresolved rule for high-assurance or allowlisted environments. NOTE (AI Gateway): declared ahead of runtime emission — the gateway does not populate this until the bash classifier is wired (#173); policies validate now but will not match in the interim." },
3701
3739
  { "key": "mcp_server_verified", "type": "boolean", "required": false, "description": "Whether server is from verified registry" },
3702
3740
  { "key": "violence_score", "type": "number", "required": false, "description": "Violence content score (0-100)" },
3703
3741
  { "key": "weapons_score", "type": "number", "required": false, "description": "Weapons content score (0-100)" },
@@ -4113,6 +4151,11 @@ export const GUARDRAILS_CONTEXT = {
4113
4151
  { "key": "mcp_input_request_types", "type": "array", "required": false, "description": "Threat shapes found in the input request (e.g. [\'credential_elicitation\', \'sampling_injection\', \'root_probe\']). Use .contains() to block a specific shape" },
4114
4152
  { "key": "mcp_input_request_methods", "type": "array", "required": false, "description": "MCP methods the server asked the client to perform (e.g. [\'elicitation/create\', \'sampling/createMessage\', \'roots/list\']). Independent of content, so a policy can refuse a capability outright — e.g. mcp_input_request_methods.contains(\"sampling/createMessage\") on an unverified server — rather than only reacting to a payload that was successfully classified" },
4115
4153
  { "key": "tool_operation_classes", "type": "array", "required": false, "description": "All operation classes observed in the tool call, emitted by the AST command classifiers. Subset of: \'readonly\', \'write_enabling\', \'execute_enabling\', \'network_access\', \'unknown\'. A single command can carry several classes; combine with contains() to match shapes — e.g. tool_operation_classes.contains(\"network_access\") && tool_operation_classes.contains(\"execute_enabling\") catches download-and-run (curl | sh). \'unknown\' appears when any unrecognized or variable-expanded command was seen and should be treated as deny-worthy." },
4154
+ { "key": "resolved_target_paths", "type": "string", "required": false, "description": "Newline-delimited (leading+trailing \\n) union of the statically-resolved absolute target paths a shell command touches, any capability, emitted by the bash AST detector. Cedar like is full-string anchored and every value starts with the \\n delimiter, so patterns must begin with \'*\': anchored sub-tree \"*\\n/etc/*\" (matches only paths under /etc, unlike the loose \"*/etc/*\" which also hits a project etc/ dir at any depth), bare directory \"*\\n/etc\\n*\" (e.g. rm -rf /etc, no trailing slash), exact file \"*\\n/etc/passwd\\n*\". Resolution is purely lexical (cwd-join + path.Clean; quoting, escapes, wrappers, cd/VAR/bash -c normalized); remote endpoints and dynamic operands are never fabricated." },
4155
+ { "key": "read_target_paths", "type": "string", "required": false, "description": "Newline-delimited resolved absolute paths a shell command reads or enumerates, emitted by the bash AST detector. \\n-anchored: match with like patterns that begin with \'*\' (see resolved_target_paths)." },
4156
+ { "key": "write_target_paths", "type": "string", "required": false, "description": "Newline-delimited resolved absolute paths a shell command writes, creates, or destroys (redirects, cp/mv/dd, curl/wget -o, scp/rsync local dest, tar/unzip/cpio extraction, yq -i), emitted by the bash AST detector. \\n-anchored: e.g. write_target_paths like \"*\\n/etc/cron.d/*\"." },
4157
+ { "key": "exec_target_paths", "type": "string", "required": false, "description": "Newline-delimited resolved absolute paths a shell command executes as a script, emitted by the bash AST detector. \\n-anchored: match with like patterns that begin with \'*\' (see resolved_target_paths)." },
4158
+ { "key": "unresolved_target", "type": "boolean", "required": false, "description": "True when a shell command\'s target hid behind a variable, glob, command substitution, or inline shell code that static analysis could not resolve, or when the 64-path / 4096-byte path-list cap truncated the results. Benign dev traffic sets this frequently (variables, globs, and command substitution are everywhere, and the truncation cap trips it too), so it is NOT a deny signal on its own — combine it with a path or operation match, and reserve a blanket deny-on-unresolved rule for high-assurance or allowlisted environments." },
4116
4159
  { "key": "cross_origin_detected", "type": "boolean", "required": false, "description": "Whether cross-origin escalation patterns were detected in tool calls crossing trust boundaries" },
4117
4160
  { "key": "cross_origin_type", "type": "string", "required": false, "description": "Type of cross-origin escalation detected in tool call" },
4118
4161
  { "key": "cross_origin_score", "type": "number", "required": false, "description": "Risk score for cross-origin escalation in tool calls (0-100)" },
@@ -4432,6 +4475,11 @@ export const OVERWATCH_CONTEXT = {
4432
4475
  { "key": "sequence_risk", "type": "number", "required": false, "description": "Behavioral sequence risk score (0-100)" },
4433
4476
  { "key": "mcp_server_verified", "type": "boolean", "required": false, "description": "Whether the MCP server is from a verified registry" },
4434
4477
  { "key": "tool_operation_classes", "type": "array", "required": false, "description": "All operation classes observed in the tool call, emitted by the AST command classifiers. Subset of: \'readonly\', \'write_enabling\', \'execute_enabling\', \'network_access\', \'unknown\'. A single command can carry several classes; combine with contains() to match shapes — e.g. tool_operation_classes.contains(\"network_access\") && tool_operation_classes.contains(\"execute_enabling\") catches download-and-run (curl | sh). Used by the Bash Operation Classes template. \'unknown\' appears when any unrecognized or variable-expanded command was seen and should be treated as deny-worthy." },
4478
+ { "key": "resolved_target_paths", "type": "string", "required": false, "description": "Newline-delimited (leading+trailing \\n) union of the statically-resolved absolute target paths a shell command touches, any capability, emitted by the bash AST detector. Cedar like is full-string anchored and every value starts with the \\n delimiter, so patterns must begin with \'*\': anchored sub-tree \"*\\n/etc/*\" (matches only paths under /etc, unlike the loose \"*/etc/*\" which also hits a project etc/ dir at any depth), bare directory \"*\\n/etc\\n*\" (e.g. rm -rf /etc, no trailing slash), exact file \"*\\n/etc/passwd\\n*\". Resolution is purely lexical (cwd-join + path.Clean; quoting, escapes, wrappers, cd/VAR/bash -c normalized); remote endpoints and dynamic operands are never fabricated." },
4479
+ { "key": "read_target_paths", "type": "string", "required": false, "description": "Newline-delimited resolved absolute paths a shell command reads or enumerates, emitted by the bash AST detector. \\n-anchored: match with like patterns that begin with \'*\' (see resolved_target_paths)." },
4480
+ { "key": "write_target_paths", "type": "string", "required": false, "description": "Newline-delimited resolved absolute paths a shell command writes, creates, or destroys (redirects, cp/mv/dd, curl/wget -o, scp/rsync local dest, tar/unzip/cpio extraction, yq -i), emitted by the bash AST detector. \\n-anchored: e.g. write_target_paths like \"*\\n/etc/cron.d/*\"." },
4481
+ { "key": "exec_target_paths", "type": "string", "required": false, "description": "Newline-delimited resolved absolute paths a shell command executes as a script, emitted by the bash AST detector. \\n-anchored: match with like patterns that begin with \'*\' (see resolved_target_paths)." },
4482
+ { "key": "unresolved_target", "type": "boolean", "required": false, "description": "True when a shell command\'s target hid behind a variable, glob, command substitution, or inline shell code that static analysis could not resolve, or when the 64-path / 4096-byte path-list cap truncated the results. Benign dev traffic sets this frequently (variables, globs, and command substitution are everywhere, and the truncation cap trips it too), so it is NOT a deny signal on its own — combine it with a path or operation match, and reserve a blanket deny-on-unresolved rule for high-assurance or allowlisted environments." },
4435
4483
  { "key": "package_install_detected", "type": "boolean", "required": false, "description": "True iff a package install/download command was recognized in the tool call arguments." },
4436
4484
  { "key": "malicious_package_detected", "type": "boolean", "required": false, "description": "True iff any referenced package has a known-malicious (MAL-) OSV advisory." },
4437
4485
  { "key": "malicious_package_score", "type": "number", "required": false, "description": "100 when a malicious package was detected, 0 otherwise." },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@highflame/policy",
3
- "version": "2.2.34",
3
+ "version": "2.2.36",
4
4
  "engines": {
5
5
  "node": ">=18"
6
6
  },
@@ -1,31 +0,0 @@
1
- // =============================================================================
2
- // File & Attachment Safety (Default)
3
- // =============================================================================
4
- // Blocks file uploads to AI chat services when document content contains
5
- // secrets. PII in uploads is handled by the canonical privacy.* templates
6
- // (defaults/pii*.cedar), which scope to upload_file.
7
- //
8
- // Context keys consumed:
9
- // - secrets_detected: Bool
10
- //
11
- // Compliance:
12
- // - NIST 800-53 SC-28; GDPR Art. 32
13
- //
14
- // Category: file-safety
15
- // Namespace: Sentry
16
- // =============================================================================
17
-
18
- @id("file-safety.block-upload-secrets")
19
- @name("Block file uploads with secrets")
20
- @description("Blocks upload_file when secrets_detected is true.")
21
- @severity("critical")
22
- @tags("category:file-safety,threat:secrets,detection:rule,surface:upload-file,owasp:llm06")
23
- @reject_message("File upload blocked: secrets or credentials detected in document content.")
24
- forbid (
25
- principal,
26
- action == Sentry::Action::"upload_file",
27
- resource
28
- )
29
- when {
30
- context has secrets_detected && context.secrets_detected == true
31
- };