@highflame/policy 2.0.9 → 2.1.0
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 +435 -0
- package/_schemas/guardrails/schema.cedarschema +225 -0
- package/_schemas/guardrails/templates/defaults/agentic_safety.cedar +94 -0
- package/_schemas/guardrails/templates/defaults/baseline.cedar +24 -0
- package/_schemas/guardrails/templates/defaults/injection.cedar +70 -0
- package/_schemas/guardrails/templates/defaults/pii.cedar +48 -0
- package/_schemas/guardrails/templates/defaults/secrets.cedar +40 -0
- package/_schemas/guardrails/templates/defaults/semantic.cedar +59 -0
- package/_schemas/guardrails/templates/defaults/tool_risk.cedar +58 -0
- package/_schemas/guardrails/templates/defaults/toxicity.cedar +76 -0
- package/_schemas/guardrails/templates/mcp_tool_permissions.cedar +84 -0
- package/_schemas/guardrails/templates/profiles/chat_assistant/privacy.cedar +22 -0
- package/_schemas/guardrails/templates/profiles/chat_assistant/security.cedar +35 -0
- package/_schemas/guardrails/templates/profiles/chat_assistant/trust_safety.cedar +43 -0
- package/_schemas/guardrails/templates/profiles/chat_assistant.cedar +85 -0
- package/_schemas/guardrails/templates/profiles/code_agent/agentic_security.cedar +109 -0
- package/_schemas/guardrails/templates/profiles/code_agent/security.cedar +22 -0
- package/_schemas/guardrails/templates/profiles/code_agent.cedar +125 -0
- package/_schemas/guardrails/templates/profiles/data_pipeline/agentic_security.cedar +38 -0
- package/_schemas/guardrails/templates/profiles/data_pipeline/privacy.cedar +40 -0
- package/_schemas/guardrails/templates/profiles/data_pipeline/security.cedar +49 -0
- package/_schemas/guardrails/templates/profiles/data_pipeline.cedar +111 -0
- package/_schemas/guardrails/templates/templates.json +213 -0
- package/_schemas/overwatch/context.json +54 -54
- package/_schemas/overwatch/schema.cedarschema +77 -68
- package/dist/builder.d.ts +106 -13
- package/dist/builder.js +103 -34
- package/dist/engine.d.ts +20 -2
- package/dist/engine.js +50 -20
- package/dist/entities.gen.d.ts +4 -0
- package/dist/entities.gen.js +4 -0
- package/dist/explain.d.ts +150 -0
- package/dist/explain.js +363 -0
- package/dist/guardrails-context.gen.d.ts +49 -0
- package/dist/guardrails-context.gen.js +50 -0
- package/dist/guardrails-defaults.gen.d.ts +61 -0
- package/dist/guardrails-defaults.gen.js +1278 -0
- package/dist/guardrails-entities.gen.d.ts +11 -0
- package/dist/guardrails-entities.gen.js +37 -0
- package/dist/index.d.ts +6 -1
- package/dist/index.js +6 -1
- package/dist/overwatch-defaults.gen.js +122 -2
- package/dist/parser.js +136 -4
- package/dist/schema.gen.d.ts +1 -1
- package/dist/schema.gen.js +6 -0
- package/dist/service-schemas.gen.d.ts +15 -11
- package/dist/service-schemas.gen.js +509 -84
- package/dist/types.d.ts +6 -1
- package/dist/types.js +6 -1
- package/package.json +5 -1
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
// =============================================================================
|
|
2
|
+
// Chat Assistant Profile
|
|
3
|
+
// =============================================================================
|
|
4
|
+
// Optimized for customer-facing chatbots and conversational AI.
|
|
5
|
+
// Strict content moderation, PII protection, and injection defense.
|
|
6
|
+
// No tool-related policies (chat assistants don't call tools).
|
|
7
|
+
//
|
|
8
|
+
// Deploy: One-click deploy scopes all rules to a specific application via
|
|
9
|
+
// resource == Guardrails::App::"<app-uuid>" (injected at deploy time).
|
|
10
|
+
//
|
|
11
|
+
// Category: organization
|
|
12
|
+
// Namespace: Guardrails
|
|
13
|
+
// =============================================================================
|
|
14
|
+
|
|
15
|
+
@id("chat-toxicity-strict")
|
|
16
|
+
@name("Strict toxicity for chat")
|
|
17
|
+
@description("Lower thresholds for customer-facing content — blocks toxicity above 70")
|
|
18
|
+
@severity("critical")
|
|
19
|
+
@tags("profile,chat-assistant,toxicity,trust-safety")
|
|
20
|
+
forbid (
|
|
21
|
+
principal,
|
|
22
|
+
action == Guardrails::Action::"process_prompt",
|
|
23
|
+
resource
|
|
24
|
+
) when {
|
|
25
|
+
context.violence_score > 70 ||
|
|
26
|
+
context.hate_speech_score > 70 ||
|
|
27
|
+
context.sexual_score > 70 ||
|
|
28
|
+
context.profanity_score > 70
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
@id("chat-pii-block-input-output")
|
|
32
|
+
@name("Block PII in both directions")
|
|
33
|
+
@description("Blocks PII in both user inputs and assistant outputs for chat applications")
|
|
34
|
+
@severity("high")
|
|
35
|
+
@tags("profile,chat-assistant,pii,privacy")
|
|
36
|
+
forbid (
|
|
37
|
+
principal,
|
|
38
|
+
action == Guardrails::Action::"process_prompt",
|
|
39
|
+
resource
|
|
40
|
+
) when {
|
|
41
|
+
context.pii_detected == true
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
@id("chat-injection-lower-threshold")
|
|
45
|
+
@name("Aggressive injection defense for chat")
|
|
46
|
+
@description("Lower injection threshold for public-facing chat — blocks above 70")
|
|
47
|
+
@severity("high")
|
|
48
|
+
@tags("profile,chat-assistant,injection,security")
|
|
49
|
+
forbid (
|
|
50
|
+
principal,
|
|
51
|
+
action == Guardrails::Action::"process_prompt",
|
|
52
|
+
resource
|
|
53
|
+
) when {
|
|
54
|
+
context.injection_score > 70
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
@id("chat-jailbreak-lower-threshold")
|
|
58
|
+
@name("Aggressive jailbreak defense for chat")
|
|
59
|
+
@description("Lower jailbreak threshold for public-facing chat — blocks above 65")
|
|
60
|
+
@severity("high")
|
|
61
|
+
@tags("profile,chat-assistant,jailbreak,security")
|
|
62
|
+
forbid (
|
|
63
|
+
principal,
|
|
64
|
+
action == Guardrails::Action::"process_prompt",
|
|
65
|
+
resource
|
|
66
|
+
) when {
|
|
67
|
+
context.jailbreak_score > 65
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
@id("chat-topic-restriction")
|
|
71
|
+
@name("Block restricted topics in chat")
|
|
72
|
+
@description("Prevents chat assistants from discussing dangerous or regulated topics")
|
|
73
|
+
@severity("high")
|
|
74
|
+
@tags("profile,chat-assistant,semantic,compliance")
|
|
75
|
+
forbid (
|
|
76
|
+
principal,
|
|
77
|
+
action == Guardrails::Action::"process_prompt",
|
|
78
|
+
resource
|
|
79
|
+
) when {
|
|
80
|
+
context.topic_confidence > 70 &&
|
|
81
|
+
(context.content_topics.contains("weapons_manufacturing") ||
|
|
82
|
+
context.content_topics.contains("illegal_activity") ||
|
|
83
|
+
context.content_topics.contains("controlled_substances") ||
|
|
84
|
+
context.content_topics.contains("financial_fraud"))
|
|
85
|
+
};
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
// =============================================================================
|
|
2
|
+
// Code Agent — Agentic Security
|
|
3
|
+
// =============================================================================
|
|
4
|
+
// Tool risk controls, shell execution blocking, loop detection,
|
|
5
|
+
// exfiltration prevention, and budget enforcement for coding assistants.
|
|
6
|
+
//
|
|
7
|
+
// Category: agentic_security
|
|
8
|
+
// Namespace: Guardrails
|
|
9
|
+
// =============================================================================
|
|
10
|
+
|
|
11
|
+
@id("code-block-dangerous-tools")
|
|
12
|
+
@name("Block dangerous tool execution")
|
|
13
|
+
@description("Forbids tools classified as dangerous or with very high risk scores")
|
|
14
|
+
@severity("critical")
|
|
15
|
+
@tags("profile,code-agent,tools,agentic")
|
|
16
|
+
forbid (
|
|
17
|
+
principal,
|
|
18
|
+
action == Guardrails::Action::"call_tool",
|
|
19
|
+
resource
|
|
20
|
+
) when {
|
|
21
|
+
(context has tool_risk_score && context.tool_risk_score > 85) ||
|
|
22
|
+
(context has tool_category && context.tool_category == "dangerous")
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
@id("code-block-shell-execution")
|
|
26
|
+
@name("Block direct shell commands")
|
|
27
|
+
@description("Forbids direct shell and command execution tools")
|
|
28
|
+
@severity("high")
|
|
29
|
+
@tags("profile,code-agent,tools,shell")
|
|
30
|
+
forbid (
|
|
31
|
+
principal,
|
|
32
|
+
action == Guardrails::Action::"call_tool",
|
|
33
|
+
resource
|
|
34
|
+
) when {
|
|
35
|
+
context has tool_name &&
|
|
36
|
+
(context.tool_name == "shell" ||
|
|
37
|
+
context.tool_name == "execute_command" ||
|
|
38
|
+
context.tool_name == "bash")
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
@id("code-block-sensitive-tools")
|
|
42
|
+
@name("Block sensitive tools with elevated risk")
|
|
43
|
+
@description("Forbids sensitive tool calls with risk above 70")
|
|
44
|
+
@severity("high")
|
|
45
|
+
@tags("profile,code-agent,tools,security")
|
|
46
|
+
forbid (
|
|
47
|
+
principal,
|
|
48
|
+
action == Guardrails::Action::"call_tool",
|
|
49
|
+
resource
|
|
50
|
+
) when {
|
|
51
|
+
context has tool_is_sensitive && context.tool_is_sensitive == true &&
|
|
52
|
+
context has tool_risk_score && context.tool_risk_score > 70
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
@id("code-block-loops")
|
|
56
|
+
@name("Block tool call loops")
|
|
57
|
+
@description("Stops infinite tool call loops in agentic workflows")
|
|
58
|
+
@severity("high")
|
|
59
|
+
@tags("profile,code-agent,agentic,loops")
|
|
60
|
+
forbid (
|
|
61
|
+
principal,
|
|
62
|
+
action == Guardrails::Action::"call_tool",
|
|
63
|
+
resource
|
|
64
|
+
) when {
|
|
65
|
+
context has loop_detected && context.loop_detected == true &&
|
|
66
|
+
context has loop_count && context.loop_count > 5
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
@id("code-block-exfiltration")
|
|
70
|
+
@name("Block data exfiltration patterns")
|
|
71
|
+
@description("Detects and blocks read → send patterns indicating data theft")
|
|
72
|
+
@severity("critical")
|
|
73
|
+
@tags("profile,code-agent,agentic,exfiltration")
|
|
74
|
+
forbid (
|
|
75
|
+
principal,
|
|
76
|
+
action,
|
|
77
|
+
resource
|
|
78
|
+
) when {
|
|
79
|
+
context has suspicious_pattern && context.suspicious_pattern == true &&
|
|
80
|
+
context has pattern_type &&
|
|
81
|
+
(context.pattern_type == "data_exfiltration" ||
|
|
82
|
+
context.pattern_type == "secret_exfiltration")
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
@id("code-block-high-sequence-risk")
|
|
86
|
+
@name("Block high-risk action sequences")
|
|
87
|
+
@description("Forbids suspicious multi-step tool sequences with risk above 75")
|
|
88
|
+
@severity("high")
|
|
89
|
+
@tags("profile,code-agent,agentic,patterns")
|
|
90
|
+
forbid (
|
|
91
|
+
principal,
|
|
92
|
+
action,
|
|
93
|
+
resource
|
|
94
|
+
) when {
|
|
95
|
+
context has sequence_risk && context.sequence_risk > 75
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
@id("code-block-budget-exceeded")
|
|
99
|
+
@name("Block on budget exceeded")
|
|
100
|
+
@description("Stops agent execution when token budget is exhausted")
|
|
101
|
+
@severity("medium")
|
|
102
|
+
@tags("profile,code-agent,budget,cost-control")
|
|
103
|
+
forbid (
|
|
104
|
+
principal,
|
|
105
|
+
action,
|
|
106
|
+
resource
|
|
107
|
+
) when {
|
|
108
|
+
context has budget_exceeded && context.budget_exceeded == true
|
|
109
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
// =============================================================================
|
|
2
|
+
// Code Agent — Security
|
|
3
|
+
// =============================================================================
|
|
4
|
+
// Secrets protection for coding assistants.
|
|
5
|
+
// Prevents code agents from writing detected secrets to output files.
|
|
6
|
+
//
|
|
7
|
+
// Category: security
|
|
8
|
+
// Namespace: Guardrails
|
|
9
|
+
// =============================================================================
|
|
10
|
+
|
|
11
|
+
@id("code-block-write-secrets")
|
|
12
|
+
@name("Block writing secrets to files")
|
|
13
|
+
@description("Prevents code agents from writing detected secrets to output files")
|
|
14
|
+
@severity("critical")
|
|
15
|
+
@tags("profile,code-agent,secrets,security")
|
|
16
|
+
forbid (
|
|
17
|
+
principal,
|
|
18
|
+
action == Guardrails::Action::"write_file",
|
|
19
|
+
resource
|
|
20
|
+
) when {
|
|
21
|
+
context has contains_secrets && context.contains_secrets == true
|
|
22
|
+
};
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
// =============================================================================
|
|
2
|
+
// Code Agent Profile
|
|
3
|
+
// =============================================================================
|
|
4
|
+
// Optimized for coding assistants and agentic development tools.
|
|
5
|
+
// Focuses on tool risk, shell execution controls, agentic safety patterns,
|
|
6
|
+
// and data exfiltration prevention. Relaxed toxicity (code discussions may
|
|
7
|
+
// reference security topics legitimately).
|
|
8
|
+
//
|
|
9
|
+
// Deploy: One-click deploy scopes all rules to a specific application via
|
|
10
|
+
// resource == Guardrails::App::"<app-uuid>" (injected at deploy time).
|
|
11
|
+
//
|
|
12
|
+
// Category: agentic_security
|
|
13
|
+
// Namespace: Guardrails
|
|
14
|
+
// =============================================================================
|
|
15
|
+
|
|
16
|
+
@id("code-block-dangerous-tools")
|
|
17
|
+
@name("Block dangerous tool execution")
|
|
18
|
+
@description("Forbids tools classified as dangerous or with very high risk scores")
|
|
19
|
+
@severity("critical")
|
|
20
|
+
@tags("profile,code-agent,tools,agentic")
|
|
21
|
+
forbid (
|
|
22
|
+
principal,
|
|
23
|
+
action == Guardrails::Action::"call_tool",
|
|
24
|
+
resource
|
|
25
|
+
) when {
|
|
26
|
+
context.tool_risk_score > 85 ||
|
|
27
|
+
context.tool_category == "dangerous"
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
@id("code-block-shell-execution")
|
|
31
|
+
@name("Block direct shell commands")
|
|
32
|
+
@description("Forbids direct shell and command execution tools")
|
|
33
|
+
@severity("high")
|
|
34
|
+
@tags("profile,code-agent,tools,shell")
|
|
35
|
+
forbid (
|
|
36
|
+
principal,
|
|
37
|
+
action == Guardrails::Action::"call_tool",
|
|
38
|
+
resource
|
|
39
|
+
) when {
|
|
40
|
+
context.tool_name == "shell" ||
|
|
41
|
+
context.tool_name == "execute_command" ||
|
|
42
|
+
context.tool_name == "bash"
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
@id("code-block-sensitive-tools")
|
|
46
|
+
@name("Block sensitive tools with elevated risk")
|
|
47
|
+
@description("Forbids sensitive tool calls with risk above 70")
|
|
48
|
+
@severity("high")
|
|
49
|
+
@tags("profile,code-agent,tools,security")
|
|
50
|
+
forbid (
|
|
51
|
+
principal,
|
|
52
|
+
action == Guardrails::Action::"call_tool",
|
|
53
|
+
resource
|
|
54
|
+
) when {
|
|
55
|
+
context.tool_is_sensitive == true &&
|
|
56
|
+
context.tool_risk_score > 70
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
@id("code-block-loops")
|
|
60
|
+
@name("Block tool call loops")
|
|
61
|
+
@description("Stops infinite tool call loops in agentic workflows")
|
|
62
|
+
@severity("high")
|
|
63
|
+
@tags("profile,code-agent,agentic,loops")
|
|
64
|
+
forbid (
|
|
65
|
+
principal,
|
|
66
|
+
action == Guardrails::Action::"call_tool",
|
|
67
|
+
resource
|
|
68
|
+
) when {
|
|
69
|
+
context.loop_detected == true &&
|
|
70
|
+
context.loop_count > 5
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
@id("code-block-exfiltration")
|
|
74
|
+
@name("Block data exfiltration patterns")
|
|
75
|
+
@description("Detects and blocks read → send patterns indicating data theft")
|
|
76
|
+
@severity("critical")
|
|
77
|
+
@tags("profile,code-agent,agentic,exfiltration")
|
|
78
|
+
forbid (
|
|
79
|
+
principal,
|
|
80
|
+
action,
|
|
81
|
+
resource
|
|
82
|
+
) when {
|
|
83
|
+
context.suspicious_pattern == true &&
|
|
84
|
+
(context.pattern_type == "data_exfiltration" ||
|
|
85
|
+
context.pattern_type == "secret_exfiltration")
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
@id("code-block-high-sequence-risk")
|
|
89
|
+
@name("Block high-risk action sequences")
|
|
90
|
+
@description("Forbids suspicious multi-step tool sequences with risk above 75")
|
|
91
|
+
@severity("high")
|
|
92
|
+
@tags("profile,code-agent,agentic,patterns")
|
|
93
|
+
forbid (
|
|
94
|
+
principal,
|
|
95
|
+
action,
|
|
96
|
+
resource
|
|
97
|
+
) when {
|
|
98
|
+
context.sequence_risk > 75
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
@id("code-block-budget-exceeded")
|
|
102
|
+
@name("Block on budget exceeded")
|
|
103
|
+
@description("Stops agent execution when token budget is exhausted")
|
|
104
|
+
@severity("medium")
|
|
105
|
+
@tags("profile,code-agent,budget,cost-control")
|
|
106
|
+
forbid (
|
|
107
|
+
principal,
|
|
108
|
+
action,
|
|
109
|
+
resource
|
|
110
|
+
) when {
|
|
111
|
+
context.budget_exceeded == true
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
@id("code-block-write-secrets")
|
|
115
|
+
@name("Block writing secrets to files")
|
|
116
|
+
@description("Prevents code agents from writing detected secrets to output files")
|
|
117
|
+
@severity("critical")
|
|
118
|
+
@tags("profile,code-agent,secrets,security")
|
|
119
|
+
forbid (
|
|
120
|
+
principal,
|
|
121
|
+
action == Guardrails::Action::"write_file",
|
|
122
|
+
resource
|
|
123
|
+
) when {
|
|
124
|
+
context.contains_secrets == true
|
|
125
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
// =============================================================================
|
|
2
|
+
// Data Pipeline — Agentic Security
|
|
3
|
+
// =============================================================================
|
|
4
|
+
// Exfiltration prevention and tool risk controls for data pipelines.
|
|
5
|
+
// Prevents retrieval data from being sent to external endpoints.
|
|
6
|
+
//
|
|
7
|
+
// Category: agentic_security
|
|
8
|
+
// Namespace: Guardrails
|
|
9
|
+
// =============================================================================
|
|
10
|
+
|
|
11
|
+
@id("data-block-exfiltration")
|
|
12
|
+
@name("Block data exfiltration from pipeline")
|
|
13
|
+
@description("Prevents retrieval data from being sent to external endpoints")
|
|
14
|
+
@severity("critical")
|
|
15
|
+
@tags("profile,data-pipeline,exfiltration,security")
|
|
16
|
+
forbid (
|
|
17
|
+
principal,
|
|
18
|
+
action,
|
|
19
|
+
resource
|
|
20
|
+
) when {
|
|
21
|
+
context has suspicious_pattern && context.suspicious_pattern == true &&
|
|
22
|
+
context has pattern_type &&
|
|
23
|
+
(context.pattern_type == "data_exfiltration" ||
|
|
24
|
+
context.pattern_type == "db_exfiltration")
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
@id("data-block-high-risk-tools")
|
|
28
|
+
@name("Block high-risk tools in pipeline")
|
|
29
|
+
@description("Forbids tools with elevated risk in data processing context")
|
|
30
|
+
@severity("high")
|
|
31
|
+
@tags("profile,data-pipeline,tools,security")
|
|
32
|
+
forbid (
|
|
33
|
+
principal,
|
|
34
|
+
action == Guardrails::Action::"call_tool",
|
|
35
|
+
resource
|
|
36
|
+
) when {
|
|
37
|
+
context has tool_risk_score && context.tool_risk_score > 60
|
|
38
|
+
};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
// =============================================================================
|
|
2
|
+
// Data Pipeline — Privacy
|
|
3
|
+
// =============================================================================
|
|
4
|
+
// Strict PII protection for RAG pipelines and data processing agents.
|
|
5
|
+
// Zero-tolerance for sensitive PII types — data pipelines must not leak PII.
|
|
6
|
+
//
|
|
7
|
+
// Category: privacy
|
|
8
|
+
// Namespace: Guardrails
|
|
9
|
+
// =============================================================================
|
|
10
|
+
|
|
11
|
+
@id("data-pii-block-all")
|
|
12
|
+
@name("Block all PII in data pipeline")
|
|
13
|
+
@description("Forbids any PII in both inputs and outputs — data pipelines must not process or leak PII")
|
|
14
|
+
@severity("critical")
|
|
15
|
+
@tags("profile,data-pipeline,pii,privacy")
|
|
16
|
+
forbid (
|
|
17
|
+
principal,
|
|
18
|
+
action,
|
|
19
|
+
resource
|
|
20
|
+
) when {
|
|
21
|
+
context has pii_detected && context.pii_detected == true
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
@id("data-pii-block-sensitive-types")
|
|
25
|
+
@name("Block sensitive PII types strictly")
|
|
26
|
+
@description("Zero-tolerance for SSN, credit cards, passport numbers, and medical IDs in data pipelines")
|
|
27
|
+
@severity("critical")
|
|
28
|
+
@tags("profile,data-pipeline,pii,compliance")
|
|
29
|
+
forbid (
|
|
30
|
+
principal,
|
|
31
|
+
action,
|
|
32
|
+
resource
|
|
33
|
+
) when {
|
|
34
|
+
context has pii_types &&
|
|
35
|
+
(context.pii_types.contains("ssn") ||
|
|
36
|
+
context.pii_types.contains("credit_card") ||
|
|
37
|
+
context.pii_types.contains("passport") ||
|
|
38
|
+
context.pii_types.contains("medical_id") ||
|
|
39
|
+
context.pii_types.contains("tax_id"))
|
|
40
|
+
};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
// =============================================================================
|
|
2
|
+
// Data Pipeline — Security
|
|
3
|
+
// =============================================================================
|
|
4
|
+
// Strict secrets detection and injection defense for data pipelines.
|
|
5
|
+
// RAG inputs are high-risk for injection — lower thresholds than defaults.
|
|
6
|
+
//
|
|
7
|
+
// Category: security
|
|
8
|
+
// Namespace: Guardrails
|
|
9
|
+
// =============================================================================
|
|
10
|
+
|
|
11
|
+
@id("data-secrets-strict")
|
|
12
|
+
@name("Strict secrets detection for data pipeline")
|
|
13
|
+
@description("Blocks any content containing secrets — even a single match")
|
|
14
|
+
@severity("critical")
|
|
15
|
+
@tags("profile,data-pipeline,secrets,security")
|
|
16
|
+
forbid (
|
|
17
|
+
principal,
|
|
18
|
+
action,
|
|
19
|
+
resource
|
|
20
|
+
) when {
|
|
21
|
+
context has contains_secrets && context.contains_secrets == true
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
@id("data-block-output-secrets")
|
|
25
|
+
@name("Block secrets in pipeline outputs")
|
|
26
|
+
@description("Prevents data pipeline from writing secrets to any output")
|
|
27
|
+
@severity("critical")
|
|
28
|
+
@tags("profile,data-pipeline,secrets,output")
|
|
29
|
+
forbid (
|
|
30
|
+
principal,
|
|
31
|
+
action == Guardrails::Action::"write_file",
|
|
32
|
+
resource
|
|
33
|
+
) when {
|
|
34
|
+
(context has contains_secrets && context.contains_secrets == true) ||
|
|
35
|
+
(context has secret_count && context.secret_count > 0)
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
@id("data-injection-defense")
|
|
39
|
+
@name("Pipeline injection defense")
|
|
40
|
+
@description("Lower injection threshold for data pipelines — RAG inputs are high-risk for injection")
|
|
41
|
+
@severity("high")
|
|
42
|
+
@tags("profile,data-pipeline,injection,security")
|
|
43
|
+
forbid (
|
|
44
|
+
principal,
|
|
45
|
+
action,
|
|
46
|
+
resource
|
|
47
|
+
) when {
|
|
48
|
+
context has injection_score && context.injection_score > 65
|
|
49
|
+
};
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
// =============================================================================
|
|
2
|
+
// Data Pipeline Profile
|
|
3
|
+
// =============================================================================
|
|
4
|
+
// Optimized for RAG pipelines, data processing agents, and retrieval systems.
|
|
5
|
+
// Strong PII and secrets protection, exfiltration detection, and output
|
|
6
|
+
// filtering. Focused on data integrity and privacy compliance.
|
|
7
|
+
//
|
|
8
|
+
// Deploy: One-click deploy scopes all rules to a specific application via
|
|
9
|
+
// resource == Guardrails::App::"<app-uuid>" (injected at deploy time).
|
|
10
|
+
//
|
|
11
|
+
// Category: privacy
|
|
12
|
+
// Namespace: Guardrails
|
|
13
|
+
// =============================================================================
|
|
14
|
+
|
|
15
|
+
@id("data-pii-block-all")
|
|
16
|
+
@name("Block all PII in data pipeline")
|
|
17
|
+
@description("Forbids any PII in both inputs and outputs — data pipelines must not process or leak PII")
|
|
18
|
+
@severity("critical")
|
|
19
|
+
@tags("profile,data-pipeline,pii,privacy")
|
|
20
|
+
forbid (
|
|
21
|
+
principal,
|
|
22
|
+
action == Guardrails::Action::"process_prompt",
|
|
23
|
+
resource
|
|
24
|
+
) when {
|
|
25
|
+
context.pii_detected == true
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
@id("data-pii-block-sensitive-types")
|
|
29
|
+
@name("Block sensitive PII types strictly")
|
|
30
|
+
@description("Zero-tolerance for SSN, credit cards, passport numbers, and medical IDs in data pipelines")
|
|
31
|
+
@severity("critical")
|
|
32
|
+
@tags("profile,data-pipeline,pii,compliance")
|
|
33
|
+
forbid (
|
|
34
|
+
principal,
|
|
35
|
+
action == Guardrails::Action::"process_prompt",
|
|
36
|
+
resource
|
|
37
|
+
) when {
|
|
38
|
+
context.pii_types.contains("ssn") ||
|
|
39
|
+
context.pii_types.contains("credit_card") ||
|
|
40
|
+
context.pii_types.contains("passport") ||
|
|
41
|
+
context.pii_types.contains("medical_id") ||
|
|
42
|
+
context.pii_types.contains("tax_id")
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
@id("data-secrets-strict")
|
|
46
|
+
@name("Strict secrets detection for data pipeline")
|
|
47
|
+
@description("Blocks any content containing secrets — even a single match")
|
|
48
|
+
@severity("critical")
|
|
49
|
+
@tags("profile,data-pipeline,secrets,security")
|
|
50
|
+
forbid (
|
|
51
|
+
principal,
|
|
52
|
+
action,
|
|
53
|
+
resource
|
|
54
|
+
) when {
|
|
55
|
+
context.contains_secrets == true
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
@id("data-block-exfiltration")
|
|
59
|
+
@name("Block data exfiltration from pipeline")
|
|
60
|
+
@description("Prevents retrieval data from being sent to external endpoints")
|
|
61
|
+
@severity("critical")
|
|
62
|
+
@tags("profile,data-pipeline,exfiltration,security")
|
|
63
|
+
forbid (
|
|
64
|
+
principal,
|
|
65
|
+
action,
|
|
66
|
+
resource
|
|
67
|
+
) when {
|
|
68
|
+
context.suspicious_pattern == true &&
|
|
69
|
+
(context.pattern_type == "data_exfiltration" ||
|
|
70
|
+
context.pattern_type == "db_exfiltration")
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
@id("data-block-high-risk-tools")
|
|
74
|
+
@name("Block high-risk tools in pipeline")
|
|
75
|
+
@description("Forbids tools with elevated risk in data processing context")
|
|
76
|
+
@severity("high")
|
|
77
|
+
@tags("profile,data-pipeline,tools,security")
|
|
78
|
+
forbid (
|
|
79
|
+
principal,
|
|
80
|
+
action == Guardrails::Action::"call_tool",
|
|
81
|
+
resource
|
|
82
|
+
) when {
|
|
83
|
+
context.tool_risk_score > 60
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
@id("data-block-output-secrets")
|
|
87
|
+
@name("Block secrets in pipeline outputs")
|
|
88
|
+
@description("Prevents data pipeline from writing secrets to any output")
|
|
89
|
+
@severity("critical")
|
|
90
|
+
@tags("profile,data-pipeline,secrets,output")
|
|
91
|
+
forbid (
|
|
92
|
+
principal,
|
|
93
|
+
action == Guardrails::Action::"write_file",
|
|
94
|
+
resource
|
|
95
|
+
) when {
|
|
96
|
+
context.contains_secrets == true ||
|
|
97
|
+
context.secret_count > 0
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
@id("data-injection-defense")
|
|
101
|
+
@name("Pipeline injection defense")
|
|
102
|
+
@description("Lower injection threshold for data pipelines — RAG inputs are high-risk for injection")
|
|
103
|
+
@severity("high")
|
|
104
|
+
@tags("profile,data-pipeline,injection,security")
|
|
105
|
+
forbid (
|
|
106
|
+
principal,
|
|
107
|
+
action == Guardrails::Action::"process_prompt",
|
|
108
|
+
resource
|
|
109
|
+
) when {
|
|
110
|
+
context.injection_score > 65
|
|
111
|
+
};
|