-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathauth-policies.example.yaml
More file actions
373 lines (338 loc) · 9.25 KB
/
Copy pathauth-policies.example.yaml
File metadata and controls
373 lines (338 loc) · 9.25 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
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
# Zeal Authorization Policies Example
# These policies work with claims from any JWT-based identity provider
# Copy to auth-policies.yaml and customize for your needs
version: "1.0"
metadata:
description: "Example authorization policies for Zeal platform"
created: "2025-01-01"
# Define resource types in your system
resources:
- type: workflow
attributes: [id, owner, organizationId, status, visibility]
- type: node_template
attributes: [id, category, tier, restricted]
- type: orchestrator
attributes: [id, type, owner]
- type: execution
attributes: [id, workflowId, status]
- type: api_endpoint
attributes: [path, method]
# Define standard actions
actions:
- read
- create
- update
- delete
- execute
- share
- publish
# Authorization policies
policies:
# ========================================
# Workflow Policies
# ========================================
- id: workflow-owner-full-access
description: "Workflow owners have full access to their workflows"
priority: 100
effect: allow
resources:
- type: workflow
conditions:
- attribute: owner
operator: equals
value: "${subject.id}"
actions: ["*"]
- id: workflow-organization-read
description: "Organization members can read organization workflows"
priority: 90
effect: allow
resources:
- type: workflow
conditions:
- attribute: organizationId
operator: equals
value: "${subject.organizationId}"
- attribute: visibility
operator: in
values: ["organization", "public"]
actions: ["read", "execute"]
subjects:
conditions:
- claim: organizationId
operator: exists
- id: workflow-public-read
description: "Anyone can read public workflows"
priority: 80
effect: allow
resources:
- type: workflow
conditions:
- attribute: visibility
operator: equals
value: "public"
actions: ["read"]
- id: workflow-create-limit
description: "Limit workflow creation based on plan"
priority: 70
effect: deny
resources:
- type: workflow
actions: ["create"]
conditions:
- type: quota
resource: workflow
limit: "${subject.workflowQuota || 10}"
# ========================================
# Node Template Policies
# ========================================
- id: node-template-basic-access
description: "All users can use basic node templates"
priority: 100
effect: allow
resources:
- type: node_template
conditions:
- attribute: tier
operator: equals
value: "basic"
actions: ["read", "use"]
- id: node-template-premium-access
description: "Premium features for premium users"
priority: 90
effect: allow
resources:
- type: node_template
conditions:
- attribute: tier
operator: in
values: ["basic", "premium"]
actions: ["read", "use"]
subjects:
conditions:
- claim: planTier
operator: in
values: ["premium", "enterprise"]
- id: node-template-enterprise-only
description: "Enterprise node templates"
priority: 85
effect: allow
resources:
- type: node_template
conditions:
- attribute: tier
operator: equals
value: "enterprise"
actions: ["read", "use"]
subjects:
conditions:
- claim: planTier
operator: equals
value: "enterprise"
- id: node-template-restricted-access
description: "Restricted templates need special permission"
priority: 80
effect: deny
resources:
- type: node_template
conditions:
- attribute: restricted
operator: equals
value: true
actions: ["use"]
subjects:
conditions:
- claim: permissions
operator: not_contains
value: "node_template.restricted.use"
# ========================================
# Role-Based Policies
# ========================================
- id: admin-full-access
description: "Admins have full access"
priority: 1000
effect: allow
resources:
- type: "*"
actions: ["*"]
subjects:
conditions:
- claim: roles
operator: contains
value: "admin"
- id: developer-workflow-access
description: "Developers can manage workflows"
priority: 200
effect: allow
resources:
- type: workflow
- type: node_template
- type: execution
actions: ["read", "create", "update", "execute"]
subjects:
conditions:
- claim: roles
operator: contains
value: "developer"
- id: viewer-read-only
description: "Viewers have read-only access"
priority: 150
effect: allow
resources:
- type: "*"
actions: ["read"]
subjects:
conditions:
- claim: roles
operator: contains
value: "viewer"
# ========================================
# API Endpoint Policies
# ========================================
- id: api-public-endpoints
description: "Public API endpoints"
priority: 500
effect: allow
resources:
- type: api_endpoint
conditions:
- attribute: path
operator: matches
pattern: "^/api/(health|status|public).*"
actions: ["*"]
- id: api-authenticated-required
description: "Most API endpoints require authentication"
priority: 100
effect: deny
resources:
- type: api_endpoint
conditions:
- attribute: path
operator: matches
pattern: "^/api/.*"
actions: ["*"]
subjects:
conditions:
- claim: sub
operator: not_exists
# ========================================
# Multi-Tenant Policies
# ========================================
- id: tenant-isolation
description: "Enforce tenant isolation"
priority: 10000
effect: deny
resources:
- type: "*"
conditions:
- attribute: tenantId
operator: exists
- attribute: tenantId
operator: not_equals
value: "${subject.tenantId}"
actions: ["*"]
subjects:
conditions:
- claim: tenantId
operator: exists
# ========================================
# Compliance-Based Policies
# ========================================
- id: require-verified-for-production
description: "Production workflows require verified users"
priority: 300
effect: deny
resources:
- type: workflow
conditions:
- attribute: environment
operator: equals
value: "production"
actions: ["create", "update", "publish"]
subjects:
conditions:
- claim: verificationStatus
operator: not_equals
value: "verified"
# ========================================
# Time-Based Policies
# ========================================
- id: business-hours-only
description: "Certain operations only during business hours"
priority: 400
effect: deny
resources:
- type: workflow
conditions:
- attribute: critical
operator: equals
value: true
actions: ["update", "delete"]
conditions:
- type: time
timezone: "UTC"
notBetween:
start: "09:00"
end: "17:00"
weekdays: ["Mon", "Tue", "Wed", "Thu", "Fri"]
# ========================================
# Data Filtering Policies
# ========================================
- id: filter-sensitive-fields
description: "Remove sensitive fields for non-admin users"
priority: 600
effect: filter
resources:
- type: "*"
actions: ["read"]
filters:
- type: field
remove: ["internalNotes", "debugInfo", "secrets"]
subjects:
conditions:
- claim: roles
operator: not_contains
value: "admin"
# ========================================
# Audit Obligations
# ========================================
- id: audit-critical-operations
description: "Audit all critical operations"
priority: 50
effect: allow
resources:
- type: workflow
conditions:
- attribute: critical
operator: equals
value: true
actions: ["update", "delete", "publish"]
obligations:
- type: audit
level: critical
includeRequestBody: true
- id: notify-on-share
description: "Notify when workflows are shared"
priority: 60
effect: allow
resources:
- type: workflow
actions: ["share"]
obligations:
- type: notify
channel: email
template: workflow_shared
recipients: ["${resource.owner}"]
# Policy evaluation rules
evaluation:
# Strategy: priority, first-match, all-match
strategy: priority
# Default effect when no policy matches
defaultEffect: deny
# Cache policy decisions
cache:
enabled: true
ttl: 300
# Conflict resolution
conflictResolution:
# When policies conflict, which effect wins
precedence: [deny, filter, allow]