hmcp-core 0.0.1 → 0.2.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/README.md +19 -3
- package/dist/approvals.d.ts +508 -0
- package/dist/approvals.js +1445 -0
- package/dist/argpath.d.ts +75 -0
- package/dist/argpath.js +189 -0
- package/dist/audit.d.ts +297 -0
- package/dist/audit.js +524 -0
- package/dist/canonical.d.ts +78 -0
- package/dist/canonical.js +146 -0
- package/dist/classify-held.d.ts +47 -0
- package/dist/classify-held.js +60 -0
- package/dist/classify-name.d.ts +55 -0
- package/dist/classify-name.js +255 -0
- package/dist/decide.d.ts +168 -0
- package/dist/decide.js +518 -0
- package/dist/egress.d.ts +123 -0
- package/dist/egress.js +544 -0
- package/dist/enforce.d.ts +78 -0
- package/dist/enforce.js +231 -0
- package/dist/exposure-apply.d.ts +51 -0
- package/dist/exposure-apply.js +69 -0
- package/dist/exposure.d.ts +81 -0
- package/dist/exposure.js +65 -0
- package/dist/file-lock.d.ts +70 -0
- package/dist/file-lock.js +165 -0
- package/dist/glob.d.ts +11 -0
- package/dist/glob.js +55 -0
- package/dist/grants.d.ts +204 -0
- package/dist/grants.js +372 -0
- package/dist/http-util.d.ts +52 -0
- package/dist/http-util.js +81 -0
- package/dist/index.d.ts +35 -0
- package/dist/index.js +36 -0
- package/dist/inventory.d.ts +100 -0
- package/dist/inventory.js +88 -0
- package/dist/ip.d.ts +15 -0
- package/dist/ip.js +186 -0
- package/dist/jwt.d.ts +57 -0
- package/dist/jwt.js +199 -0
- package/dist/live-state.d.ts +76 -0
- package/dist/live-state.js +57 -0
- package/dist/migrate.d.ts +22 -0
- package/dist/migrate.js +318 -0
- package/dist/pins.d.ts +119 -0
- package/dist/pins.js +125 -0
- package/dist/policy-batch.d.ts +89 -0
- package/dist/policy-batch.js +340 -0
- package/dist/policy-source.d.ts +161 -0
- package/dist/policy-source.js +299 -0
- package/dist/policy-write.d.ts +627 -0
- package/dist/policy-write.js +1697 -0
- package/dist/policy.d.ts +456 -0
- package/dist/policy.js +448 -0
- package/dist/redact.d.ts +65 -0
- package/dist/redact.js +191 -0
- package/dist/registry.d.ts +41 -0
- package/dist/registry.js +121 -0
- package/dist/remember-defaults.d.ts +9 -0
- package/dist/remember-defaults.js +9 -0
- package/dist/remember.d.ts +91 -0
- package/dist/remember.js +386 -0
- package/dist/resolve.d.ts +22 -0
- package/dist/resolve.js +34 -0
- package/dist/runtime-state.d.ts +65 -0
- package/dist/runtime-state.js +35 -0
- package/dist/secrets.d.ts +159 -0
- package/dist/secrets.js +361 -0
- package/dist/tenant.d.ts +83 -0
- package/dist/tenant.js +182 -0
- package/dist/unicode.d.ts +40 -0
- package/dist/unicode.js +103 -0
- package/dist/within-host.d.ts +33 -0
- package/dist/within-host.js +91 -0
- package/dist/within-real.d.ts +7 -0
- package/dist/within-real.js +28 -0
- package/package.json +33 -4
package/dist/policy.d.ts
ADDED
|
@@ -0,0 +1,456 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/**
|
|
3
|
+
* What a tool does to the world. Classification drives every default: a tool
|
|
4
|
+
* with no effect is unclassified and therefore denied.
|
|
5
|
+
*/
|
|
6
|
+
export declare const EffectSchema: z.ZodEnum<{
|
|
7
|
+
read: "read";
|
|
8
|
+
write: "write";
|
|
9
|
+
destructive: "destructive";
|
|
10
|
+
}>;
|
|
11
|
+
export type Effect = z.infer<typeof EffectSchema>;
|
|
12
|
+
export declare const DecisionKindSchema: z.ZodEnum<{
|
|
13
|
+
allow: "allow";
|
|
14
|
+
approve: "approve";
|
|
15
|
+
deny: "deny";
|
|
16
|
+
}>;
|
|
17
|
+
export type DecisionKind = z.infer<typeof DecisionKindSchema>;
|
|
18
|
+
/**
|
|
19
|
+
* Default posture when no rule matches. `read-only` is the shipped default:
|
|
20
|
+
* reads pass, anything that mutates is refused outright.
|
|
21
|
+
*/
|
|
22
|
+
export declare const PostureSchema: z.ZodEnum<{
|
|
23
|
+
"read-only": "read-only";
|
|
24
|
+
"approve-writes": "approve-writes";
|
|
25
|
+
locked: "locked";
|
|
26
|
+
}>;
|
|
27
|
+
export type Posture = z.infer<typeof PostureSchema>;
|
|
28
|
+
/**
|
|
29
|
+
* Bounds on a single argument, checked before a rule's decision is honored.
|
|
30
|
+
*
|
|
31
|
+
* The key a constraint is written under is an argument *path*, so a bound can
|
|
32
|
+
* reach a nested or repeated value: `amount`, `transfer.amount`, `items[].qty`.
|
|
33
|
+
* See `argpath.ts`.
|
|
34
|
+
*
|
|
35
|
+
* A constraint that bounds a value also requires that value to be *present*.
|
|
36
|
+
* An absent argument used to satisfy every bound written about it, which meant
|
|
37
|
+
* `amount: { max: 500 }` was satisfied by a call that simply omitted `amount`
|
|
38
|
+
* and let the upstream apply its own default -- the unbounded value the bound
|
|
39
|
+
* existed to prevent. `optional: true` restores that leniency where a tool
|
|
40
|
+
* genuinely has a safe default. A path that fans out is exempt: having no
|
|
41
|
+
* elements to bound is not an absence, and `maxItems` is how a count is
|
|
42
|
+
* bounded.
|
|
43
|
+
*/
|
|
44
|
+
/**
|
|
45
|
+
* What happens to what a tool returns.
|
|
46
|
+
*
|
|
47
|
+
* The scan on a tool's *description* protects against the server. This
|
|
48
|
+
* protects against what the server was asked to fetch: an issue body, a web
|
|
49
|
+
* page, a row someone else can write to. The server can be behaving
|
|
50
|
+
* perfectly.
|
|
51
|
+
*
|
|
52
|
+
* `label` is the default for injected text because a result is data the agent
|
|
53
|
+
* asked for: replacing it would break the call, and telling the model where
|
|
54
|
+
* the text came from is the honest minimum. `quarantine` withholds the
|
|
55
|
+
* content and says why, for a deployment that would rather lose a result than
|
|
56
|
+
* pass one on.
|
|
57
|
+
*
|
|
58
|
+
* A secret found in a result is `warn` by default: recorded, and the result
|
|
59
|
+
* passed on. By the time it is seen the value has already been through this
|
|
60
|
+
* process, so withholding it protects the transcript and not the secret --
|
|
61
|
+
* worth choosing deliberately rather than by default.
|
|
62
|
+
*/
|
|
63
|
+
export declare const ResultScanConfigSchema: z.ZodObject<{
|
|
64
|
+
on_injection: z.ZodDefault<z.ZodEnum<{
|
|
65
|
+
allow: "allow";
|
|
66
|
+
label: "label";
|
|
67
|
+
quarantine: "quarantine";
|
|
68
|
+
}>>;
|
|
69
|
+
on_secret: z.ZodDefault<z.ZodEnum<{
|
|
70
|
+
allow: "allow";
|
|
71
|
+
quarantine: "quarantine";
|
|
72
|
+
warn: "warn";
|
|
73
|
+
}>>;
|
|
74
|
+
}, z.core.$strict>;
|
|
75
|
+
export declare const ArgConstraintSchema: z.ZodObject<{
|
|
76
|
+
max: z.ZodOptional<z.ZodNumber>;
|
|
77
|
+
min: z.ZodOptional<z.ZodNumber>;
|
|
78
|
+
enum: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
79
|
+
pattern: z.ZodOptional<z.ZodString>;
|
|
80
|
+
maxLength: z.ZodOptional<z.ZodNumber>;
|
|
81
|
+
maxItems: z.ZodOptional<z.ZodNumber>;
|
|
82
|
+
sum_max: z.ZodOptional<z.ZodNumber>;
|
|
83
|
+
count_max: z.ZodOptional<z.ZodNumber>;
|
|
84
|
+
within: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
85
|
+
host: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
86
|
+
required: z.ZodOptional<z.ZodBoolean>;
|
|
87
|
+
optional: z.ZodOptional<z.ZodBoolean>;
|
|
88
|
+
coerce: z.ZodOptional<z.ZodBoolean>;
|
|
89
|
+
const: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>>;
|
|
90
|
+
same_items: z.ZodOptional<z.ZodArray<z.ZodUnknown>>;
|
|
91
|
+
}, z.core.$strict>;
|
|
92
|
+
export type ArgConstraint = z.infer<typeof ArgConstraintSchema>;
|
|
93
|
+
export declare const RuleSchema: z.ZodObject<{
|
|
94
|
+
id: z.ZodString;
|
|
95
|
+
match: z.ZodString;
|
|
96
|
+
effect: z.ZodOptional<z.ZodEnum<{
|
|
97
|
+
read: "read";
|
|
98
|
+
write: "write";
|
|
99
|
+
destructive: "destructive";
|
|
100
|
+
}>>;
|
|
101
|
+
decision: z.ZodEnum<{
|
|
102
|
+
allow: "allow";
|
|
103
|
+
approve: "approve";
|
|
104
|
+
deny: "deny";
|
|
105
|
+
}>;
|
|
106
|
+
args: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
107
|
+
max: z.ZodOptional<z.ZodNumber>;
|
|
108
|
+
min: z.ZodOptional<z.ZodNumber>;
|
|
109
|
+
enum: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
110
|
+
pattern: z.ZodOptional<z.ZodString>;
|
|
111
|
+
maxLength: z.ZodOptional<z.ZodNumber>;
|
|
112
|
+
maxItems: z.ZodOptional<z.ZodNumber>;
|
|
113
|
+
sum_max: z.ZodOptional<z.ZodNumber>;
|
|
114
|
+
count_max: z.ZodOptional<z.ZodNumber>;
|
|
115
|
+
within: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
116
|
+
host: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
117
|
+
required: z.ZodOptional<z.ZodBoolean>;
|
|
118
|
+
optional: z.ZodOptional<z.ZodBoolean>;
|
|
119
|
+
coerce: z.ZodOptional<z.ZodBoolean>;
|
|
120
|
+
const: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>>;
|
|
121
|
+
same_items: z.ZodOptional<z.ZodArray<z.ZodUnknown>>;
|
|
122
|
+
}, z.core.$strict>>>;
|
|
123
|
+
on_violation: z.ZodDefault<z.ZodEnum<{
|
|
124
|
+
approve: "approve";
|
|
125
|
+
deny: "deny";
|
|
126
|
+
}>>;
|
|
127
|
+
unknown_args: z.ZodDefault<z.ZodEnum<{
|
|
128
|
+
allow: "allow";
|
|
129
|
+
approve: "approve";
|
|
130
|
+
deny: "deny";
|
|
131
|
+
}>>;
|
|
132
|
+
reason: z.ZodOptional<z.ZodString>;
|
|
133
|
+
}, z.core.$strict>;
|
|
134
|
+
export type Rule = z.infer<typeof RuleSchema>;
|
|
135
|
+
/**
|
|
136
|
+
* A tenant read out of a signature-verified bearer token.
|
|
137
|
+
*
|
|
138
|
+
* The only source kind safe to use when the token arrives per request from
|
|
139
|
+
* the caller, which is the hosted-gateway case. The others take their value
|
|
140
|
+
* from the deployment -- an env var, a static string, a credential the
|
|
141
|
+
* operator placed -- and are trustworthy precisely because nothing the caller
|
|
142
|
+
* controls reaches them.
|
|
143
|
+
*
|
|
144
|
+
* Kept separate from `jwt-claim` rather than added to it as a flag. There is
|
|
145
|
+
* no setting here that turns verification off, and `jwt-claim` keeps meaning
|
|
146
|
+
* what it has always meant instead of quietly becoming unsafe.
|
|
147
|
+
*/
|
|
148
|
+
export declare const JwtVerifiedSourceSchema: z.ZodObject<{
|
|
149
|
+
kind: z.ZodLiteral<"jwt-verified">;
|
|
150
|
+
claim: z.ZodString;
|
|
151
|
+
jwks_uri: z.ZodOptional<z.ZodString>;
|
|
152
|
+
public_key: z.ZodOptional<z.ZodString>;
|
|
153
|
+
issuer: z.ZodString;
|
|
154
|
+
audience: z.ZodString;
|
|
155
|
+
header_name: z.ZodDefault<z.ZodString>;
|
|
156
|
+
}, z.core.$strict>;
|
|
157
|
+
export type JwtVerifiedSource = z.infer<typeof JwtVerifiedSourceSchema>;
|
|
158
|
+
/**
|
|
159
|
+
* Who may change this deployment's configuration through an API.
|
|
160
|
+
*
|
|
161
|
+
* Deliberately its own block rather than a field on `tenant.source`.
|
|
162
|
+
* `tenant.source` answers "which customer is this", which is a tenancy
|
|
163
|
+
* question; this answers "may they flip a switch", which is an authorization
|
|
164
|
+
* one. Folding them together would also make an admin surface appear the
|
|
165
|
+
* moment anyone configured JWT tenancy, and the common case is multi-tenant
|
|
166
|
+
* hosting with no admin surface at all.
|
|
167
|
+
*
|
|
168
|
+
* One field on purpose. A list of privileged subjects here would be
|
|
169
|
+
* operational state wearing the clothes of reviewed policy.
|
|
170
|
+
*/
|
|
171
|
+
export declare const AdminConfigSchema: z.ZodObject<{
|
|
172
|
+
scope: z.ZodString;
|
|
173
|
+
}, z.core.$strict>;
|
|
174
|
+
export type AdminConfig = z.infer<typeof AdminConfigSchema>;
|
|
175
|
+
export declare const TenantSourceSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
176
|
+
kind: z.ZodLiteral<"env">;
|
|
177
|
+
name: z.ZodString;
|
|
178
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
179
|
+
kind: z.ZodLiteral<"header">;
|
|
180
|
+
name: z.ZodString;
|
|
181
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
182
|
+
kind: z.ZodLiteral<"jwt-claim">;
|
|
183
|
+
name: z.ZodString;
|
|
184
|
+
token_env: z.ZodString;
|
|
185
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
186
|
+
kind: z.ZodLiteral<"static">;
|
|
187
|
+
value: z.ZodString;
|
|
188
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
189
|
+
kind: z.ZodLiteral<"jwt-verified">;
|
|
190
|
+
claim: z.ZodString;
|
|
191
|
+
jwks_uri: z.ZodOptional<z.ZodString>;
|
|
192
|
+
public_key: z.ZodOptional<z.ZodString>;
|
|
193
|
+
issuer: z.ZodString;
|
|
194
|
+
audience: z.ZodString;
|
|
195
|
+
header_name: z.ZodDefault<z.ZodString>;
|
|
196
|
+
}, z.core.$strict>]>;
|
|
197
|
+
export type TenantSource = z.infer<typeof TenantSourceSchema>;
|
|
198
|
+
export declare const TenantConfigSchema: z.ZodObject<{
|
|
199
|
+
field: z.ZodString;
|
|
200
|
+
aliases: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
201
|
+
source: z.ZodUnion<readonly [z.ZodObject<{
|
|
202
|
+
kind: z.ZodLiteral<"env">;
|
|
203
|
+
name: z.ZodString;
|
|
204
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
205
|
+
kind: z.ZodLiteral<"header">;
|
|
206
|
+
name: z.ZodString;
|
|
207
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
208
|
+
kind: z.ZodLiteral<"jwt-claim">;
|
|
209
|
+
name: z.ZodString;
|
|
210
|
+
token_env: z.ZodString;
|
|
211
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
212
|
+
kind: z.ZodLiteral<"static">;
|
|
213
|
+
value: z.ZodString;
|
|
214
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
215
|
+
kind: z.ZodLiteral<"jwt-verified">;
|
|
216
|
+
claim: z.ZodString;
|
|
217
|
+
jwks_uri: z.ZodOptional<z.ZodString>;
|
|
218
|
+
public_key: z.ZodOptional<z.ZodString>;
|
|
219
|
+
issuer: z.ZodString;
|
|
220
|
+
audience: z.ZodString;
|
|
221
|
+
header_name: z.ZodDefault<z.ZodString>;
|
|
222
|
+
}, z.core.$strict>]>;
|
|
223
|
+
inject: z.ZodDefault<z.ZodArray<z.ZodEnum<{
|
|
224
|
+
path: "path";
|
|
225
|
+
header: "header";
|
|
226
|
+
query: "query";
|
|
227
|
+
body: "body";
|
|
228
|
+
}>>>;
|
|
229
|
+
header_name: z.ZodOptional<z.ZodString>;
|
|
230
|
+
on_mismatch: z.ZodDefault<z.ZodEnum<{
|
|
231
|
+
deny: "deny";
|
|
232
|
+
override: "override";
|
|
233
|
+
}>>;
|
|
234
|
+
required: z.ZodDefault<z.ZodBoolean>;
|
|
235
|
+
}, z.core.$strict>;
|
|
236
|
+
export type TenantConfig = z.infer<typeof TenantConfigSchema>;
|
|
237
|
+
export declare const EgressConfigSchema: z.ZodObject<{
|
|
238
|
+
allow: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
239
|
+
methods: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
240
|
+
max_body_bytes: z.ZodDefault<z.ZodNumber>;
|
|
241
|
+
max_request_body_bytes: z.ZodDefault<z.ZodNumber>;
|
|
242
|
+
timeout_ms: z.ZodDefault<z.ZodNumber>;
|
|
243
|
+
max_redirects: z.ZodDefault<z.ZodNumber>;
|
|
244
|
+
block_private_ips: z.ZodDefault<z.ZodBoolean>;
|
|
245
|
+
allow_http: z.ZodDefault<z.ZodBoolean>;
|
|
246
|
+
allow_ip_literals: z.ZodDefault<z.ZodBoolean>;
|
|
247
|
+
}, z.core.$strict>;
|
|
248
|
+
export type EgressConfig = z.infer<typeof EgressConfigSchema>;
|
|
249
|
+
export declare const ApprovalsConfigSchema: z.ZodObject<{
|
|
250
|
+
mode: z.ZodDefault<z.ZodEnum<{
|
|
251
|
+
deny: "deny";
|
|
252
|
+
elicit: "elicit";
|
|
253
|
+
cli: "cli";
|
|
254
|
+
both: "both";
|
|
255
|
+
}>>;
|
|
256
|
+
ttl_seconds: z.ZodDefault<z.ZodNumber>;
|
|
257
|
+
single_use: z.ZodDefault<z.ZodBoolean>;
|
|
258
|
+
wait_seconds: z.ZodDefault<z.ZodNumber>;
|
|
259
|
+
store_path: z.ZodDefault<z.ZodString>;
|
|
260
|
+
}, z.core.$strict>;
|
|
261
|
+
export type ApprovalsConfig = z.infer<typeof ApprovalsConfigSchema>;
|
|
262
|
+
export declare const AuditConfigSchema: z.ZodObject<{
|
|
263
|
+
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
264
|
+
path: z.ZodDefault<z.ZodString>;
|
|
265
|
+
hash_chain: z.ZodDefault<z.ZodBoolean>;
|
|
266
|
+
redact: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
267
|
+
record_args: z.ZodDefault<z.ZodBoolean>;
|
|
268
|
+
on_failure: z.ZodDefault<z.ZodEnum<{
|
|
269
|
+
refuse: "refuse";
|
|
270
|
+
continue: "continue";
|
|
271
|
+
}>>;
|
|
272
|
+
}, z.core.$strict>;
|
|
273
|
+
export type AuditConfig = z.infer<typeof AuditConfigSchema>;
|
|
274
|
+
export declare const DefaultsSchema: z.ZodObject<{
|
|
275
|
+
mode: z.ZodDefault<z.ZodEnum<{
|
|
276
|
+
"read-only": "read-only";
|
|
277
|
+
"approve-writes": "approve-writes";
|
|
278
|
+
locked: "locked";
|
|
279
|
+
}>>;
|
|
280
|
+
on_unclassified: z.ZodDefault<z.ZodEnum<{
|
|
281
|
+
approve: "approve";
|
|
282
|
+
deny: "deny";
|
|
283
|
+
}>>;
|
|
284
|
+
}, z.core.$strict>;
|
|
285
|
+
export declare const PolicySchema: z.ZodObject<{
|
|
286
|
+
version: z.ZodLiteral<1>;
|
|
287
|
+
name: z.ZodOptional<z.ZodString>;
|
|
288
|
+
enforcement: z.ZodDefault<z.ZodEnum<{
|
|
289
|
+
enforce: "enforce";
|
|
290
|
+
observe: "observe";
|
|
291
|
+
}>>;
|
|
292
|
+
on_tool_change: z.ZodDefault<z.ZodEnum<{
|
|
293
|
+
deny: "deny";
|
|
294
|
+
warn: "warn";
|
|
295
|
+
}>>;
|
|
296
|
+
results: z.ZodDefault<z.ZodObject<{
|
|
297
|
+
on_injection: z.ZodDefault<z.ZodEnum<{
|
|
298
|
+
allow: "allow";
|
|
299
|
+
label: "label";
|
|
300
|
+
quarantine: "quarantine";
|
|
301
|
+
}>>;
|
|
302
|
+
on_secret: z.ZodDefault<z.ZodEnum<{
|
|
303
|
+
allow: "allow";
|
|
304
|
+
quarantine: "quarantine";
|
|
305
|
+
warn: "warn";
|
|
306
|
+
}>>;
|
|
307
|
+
}, z.core.$strict>>;
|
|
308
|
+
defaults: z.ZodDefault<z.ZodObject<{
|
|
309
|
+
mode: z.ZodDefault<z.ZodEnum<{
|
|
310
|
+
"read-only": "read-only";
|
|
311
|
+
"approve-writes": "approve-writes";
|
|
312
|
+
locked: "locked";
|
|
313
|
+
}>>;
|
|
314
|
+
on_unclassified: z.ZodDefault<z.ZodEnum<{
|
|
315
|
+
approve: "approve";
|
|
316
|
+
deny: "deny";
|
|
317
|
+
}>>;
|
|
318
|
+
}, z.core.$strict>>;
|
|
319
|
+
rules: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
320
|
+
id: z.ZodString;
|
|
321
|
+
match: z.ZodString;
|
|
322
|
+
effect: z.ZodOptional<z.ZodEnum<{
|
|
323
|
+
read: "read";
|
|
324
|
+
write: "write";
|
|
325
|
+
destructive: "destructive";
|
|
326
|
+
}>>;
|
|
327
|
+
decision: z.ZodEnum<{
|
|
328
|
+
allow: "allow";
|
|
329
|
+
approve: "approve";
|
|
330
|
+
deny: "deny";
|
|
331
|
+
}>;
|
|
332
|
+
args: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
333
|
+
max: z.ZodOptional<z.ZodNumber>;
|
|
334
|
+
min: z.ZodOptional<z.ZodNumber>;
|
|
335
|
+
enum: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
336
|
+
pattern: z.ZodOptional<z.ZodString>;
|
|
337
|
+
maxLength: z.ZodOptional<z.ZodNumber>;
|
|
338
|
+
maxItems: z.ZodOptional<z.ZodNumber>;
|
|
339
|
+
sum_max: z.ZodOptional<z.ZodNumber>;
|
|
340
|
+
count_max: z.ZodOptional<z.ZodNumber>;
|
|
341
|
+
within: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
342
|
+
host: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
343
|
+
required: z.ZodOptional<z.ZodBoolean>;
|
|
344
|
+
optional: z.ZodOptional<z.ZodBoolean>;
|
|
345
|
+
coerce: z.ZodOptional<z.ZodBoolean>;
|
|
346
|
+
const: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>>;
|
|
347
|
+
same_items: z.ZodOptional<z.ZodArray<z.ZodUnknown>>;
|
|
348
|
+
}, z.core.$strict>>>;
|
|
349
|
+
on_violation: z.ZodDefault<z.ZodEnum<{
|
|
350
|
+
approve: "approve";
|
|
351
|
+
deny: "deny";
|
|
352
|
+
}>>;
|
|
353
|
+
unknown_args: z.ZodDefault<z.ZodEnum<{
|
|
354
|
+
allow: "allow";
|
|
355
|
+
approve: "approve";
|
|
356
|
+
deny: "deny";
|
|
357
|
+
}>>;
|
|
358
|
+
reason: z.ZodOptional<z.ZodString>;
|
|
359
|
+
}, z.core.$strict>>>;
|
|
360
|
+
tenant: z.ZodOptional<z.ZodObject<{
|
|
361
|
+
field: z.ZodString;
|
|
362
|
+
aliases: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
363
|
+
source: z.ZodUnion<readonly [z.ZodObject<{
|
|
364
|
+
kind: z.ZodLiteral<"env">;
|
|
365
|
+
name: z.ZodString;
|
|
366
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
367
|
+
kind: z.ZodLiteral<"header">;
|
|
368
|
+
name: z.ZodString;
|
|
369
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
370
|
+
kind: z.ZodLiteral<"jwt-claim">;
|
|
371
|
+
name: z.ZodString;
|
|
372
|
+
token_env: z.ZodString;
|
|
373
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
374
|
+
kind: z.ZodLiteral<"static">;
|
|
375
|
+
value: z.ZodString;
|
|
376
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
377
|
+
kind: z.ZodLiteral<"jwt-verified">;
|
|
378
|
+
claim: z.ZodString;
|
|
379
|
+
jwks_uri: z.ZodOptional<z.ZodString>;
|
|
380
|
+
public_key: z.ZodOptional<z.ZodString>;
|
|
381
|
+
issuer: z.ZodString;
|
|
382
|
+
audience: z.ZodString;
|
|
383
|
+
header_name: z.ZodDefault<z.ZodString>;
|
|
384
|
+
}, z.core.$strict>]>;
|
|
385
|
+
inject: z.ZodDefault<z.ZodArray<z.ZodEnum<{
|
|
386
|
+
path: "path";
|
|
387
|
+
header: "header";
|
|
388
|
+
query: "query";
|
|
389
|
+
body: "body";
|
|
390
|
+
}>>>;
|
|
391
|
+
header_name: z.ZodOptional<z.ZodString>;
|
|
392
|
+
on_mismatch: z.ZodDefault<z.ZodEnum<{
|
|
393
|
+
deny: "deny";
|
|
394
|
+
override: "override";
|
|
395
|
+
}>>;
|
|
396
|
+
required: z.ZodDefault<z.ZodBoolean>;
|
|
397
|
+
}, z.core.$strict>>;
|
|
398
|
+
admin: z.ZodOptional<z.ZodObject<{
|
|
399
|
+
scope: z.ZodString;
|
|
400
|
+
}, z.core.$strict>>;
|
|
401
|
+
egress: z.ZodDefault<z.ZodObject<{
|
|
402
|
+
allow: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
403
|
+
methods: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
404
|
+
max_body_bytes: z.ZodDefault<z.ZodNumber>;
|
|
405
|
+
max_request_body_bytes: z.ZodDefault<z.ZodNumber>;
|
|
406
|
+
timeout_ms: z.ZodDefault<z.ZodNumber>;
|
|
407
|
+
max_redirects: z.ZodDefault<z.ZodNumber>;
|
|
408
|
+
block_private_ips: z.ZodDefault<z.ZodBoolean>;
|
|
409
|
+
allow_http: z.ZodDefault<z.ZodBoolean>;
|
|
410
|
+
allow_ip_literals: z.ZodDefault<z.ZodBoolean>;
|
|
411
|
+
}, z.core.$strict>>;
|
|
412
|
+
approvals: z.ZodDefault<z.ZodObject<{
|
|
413
|
+
mode: z.ZodDefault<z.ZodEnum<{
|
|
414
|
+
deny: "deny";
|
|
415
|
+
elicit: "elicit";
|
|
416
|
+
cli: "cli";
|
|
417
|
+
both: "both";
|
|
418
|
+
}>>;
|
|
419
|
+
ttl_seconds: z.ZodDefault<z.ZodNumber>;
|
|
420
|
+
single_use: z.ZodDefault<z.ZodBoolean>;
|
|
421
|
+
wait_seconds: z.ZodDefault<z.ZodNumber>;
|
|
422
|
+
store_path: z.ZodDefault<z.ZodString>;
|
|
423
|
+
}, z.core.$strict>>;
|
|
424
|
+
audit: z.ZodDefault<z.ZodObject<{
|
|
425
|
+
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
426
|
+
path: z.ZodDefault<z.ZodString>;
|
|
427
|
+
hash_chain: z.ZodDefault<z.ZodBoolean>;
|
|
428
|
+
redact: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
429
|
+
record_args: z.ZodDefault<z.ZodBoolean>;
|
|
430
|
+
on_failure: z.ZodDefault<z.ZodEnum<{
|
|
431
|
+
refuse: "refuse";
|
|
432
|
+
continue: "continue";
|
|
433
|
+
}>>;
|
|
434
|
+
}, z.core.$strict>>;
|
|
435
|
+
tool_budget: z.ZodDefault<z.ZodNumber>;
|
|
436
|
+
}, z.core.$strict>;
|
|
437
|
+
export type Policy = z.infer<typeof PolicySchema>;
|
|
438
|
+
/** Expands a leading `~` and resolves against `base`. */
|
|
439
|
+
export declare function expandPath(p: string, base?: string): string;
|
|
440
|
+
export declare class PolicyError extends Error {
|
|
441
|
+
readonly issues?: readonly {
|
|
442
|
+
path: string;
|
|
443
|
+
message: string;
|
|
444
|
+
}[] | undefined;
|
|
445
|
+
constructor(message: string, issues?: readonly {
|
|
446
|
+
path: string;
|
|
447
|
+
message: string;
|
|
448
|
+
}[] | undefined);
|
|
449
|
+
}
|
|
450
|
+
export declare function parsePolicy(raw: unknown, source?: string): Policy;
|
|
451
|
+
export declare function loadPolicy(path: string): Policy;
|
|
452
|
+
/**
|
|
453
|
+
* The posture this project ships: reads allowed, writes and deletes refused,
|
|
454
|
+
* nothing leaves the machine, everything logged.
|
|
455
|
+
*/
|
|
456
|
+
export declare function defaultPolicy(): Policy;
|