-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathinfrastructure-manager.policy.yaml
More file actions
209 lines (182 loc) · 4.29 KB
/
infrastructure-manager.policy.yaml
File metadata and controls
209 lines (182 loc) · 4.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
# Infrastructure Manager Agent Policy
# Constrains an infrastructure management agent that handles server
# configurations, manages deployments, monitors services, and maintains
# infrastructure-as-code files. Strict human gates on all destructive operations.
version: "1.0"
name: "infrastructure-manager"
description: "Policy for an infrastructure management agent that handles configs, deployments, monitoring, and IaC with strict human approval on destructive operations."
capabilities:
- tool: "file:read"
scope:
paths:
- "./infrastructure/**"
- "./config/**"
- "./terraform/**"
- "./ansible/**"
- "./k8s/**"
- "./docker/**"
- "./monitoring/**"
- tool: "file:write"
scope:
paths:
- "./infrastructure/**"
- "./config/**"
- "./terraform/**"
- "./ansible/**"
- "./k8s/**"
- "./docker/**"
- "./monitoring/**"
- "./tmp/infra/**"
- tool: "file:copy"
scope:
paths:
- "./infrastructure/**"
- "./config/**"
- "./tmp/infra/**"
- tool: "file:move"
scope:
paths:
- "./infrastructure/**"
- "./config/**"
- "./tmp/infra/**"
- tool: "file:delete"
scope:
paths:
- "./tmp/infra/**"
- tool: "directory:list"
scope:
paths:
- "./**"
- tool: "directory:create"
scope:
paths:
- "./infrastructure/**"
- "./config/**"
- "./tmp/infra/**"
- tool: "command:run"
scope:
binaries:
- "terraform"
- "ansible"
- "ansible-playbook"
- "kubectl"
- "docker"
- "docker-compose"
- "helm"
- "git"
- "ssh"
- "scp"
- "curl"
- "jq"
- "yq"
- "cat"
- "ls"
- tool: "git:diff"
scope:
repos: ["."]
- tool: "git:status"
scope:
repos: ["."]
- tool: "git:commit"
scope:
repos: ["."]
- tool: "git:apply"
scope:
repos: ["."]
- tool: "http:request"
scope:
domains:
- "api.github.com"
- "registry.terraform.io"
- "k8s.internal.yourcompany.com"
- "monitoring.internal.yourcompany.com"
- "vault.internal.yourcompany.com"
methods:
- "GET"
- "POST"
- "PUT"
- tool: "env:read"
scope: {}
- tool: "network:dns"
scope:
domains:
- "api.github.com"
- "registry.terraform.io"
- "k8s.internal.yourcompany.com"
- tool: "archive:extract"
scope:
paths:
- "./tmp/infra/**"
limits:
max_runtime_ms: 1800000 # 30 minutes
max_output_bytes: 536870912 # 512 MB
max_files_changed: 100
max_retries: 2
max_cost_usd: 10.0
gates:
- action: "file:delete"
approval: "human"
risk_level: "critical"
- action: "file:move"
approval: "human"
risk_level: "high"
- action: "git:commit"
approval: "human"
risk_level: "high"
- action: "command:run"
approval: "human"
risk_level: "high"
condition: "outside_scope"
- action: "http:request"
approval: "human"
risk_level: "high"
condition: "POST|PUT"
evidence:
require:
- "checksums"
- "diffs"
- "exit_codes"
- "logs"
format: "jsonl"
forbidden:
- pattern: "**/.env"
- pattern: "**/.env.*"
- pattern: "**/credentials*"
- pattern: "**/secrets*"
- pattern: "**/private_key*"
- pattern: "**/*.pem"
- pattern: "**/*.key"
- pattern: "rm -rf /"
- pattern: "terraform destroy"
- pattern: "kubectl delete namespace"
- pattern: "kubectl delete --all"
- pattern: "docker system prune"
- pattern: "ansible-playbook --extra-vars"
- pattern: "curl | sh"
- pattern: "wget | sh"
- pattern: "git push --force"
session:
max_actions: 200
max_denials: 15
rate_limit:
max_per_minute: 30
escalation:
- after_actions: 50
require: human_checkin
- after_minutes: 10
require: human_checkin
remediation:
rules:
- match: "terraform error"
action: "abort"
- match: "ansible fatal"
action: "abort"
- match: "kubectl error"
action: "retry"
- match: "ECONNREFUSED"
action: "retry"
- match: "permission denied"
action: "abort"
- match: "timeout"
action: "retry"
fallback_chain: ["retry", "abort"]