agentlock-shared 0.1.0 → 0.3.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/dist/__tests__/billing.test.d.ts +2 -0
- package/dist/__tests__/billing.test.d.ts.map +1 -0
- package/dist/__tests__/billing.test.js +31 -0
- package/dist/__tests__/billing.test.js.map +1 -0
- package/dist/__tests__/crypto.test.js +137 -47
- package/dist/__tests__/crypto.test.js.map +1 -1
- package/dist/__tests__/dns-pinning.test.d.ts +2 -0
- package/dist/__tests__/dns-pinning.test.d.ts.map +1 -0
- package/dist/__tests__/dns-pinning.test.js +33 -0
- package/dist/__tests__/dns-pinning.test.js.map +1 -0
- package/dist/__tests__/llm-classifier-cache-store.test.d.ts +2 -0
- package/dist/__tests__/llm-classifier-cache-store.test.d.ts.map +1 -0
- package/dist/__tests__/llm-classifier-cache-store.test.js +65 -0
- package/dist/__tests__/llm-classifier-cache-store.test.js.map +1 -0
- package/dist/__tests__/llm-classifier-cache.test.d.ts +2 -0
- package/dist/__tests__/llm-classifier-cache.test.d.ts.map +1 -0
- package/dist/__tests__/llm-classifier-cache.test.js +44 -0
- package/dist/__tests__/llm-classifier-cache.test.js.map +1 -0
- package/dist/__tests__/llm-classifier.test.d.ts +2 -0
- package/dist/__tests__/llm-classifier.test.d.ts.map +1 -0
- package/dist/__tests__/llm-classifier.test.js +167 -0
- package/dist/__tests__/llm-classifier.test.js.map +1 -0
- package/dist/__tests__/messaging.test.d.ts +2 -0
- package/dist/__tests__/messaging.test.d.ts.map +1 -0
- package/dist/__tests__/messaging.test.js +75 -0
- package/dist/__tests__/messaging.test.js.map +1 -0
- package/dist/__tests__/plans-classifier-limits.test.d.ts +2 -0
- package/dist/__tests__/plans-classifier-limits.test.d.ts.map +1 -0
- package/dist/__tests__/plans-classifier-limits.test.js +22 -0
- package/dist/__tests__/plans-classifier-limits.test.js.map +1 -0
- package/dist/__tests__/policy-category-floor.test.d.ts +2 -0
- package/dist/__tests__/policy-category-floor.test.d.ts.map +1 -0
- package/dist/__tests__/policy-category-floor.test.js +46 -0
- package/dist/__tests__/policy-category-floor.test.js.map +1 -0
- package/dist/__tests__/policy-claude-bash.test.d.ts +2 -0
- package/dist/__tests__/policy-claude-bash.test.d.ts.map +1 -0
- package/dist/__tests__/policy-claude-bash.test.js +401 -0
- package/dist/__tests__/policy-claude-bash.test.js.map +1 -0
- package/dist/__tests__/policy-llm-floor.test.d.ts +2 -0
- package/dist/__tests__/policy-llm-floor.test.d.ts.map +1 -0
- package/dist/__tests__/policy-llm-floor.test.js +107 -0
- package/dist/__tests__/policy-llm-floor.test.js.map +1 -0
- package/dist/__tests__/policy-ssh-e2e.test.d.ts +2 -0
- package/dist/__tests__/policy-ssh-e2e.test.d.ts.map +1 -0
- package/dist/__tests__/policy-ssh-e2e.test.js +89 -0
- package/dist/__tests__/policy-ssh-e2e.test.js.map +1 -0
- package/dist/__tests__/policy-ssh-sessions.test.d.ts +2 -0
- package/dist/__tests__/policy-ssh-sessions.test.d.ts.map +1 -0
- package/dist/__tests__/policy-ssh-sessions.test.js +139 -0
- package/dist/__tests__/policy-ssh-sessions.test.js.map +1 -0
- package/dist/__tests__/policy-ssh.test.d.ts +2 -0
- package/dist/__tests__/policy-ssh.test.d.ts.map +1 -0
- package/dist/__tests__/policy-ssh.test.js +180 -0
- package/dist/__tests__/policy-ssh.test.js.map +1 -0
- package/dist/__tests__/policy.test.js +522 -7
- package/dist/__tests__/policy.test.js.map +1 -1
- package/dist/__tests__/redact.test.js +76 -0
- package/dist/__tests__/redact.test.js.map +1 -1
- package/dist/__tests__/signing.test.js +89 -0
- package/dist/__tests__/signing.test.js.map +1 -1
- package/dist/__tests__/ssh-fingerprint.test.d.ts +2 -0
- package/dist/__tests__/ssh-fingerprint.test.d.ts.map +1 -0
- package/dist/__tests__/ssh-fingerprint.test.js +19 -0
- package/dist/__tests__/ssh-fingerprint.test.js.map +1 -0
- package/dist/__tests__/vpn-route.test.d.ts +2 -0
- package/dist/__tests__/vpn-route.test.d.ts.map +1 -0
- package/dist/__tests__/vpn-route.test.js +72 -0
- package/dist/__tests__/vpn-route.test.js.map +1 -0
- package/dist/__tests__/wireguard.test.d.ts +2 -0
- package/dist/__tests__/wireguard.test.d.ts.map +1 -0
- package/dist/__tests__/wireguard.test.js +114 -0
- package/dist/__tests__/wireguard.test.js.map +1 -0
- package/dist/billing.d.ts +12 -0
- package/dist/billing.d.ts.map +1 -0
- package/dist/billing.js +41 -0
- package/dist/billing.js.map +1 -0
- package/dist/crypto.d.ts +41 -0
- package/dist/crypto.d.ts.map +1 -1
- package/dist/crypto.js +208 -6
- package/dist/crypto.js.map +1 -1
- package/dist/dns-pinning.d.ts +28 -0
- package/dist/dns-pinning.d.ts.map +1 -0
- package/dist/dns-pinning.js +113 -0
- package/dist/dns-pinning.js.map +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9 -0
- package/dist/index.js.map +1 -1
- package/dist/llm-classifier-cache-store.d.ts +49 -0
- package/dist/llm-classifier-cache-store.d.ts.map +1 -0
- package/dist/llm-classifier-cache-store.js +63 -0
- package/dist/llm-classifier-cache-store.js.map +1 -0
- package/dist/llm-classifier-cache.d.ts +6 -0
- package/dist/llm-classifier-cache.d.ts.map +1 -0
- package/dist/llm-classifier-cache.js +52 -0
- package/dist/llm-classifier-cache.js.map +1 -0
- package/dist/llm-classifier.d.ts +29 -0
- package/dist/llm-classifier.d.ts.map +1 -0
- package/dist/llm-classifier.js +191 -0
- package/dist/llm-classifier.js.map +1 -0
- package/dist/observability.d.ts +36 -0
- package/dist/observability.d.ts.map +1 -0
- package/dist/observability.js +75 -0
- package/dist/observability.js.map +1 -0
- package/dist/plans.d.ts +21 -0
- package/dist/plans.d.ts.map +1 -1
- package/dist/plans.js +52 -14
- package/dist/plans.js.map +1 -1
- package/dist/policy.d.ts +173 -3
- package/dist/policy.d.ts.map +1 -1
- package/dist/policy.js +951 -58
- package/dist/policy.js.map +1 -1
- package/dist/redact.d.ts.map +1 -1
- package/dist/redact.js +104 -7
- package/dist/redact.js.map +1 -1
- package/dist/regex-safety.d.ts +21 -0
- package/dist/regex-safety.d.ts.map +1 -0
- package/dist/regex-safety.js +49 -0
- package/dist/regex-safety.js.map +1 -0
- package/dist/sanitize.d.ts +31 -0
- package/dist/sanitize.d.ts.map +1 -0
- package/dist/sanitize.js +54 -0
- package/dist/sanitize.js.map +1 -0
- package/dist/schemas.d.ts +267 -14
- package/dist/schemas.d.ts.map +1 -1
- package/dist/schemas.js +152 -10
- package/dist/schemas.js.map +1 -1
- package/dist/signing.d.ts +15 -0
- package/dist/signing.d.ts.map +1 -1
- package/dist/signing.js +53 -4
- package/dist/signing.js.map +1 -1
- package/dist/ssh-fingerprint.d.ts +10 -0
- package/dist/ssh-fingerprint.d.ts.map +1 -0
- package/dist/ssh-fingerprint.js +52 -0
- package/dist/ssh-fingerprint.js.map +1 -0
- package/dist/ssrf.d.ts +36 -0
- package/dist/ssrf.d.ts.map +1 -0
- package/dist/ssrf.js +140 -0
- package/dist/ssrf.js.map +1 -0
- package/dist/types.d.ts +131 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/wireguard.d.ts +63 -0
- package/dist/wireguard.d.ts.map +1 -0
- package/dist/wireguard.js +226 -0
- package/dist/wireguard.js.map +1 -0
- package/package.json +42 -29
- package/.turbo/turbo-build.log +0 -4
- package/.turbo/turbo-test.log +0 -34
- package/dist/__tests__/content-crypto.test.d.ts +0 -2
- package/dist/__tests__/content-crypto.test.d.ts.map +0 -1
- package/dist/__tests__/content-crypto.test.js +0 -117
- package/dist/__tests__/content-crypto.test.js.map +0 -1
- package/dist/content-crypto.d.ts +0 -24
- package/dist/content-crypto.d.ts.map +0 -1
- package/dist/content-crypto.js +0 -58
- package/dist/content-crypto.js.map +0 -1
- package/src/__tests__/policy.test.ts +0 -88
- package/src/__tests__/redact.test.ts +0 -41
- package/src/__tests__/signing.test.ts +0 -55
- package/src/crypto.ts +0 -87
- package/src/index.ts +0 -8
- package/src/mcp-catalog.ts +0 -181
- package/src/plans.ts +0 -96
- package/src/policy.ts +0 -186
- package/src/redact.ts +0 -114
- package/src/schemas.ts +0 -53
- package/src/signing.ts +0 -120
- package/src/types.ts +0 -212
- package/test-gateway.mjs +0 -47
- package/tsconfig.json +0 -10
- package/vitest.config.ts +0 -8
package/dist/schemas.d.ts
CHANGED
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* Reusable Zod schema for webhook URLs.
|
|
4
|
+
* Enforces: max length 2048, valid URL syntax, HTTPS-only,
|
|
5
|
+
* and rejects private/internal hostnames at parse time.
|
|
6
|
+
*/
|
|
7
|
+
export declare const WebhookUrlSchema: z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
|
|
2
8
|
export declare const AgentActionRequestSchema: z.ZodObject<{
|
|
3
9
|
action_type: z.ZodEnum<["read", "write", "financial", "admin"]>;
|
|
4
10
|
tool: z.ZodString;
|
|
@@ -6,14 +12,14 @@ export declare const AgentActionRequestSchema: z.ZodObject<{
|
|
|
6
12
|
idempotency_key: z.ZodOptional<z.ZodString>;
|
|
7
13
|
cost_estimate: z.ZodOptional<z.ZodNumber>;
|
|
8
14
|
}, "strip", z.ZodTypeAny, {
|
|
9
|
-
action_type: "admin" | "read" | "write" | "financial";
|
|
10
15
|
tool: string;
|
|
16
|
+
action_type: "admin" | "read" | "write" | "financial";
|
|
11
17
|
payload: Record<string, unknown>;
|
|
12
18
|
idempotency_key?: string | undefined;
|
|
13
19
|
cost_estimate?: number | undefined;
|
|
14
20
|
}, {
|
|
15
|
-
action_type: "admin" | "read" | "write" | "financial";
|
|
16
21
|
tool: string;
|
|
22
|
+
action_type: "admin" | "read" | "write" | "financial";
|
|
17
23
|
payload: Record<string, unknown>;
|
|
18
24
|
idempotency_key?: string | undefined;
|
|
19
25
|
cost_estimate?: number | undefined;
|
|
@@ -36,37 +42,103 @@ export declare const RegisterAgentSchema: z.ZodObject<{
|
|
|
36
42
|
}>;
|
|
37
43
|
export declare const PolicyRulesSchema: z.ZodObject<{
|
|
38
44
|
defaultMode: z.ZodEnum<["allow", "require_approval", "block"]>;
|
|
39
|
-
rules: z.ZodArray<z.ZodObject<{
|
|
45
|
+
rules: z.ZodArray<z.ZodEffects<z.ZodObject<{
|
|
40
46
|
action_type: z.ZodOptional<z.ZodEnum<["read", "write", "financial", "admin"]>>;
|
|
41
47
|
tool: z.ZodOptional<z.ZodString>;
|
|
42
48
|
domain: z.ZodOptional<z.ZodString>;
|
|
43
49
|
decision: z.ZodEnum<["ALLOW", "REQUIRE_APPROVAL", "BLOCK"]>;
|
|
44
50
|
require_two_approvals: z.ZodOptional<z.ZodBoolean>;
|
|
51
|
+
allowed_approvers: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
45
52
|
}, "strip", z.ZodTypeAny, {
|
|
46
53
|
decision: "ALLOW" | "REQUIRE_APPROVAL" | "BLOCK";
|
|
47
|
-
action_type?: "admin" | "read" | "write" | "financial" | undefined;
|
|
48
54
|
tool?: string | undefined;
|
|
49
|
-
|
|
55
|
+
action_type?: "admin" | "read" | "write" | "financial" | undefined;
|
|
50
56
|
require_two_approvals?: boolean | undefined;
|
|
57
|
+
allowed_approvers?: string[] | undefined;
|
|
58
|
+
domain?: string | undefined;
|
|
51
59
|
}, {
|
|
52
60
|
decision: "ALLOW" | "REQUIRE_APPROVAL" | "BLOCK";
|
|
61
|
+
tool?: string | undefined;
|
|
53
62
|
action_type?: "admin" | "read" | "write" | "financial" | undefined;
|
|
63
|
+
require_two_approvals?: boolean | undefined;
|
|
64
|
+
allowed_approvers?: string[] | undefined;
|
|
65
|
+
domain?: string | undefined;
|
|
66
|
+
}>, {
|
|
67
|
+
decision: "ALLOW" | "REQUIRE_APPROVAL" | "BLOCK";
|
|
54
68
|
tool?: string | undefined;
|
|
69
|
+
action_type?: "admin" | "read" | "write" | "financial" | undefined;
|
|
70
|
+
require_two_approvals?: boolean | undefined;
|
|
71
|
+
allowed_approvers?: string[] | undefined;
|
|
55
72
|
domain?: string | undefined;
|
|
73
|
+
}, {
|
|
74
|
+
decision: "ALLOW" | "REQUIRE_APPROVAL" | "BLOCK";
|
|
75
|
+
tool?: string | undefined;
|
|
76
|
+
action_type?: "admin" | "read" | "write" | "financial" | undefined;
|
|
56
77
|
require_two_approvals?: boolean | undefined;
|
|
78
|
+
allowed_approvers?: string[] | undefined;
|
|
79
|
+
domain?: string | undefined;
|
|
57
80
|
}>, "many">;
|
|
58
81
|
http: z.ZodOptional<z.ZodObject<{
|
|
59
82
|
allowedDomains: z.ZodArray<z.ZodString, "many">;
|
|
60
|
-
allowedMethods: z.ZodArray<z.
|
|
83
|
+
allowedMethods: z.ZodArray<z.ZodEnum<["GET", "POST", "PUT", "PATCH", "DELETE", "HEAD", "OPTIONS"]>, "many">;
|
|
61
84
|
blockList: z.ZodArray<z.ZodString, "many">;
|
|
85
|
+
allowAllDomains: z.ZodOptional<z.ZodBoolean>;
|
|
62
86
|
}, "strip", z.ZodTypeAny, {
|
|
63
87
|
allowedDomains: string[];
|
|
64
|
-
allowedMethods:
|
|
88
|
+
allowedMethods: ("GET" | "HEAD" | "OPTIONS" | "POST" | "PUT" | "DELETE" | "PATCH")[];
|
|
65
89
|
blockList: string[];
|
|
90
|
+
allowAllDomains?: boolean | undefined;
|
|
66
91
|
}, {
|
|
67
92
|
allowedDomains: string[];
|
|
68
|
-
allowedMethods:
|
|
93
|
+
allowedMethods: ("GET" | "HEAD" | "OPTIONS" | "POST" | "PUT" | "DELETE" | "PATCH")[];
|
|
69
94
|
blockList: string[];
|
|
95
|
+
allowAllDomains?: boolean | undefined;
|
|
96
|
+
}>>;
|
|
97
|
+
ssh: z.ZodOptional<z.ZodObject<{
|
|
98
|
+
allowedHosts: z.ZodArray<z.ZodString, "many">;
|
|
99
|
+
allowedUsers: z.ZodArray<z.ZodString, "many">;
|
|
100
|
+
commandRules: z.ZodArray<z.ZodObject<{
|
|
101
|
+
pattern: z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
|
|
102
|
+
decision: z.ZodEnum<["ALLOW", "REQUIRE_APPROVAL", "BLOCK"]>;
|
|
103
|
+
require_two_approvals: z.ZodOptional<z.ZodBoolean>;
|
|
104
|
+
allowed_approvers: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
105
|
+
description: z.ZodOptional<z.ZodString>;
|
|
106
|
+
}, "strip", z.ZodTypeAny, {
|
|
107
|
+
pattern: string;
|
|
108
|
+
decision: "ALLOW" | "REQUIRE_APPROVAL" | "BLOCK";
|
|
109
|
+
require_two_approvals?: boolean | undefined;
|
|
110
|
+
allowed_approvers?: string[] | undefined;
|
|
111
|
+
description?: string | undefined;
|
|
112
|
+
}, {
|
|
113
|
+
pattern: string;
|
|
114
|
+
decision: "ALLOW" | "REQUIRE_APPROVAL" | "BLOCK";
|
|
115
|
+
require_two_approvals?: boolean | undefined;
|
|
116
|
+
allowed_approvers?: string[] | undefined;
|
|
117
|
+
description?: string | undefined;
|
|
118
|
+
}>, "many">;
|
|
119
|
+
defaultDecision: z.ZodDefault<z.ZodEnum<["ALLOW", "REQUIRE_APPROVAL", "BLOCK"]>>;
|
|
120
|
+
}, "strip", z.ZodTypeAny, {
|
|
121
|
+
defaultDecision: "ALLOW" | "REQUIRE_APPROVAL" | "BLOCK";
|
|
122
|
+
allowedHosts: string[];
|
|
123
|
+
allowedUsers: string[];
|
|
124
|
+
commandRules: {
|
|
125
|
+
pattern: string;
|
|
126
|
+
decision: "ALLOW" | "REQUIRE_APPROVAL" | "BLOCK";
|
|
127
|
+
require_two_approvals?: boolean | undefined;
|
|
128
|
+
allowed_approvers?: string[] | undefined;
|
|
129
|
+
description?: string | undefined;
|
|
130
|
+
}[];
|
|
131
|
+
}, {
|
|
132
|
+
allowedHosts: string[];
|
|
133
|
+
allowedUsers: string[];
|
|
134
|
+
commandRules: {
|
|
135
|
+
pattern: string;
|
|
136
|
+
decision: "ALLOW" | "REQUIRE_APPROVAL" | "BLOCK";
|
|
137
|
+
require_two_approvals?: boolean | undefined;
|
|
138
|
+
allowed_approvers?: string[] | undefined;
|
|
139
|
+
description?: string | undefined;
|
|
140
|
+
}[];
|
|
141
|
+
defaultDecision?: "ALLOW" | "REQUIRE_APPROVAL" | "BLOCK" | undefined;
|
|
70
142
|
}>>;
|
|
71
143
|
limits: z.ZodOptional<z.ZodObject<{
|
|
72
144
|
maxCostPerAction: z.ZodOptional<z.ZodNumber>;
|
|
@@ -78,51 +150,232 @@ export declare const PolicyRulesSchema: z.ZodObject<{
|
|
|
78
150
|
maxActionsPerHour?: number | undefined;
|
|
79
151
|
maxCostPerAction?: number | undefined;
|
|
80
152
|
}>>;
|
|
153
|
+
allowHighRiskAutoApproval: z.ZodOptional<z.ZodObject<{
|
|
154
|
+
financial: z.ZodOptional<z.ZodBoolean>;
|
|
155
|
+
admin: z.ZodOptional<z.ZodBoolean>;
|
|
156
|
+
}, "strip", z.ZodTypeAny, {
|
|
157
|
+
admin?: boolean | undefined;
|
|
158
|
+
financial?: boolean | undefined;
|
|
159
|
+
}, {
|
|
160
|
+
admin?: boolean | undefined;
|
|
161
|
+
financial?: boolean | undefined;
|
|
162
|
+
}>>;
|
|
163
|
+
vpnRoutes: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
164
|
+
domainPattern: z.ZodString;
|
|
165
|
+
vpnCredentialId: z.ZodString;
|
|
166
|
+
}, "strip", z.ZodTypeAny, {
|
|
167
|
+
domainPattern: string;
|
|
168
|
+
vpnCredentialId: string;
|
|
169
|
+
}, {
|
|
170
|
+
domainPattern: string;
|
|
171
|
+
vpnCredentialId: string;
|
|
172
|
+
}>, "many">>;
|
|
173
|
+
claudeBash: z.ZodOptional<z.ZodObject<{
|
|
174
|
+
rules: z.ZodArray<z.ZodObject<{
|
|
175
|
+
pattern: z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
|
|
176
|
+
decision: z.ZodEnum<["ALLOW", "REQUIRE_APPROVAL", "BLOCK"]>;
|
|
177
|
+
description: z.ZodOptional<z.ZodString>;
|
|
178
|
+
require_two_approvals: z.ZodOptional<z.ZodBoolean>;
|
|
179
|
+
allowed_approvers: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
180
|
+
}, "strip", z.ZodTypeAny, {
|
|
181
|
+
pattern: string;
|
|
182
|
+
decision: "ALLOW" | "REQUIRE_APPROVAL" | "BLOCK";
|
|
183
|
+
require_two_approvals?: boolean | undefined;
|
|
184
|
+
allowed_approvers?: string[] | undefined;
|
|
185
|
+
description?: string | undefined;
|
|
186
|
+
}, {
|
|
187
|
+
pattern: string;
|
|
188
|
+
decision: "ALLOW" | "REQUIRE_APPROVAL" | "BLOCK";
|
|
189
|
+
require_two_approvals?: boolean | undefined;
|
|
190
|
+
allowed_approvers?: string[] | undefined;
|
|
191
|
+
description?: string | undefined;
|
|
192
|
+
}>, "many">;
|
|
193
|
+
defaultDecision: z.ZodOptional<z.ZodEnum<["ALLOW", "REQUIRE_APPROVAL", "BLOCK"]>>;
|
|
194
|
+
}, "strip", z.ZodTypeAny, {
|
|
195
|
+
rules: {
|
|
196
|
+
pattern: string;
|
|
197
|
+
decision: "ALLOW" | "REQUIRE_APPROVAL" | "BLOCK";
|
|
198
|
+
require_two_approvals?: boolean | undefined;
|
|
199
|
+
allowed_approvers?: string[] | undefined;
|
|
200
|
+
description?: string | undefined;
|
|
201
|
+
}[];
|
|
202
|
+
defaultDecision?: "ALLOW" | "REQUIRE_APPROVAL" | "BLOCK" | undefined;
|
|
203
|
+
}, {
|
|
204
|
+
rules: {
|
|
205
|
+
pattern: string;
|
|
206
|
+
decision: "ALLOW" | "REQUIRE_APPROVAL" | "BLOCK";
|
|
207
|
+
require_two_approvals?: boolean | undefined;
|
|
208
|
+
allowed_approvers?: string[] | undefined;
|
|
209
|
+
description?: string | undefined;
|
|
210
|
+
}[];
|
|
211
|
+
defaultDecision?: "ALLOW" | "REQUIRE_APPROVAL" | "BLOCK" | undefined;
|
|
212
|
+
}>>;
|
|
81
213
|
}, "strip", z.ZodTypeAny, {
|
|
82
214
|
defaultMode: "allow" | "require_approval" | "block";
|
|
83
215
|
rules: {
|
|
84
216
|
decision: "ALLOW" | "REQUIRE_APPROVAL" | "BLOCK";
|
|
85
|
-
action_type?: "admin" | "read" | "write" | "financial" | undefined;
|
|
86
217
|
tool?: string | undefined;
|
|
87
|
-
|
|
218
|
+
action_type?: "admin" | "read" | "write" | "financial" | undefined;
|
|
88
219
|
require_two_approvals?: boolean | undefined;
|
|
220
|
+
allowed_approvers?: string[] | undefined;
|
|
221
|
+
domain?: string | undefined;
|
|
89
222
|
}[];
|
|
90
223
|
http?: {
|
|
91
224
|
allowedDomains: string[];
|
|
92
|
-
allowedMethods:
|
|
225
|
+
allowedMethods: ("GET" | "HEAD" | "OPTIONS" | "POST" | "PUT" | "DELETE" | "PATCH")[];
|
|
93
226
|
blockList: string[];
|
|
227
|
+
allowAllDomains?: boolean | undefined;
|
|
94
228
|
} | undefined;
|
|
229
|
+
claudeBash?: {
|
|
230
|
+
rules: {
|
|
231
|
+
pattern: string;
|
|
232
|
+
decision: "ALLOW" | "REQUIRE_APPROVAL" | "BLOCK";
|
|
233
|
+
require_two_approvals?: boolean | undefined;
|
|
234
|
+
allowed_approvers?: string[] | undefined;
|
|
235
|
+
description?: string | undefined;
|
|
236
|
+
}[];
|
|
237
|
+
defaultDecision?: "ALLOW" | "REQUIRE_APPROVAL" | "BLOCK" | undefined;
|
|
238
|
+
} | undefined;
|
|
239
|
+
ssh?: {
|
|
240
|
+
defaultDecision: "ALLOW" | "REQUIRE_APPROVAL" | "BLOCK";
|
|
241
|
+
allowedHosts: string[];
|
|
242
|
+
allowedUsers: string[];
|
|
243
|
+
commandRules: {
|
|
244
|
+
pattern: string;
|
|
245
|
+
decision: "ALLOW" | "REQUIRE_APPROVAL" | "BLOCK";
|
|
246
|
+
require_two_approvals?: boolean | undefined;
|
|
247
|
+
allowed_approvers?: string[] | undefined;
|
|
248
|
+
description?: string | undefined;
|
|
249
|
+
}[];
|
|
250
|
+
} | undefined;
|
|
251
|
+
vpnRoutes?: {
|
|
252
|
+
domainPattern: string;
|
|
253
|
+
vpnCredentialId: string;
|
|
254
|
+
}[] | undefined;
|
|
95
255
|
limits?: {
|
|
96
256
|
maxActionsPerHour?: number | undefined;
|
|
97
257
|
maxCostPerAction?: number | undefined;
|
|
98
258
|
} | undefined;
|
|
259
|
+
allowHighRiskAutoApproval?: {
|
|
260
|
+
admin?: boolean | undefined;
|
|
261
|
+
financial?: boolean | undefined;
|
|
262
|
+
} | undefined;
|
|
99
263
|
}, {
|
|
100
264
|
defaultMode: "allow" | "require_approval" | "block";
|
|
101
265
|
rules: {
|
|
102
266
|
decision: "ALLOW" | "REQUIRE_APPROVAL" | "BLOCK";
|
|
103
|
-
action_type?: "admin" | "read" | "write" | "financial" | undefined;
|
|
104
267
|
tool?: string | undefined;
|
|
105
|
-
|
|
268
|
+
action_type?: "admin" | "read" | "write" | "financial" | undefined;
|
|
106
269
|
require_two_approvals?: boolean | undefined;
|
|
270
|
+
allowed_approvers?: string[] | undefined;
|
|
271
|
+
domain?: string | undefined;
|
|
107
272
|
}[];
|
|
108
273
|
http?: {
|
|
109
274
|
allowedDomains: string[];
|
|
110
|
-
allowedMethods:
|
|
275
|
+
allowedMethods: ("GET" | "HEAD" | "OPTIONS" | "POST" | "PUT" | "DELETE" | "PATCH")[];
|
|
111
276
|
blockList: string[];
|
|
277
|
+
allowAllDomains?: boolean | undefined;
|
|
278
|
+
} | undefined;
|
|
279
|
+
claudeBash?: {
|
|
280
|
+
rules: {
|
|
281
|
+
pattern: string;
|
|
282
|
+
decision: "ALLOW" | "REQUIRE_APPROVAL" | "BLOCK";
|
|
283
|
+
require_two_approvals?: boolean | undefined;
|
|
284
|
+
allowed_approvers?: string[] | undefined;
|
|
285
|
+
description?: string | undefined;
|
|
286
|
+
}[];
|
|
287
|
+
defaultDecision?: "ALLOW" | "REQUIRE_APPROVAL" | "BLOCK" | undefined;
|
|
112
288
|
} | undefined;
|
|
289
|
+
ssh?: {
|
|
290
|
+
allowedHosts: string[];
|
|
291
|
+
allowedUsers: string[];
|
|
292
|
+
commandRules: {
|
|
293
|
+
pattern: string;
|
|
294
|
+
decision: "ALLOW" | "REQUIRE_APPROVAL" | "BLOCK";
|
|
295
|
+
require_two_approvals?: boolean | undefined;
|
|
296
|
+
allowed_approvers?: string[] | undefined;
|
|
297
|
+
description?: string | undefined;
|
|
298
|
+
}[];
|
|
299
|
+
defaultDecision?: "ALLOW" | "REQUIRE_APPROVAL" | "BLOCK" | undefined;
|
|
300
|
+
} | undefined;
|
|
301
|
+
vpnRoutes?: {
|
|
302
|
+
domainPattern: string;
|
|
303
|
+
vpnCredentialId: string;
|
|
304
|
+
}[] | undefined;
|
|
113
305
|
limits?: {
|
|
114
306
|
maxActionsPerHour?: number | undefined;
|
|
115
307
|
maxCostPerAction?: number | undefined;
|
|
116
308
|
} | undefined;
|
|
309
|
+
allowHighRiskAutoApproval?: {
|
|
310
|
+
admin?: boolean | undefined;
|
|
311
|
+
financial?: boolean | undefined;
|
|
312
|
+
} | undefined;
|
|
117
313
|
}>;
|
|
118
314
|
export declare const ApproveRequestSchema: z.ZodObject<{
|
|
119
315
|
action: z.ZodEnum<["approve", "deny"]>;
|
|
120
316
|
reason: z.ZodOptional<z.ZodString>;
|
|
317
|
+
reply_message: z.ZodOptional<z.ZodString>;
|
|
318
|
+
/** Server-side biometric challenge token (mobile clients only) */
|
|
319
|
+
biometric_challenge: z.ZodOptional<z.ZodString>;
|
|
121
320
|
}, "strip", z.ZodTypeAny, {
|
|
122
321
|
action: "approve" | "deny";
|
|
123
322
|
reason?: string | undefined;
|
|
323
|
+
reply_message?: string | undefined;
|
|
324
|
+
biometric_challenge?: string | undefined;
|
|
124
325
|
}, {
|
|
125
326
|
action: "approve" | "deny";
|
|
126
327
|
reason?: string | undefined;
|
|
328
|
+
reply_message?: string | undefined;
|
|
329
|
+
biometric_challenge?: string | undefined;
|
|
330
|
+
}>;
|
|
331
|
+
export declare const SendMessageSchema: z.ZodObject<{
|
|
332
|
+
content: z.ZodString;
|
|
333
|
+
thread_id: z.ZodOptional<z.ZodString>;
|
|
334
|
+
expires_at: z.ZodOptional<z.ZodString>;
|
|
335
|
+
metadata: z.ZodOptional<z.ZodEffects<z.ZodRecord<z.ZodString, z.ZodUnknown>, Record<string, unknown>, Record<string, unknown>>>;
|
|
336
|
+
}, "strip", z.ZodTypeAny, {
|
|
337
|
+
content: string;
|
|
338
|
+
thread_id?: string | undefined;
|
|
339
|
+
expires_at?: string | undefined;
|
|
340
|
+
metadata?: Record<string, unknown> | undefined;
|
|
341
|
+
}, {
|
|
342
|
+
content: string;
|
|
343
|
+
thread_id?: string | undefined;
|
|
344
|
+
expires_at?: string | undefined;
|
|
345
|
+
metadata?: Record<string, unknown> | undefined;
|
|
346
|
+
}>;
|
|
347
|
+
export declare const AgentSendMessageSchema: z.ZodObject<{
|
|
348
|
+
content: z.ZodString;
|
|
349
|
+
thread_id: z.ZodString;
|
|
350
|
+
metadata: z.ZodOptional<z.ZodEffects<z.ZodRecord<z.ZodString, z.ZodUnknown>, Record<string, unknown>, Record<string, unknown>>>;
|
|
351
|
+
}, "strip", z.ZodTypeAny, {
|
|
352
|
+
content: string;
|
|
353
|
+
thread_id: string;
|
|
354
|
+
metadata?: Record<string, unknown> | undefined;
|
|
355
|
+
}, {
|
|
356
|
+
content: string;
|
|
357
|
+
thread_id: string;
|
|
358
|
+
metadata?: Record<string, unknown> | undefined;
|
|
359
|
+
}>;
|
|
360
|
+
/**
|
|
361
|
+
* Schema for an agent creating a brand-new thread (Flow A of the gateway
|
|
362
|
+
* messages endpoint). Unlike AgentSendMessageSchema this has an optional
|
|
363
|
+
* `subject` for the thread title and no thread_id.
|
|
364
|
+
*/
|
|
365
|
+
export declare const AgentCreateThreadSchema: z.ZodObject<{
|
|
366
|
+
create_thread: z.ZodLiteral<true>;
|
|
367
|
+
content: z.ZodString;
|
|
368
|
+
subject: z.ZodOptional<z.ZodString>;
|
|
369
|
+
metadata: z.ZodOptional<z.ZodEffects<z.ZodRecord<z.ZodString, z.ZodUnknown>, Record<string, unknown>, Record<string, unknown>>>;
|
|
370
|
+
}, "strip", z.ZodTypeAny, {
|
|
371
|
+
content: string;
|
|
372
|
+
create_thread: true;
|
|
373
|
+
metadata?: Record<string, unknown> | undefined;
|
|
374
|
+
subject?: string | undefined;
|
|
375
|
+
}, {
|
|
376
|
+
content: string;
|
|
377
|
+
create_thread: true;
|
|
378
|
+
metadata?: Record<string, unknown> | undefined;
|
|
379
|
+
subject?: string | undefined;
|
|
127
380
|
}>;
|
|
128
381
|
//# sourceMappingURL=schemas.d.ts.map
|
package/dist/schemas.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../src/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../src/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAUxB;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,yEA8B1B,CAAC;AAEJ,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;EASnC,CAAC;AAEH,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;EAK9B,CAAC;AAIH,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAkH5B,CAAC;AAEH,eAAO,MAAM,oBAAoB;;;;IAI/B,kEAAkE;;;;;;;;;;;;EAElE,CAAC;AAKH,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;EAQ5B,CAAC;AAEH,eAAO,MAAM,sBAAsB;;;;;;;;;;;;EAOjC,CAAC;AAEH;;;;GAIG;AACH,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;EAQlC,CAAC"}
|
package/dist/schemas.js
CHANGED
|
@@ -1,15 +1,51 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ApproveRequestSchema = exports.PolicyRulesSchema = exports.RegisterAgentSchema = exports.AgentActionRequestSchema = void 0;
|
|
3
|
+
exports.AgentCreateThreadSchema = exports.AgentSendMessageSchema = exports.SendMessageSchema = exports.ApproveRequestSchema = exports.PolicyRulesSchema = exports.RegisterAgentSchema = exports.AgentActionRequestSchema = exports.WebhookUrlSchema = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
|
+
const regex_safety_js_1 = require("./regex-safety.js");
|
|
6
|
+
const policy_js_1 = require("./policy.js");
|
|
5
7
|
/** Max payload size: 64KB when serialized */
|
|
6
8
|
const MAX_PAYLOAD_SIZE = 65_536;
|
|
9
|
+
/** Maximum length for webhook URLs (standard URL length limit) */
|
|
10
|
+
const MAX_WEBHOOK_URL_LENGTH = 2048;
|
|
11
|
+
/**
|
|
12
|
+
* Reusable Zod schema for webhook URLs.
|
|
13
|
+
* Enforces: max length 2048, valid URL syntax, HTTPS-only,
|
|
14
|
+
* and rejects private/internal hostnames at parse time.
|
|
15
|
+
*/
|
|
16
|
+
exports.WebhookUrlSchema = zod_1.z
|
|
17
|
+
.string()
|
|
18
|
+
.max(MAX_WEBHOOK_URL_LENGTH, `Webhook URL exceeds maximum length (${MAX_WEBHOOK_URL_LENGTH} characters)`)
|
|
19
|
+
.refine((val) => {
|
|
20
|
+
try {
|
|
21
|
+
const parsed = new URL(val);
|
|
22
|
+
return parsed.protocol === 'https:';
|
|
23
|
+
}
|
|
24
|
+
catch {
|
|
25
|
+
return false;
|
|
26
|
+
}
|
|
27
|
+
}, { message: 'Webhook URL must be a valid HTTPS URL' })
|
|
28
|
+
.refine((val) => {
|
|
29
|
+
try {
|
|
30
|
+
const parsed = new URL(val);
|
|
31
|
+
const hostname = parsed.hostname;
|
|
32
|
+
const privatePatterns = [
|
|
33
|
+
/^127\./, /^10\./, /^172\.(1[6-9]|2\d|3[01])\./,
|
|
34
|
+
/^192\.168\./, /^169\.254\./, /^0\./,
|
|
35
|
+
/^localhost$/i, /\.local$/i, /\.internal$/i,
|
|
36
|
+
];
|
|
37
|
+
return !privatePatterns.some((p) => p.test(hostname));
|
|
38
|
+
}
|
|
39
|
+
catch {
|
|
40
|
+
return false;
|
|
41
|
+
}
|
|
42
|
+
}, { message: 'Webhook URL cannot target private or internal addresses' });
|
|
7
43
|
exports.AgentActionRequestSchema = zod_1.z.object({
|
|
8
44
|
action_type: zod_1.z.enum(['read', 'write', 'financial', 'admin']),
|
|
9
45
|
tool: zod_1.z.string().min(1).max(100).regex(/^[a-zA-Z0-9._\-:]+$/, 'Tool name must be alphanumeric with dots, dashes, underscores, or colons'),
|
|
10
46
|
payload: zod_1.z.record(zod_1.z.unknown()).refine((val) => JSON.stringify(val).length <= MAX_PAYLOAD_SIZE, { message: `Payload exceeds maximum size of ${MAX_PAYLOAD_SIZE} bytes` }),
|
|
11
47
|
idempotency_key: zod_1.z.string().max(128).optional(),
|
|
12
|
-
cost_estimate: zod_1.z.number().optional(),
|
|
48
|
+
cost_estimate: zod_1.z.number().nonnegative().optional(),
|
|
13
49
|
});
|
|
14
50
|
exports.RegisterAgentSchema = zod_1.z.object({
|
|
15
51
|
name: zod_1.z.string().min(1).max(100),
|
|
@@ -17,31 +53,137 @@ exports.RegisterAgentSchema = zod_1.z.object({
|
|
|
17
53
|
public_key: zod_1.z.string().min(40),
|
|
18
54
|
allowed_tools: zod_1.z.array(zod_1.z.string()).default([]),
|
|
19
55
|
});
|
|
56
|
+
const DOMAIN_RE = /^(\*\.)?([a-zA-Z0-9]([a-zA-Z0-9-]*[a-zA-Z0-9])?\.)*[a-zA-Z]{2,}$/;
|
|
20
57
|
exports.PolicyRulesSchema = zod_1.z.object({
|
|
21
58
|
defaultMode: zod_1.z.enum(['allow', 'require_approval', 'block']),
|
|
22
59
|
rules: zod_1.z.array(zod_1.z.object({
|
|
23
60
|
action_type: zod_1.z.enum(['read', 'write', 'financial', 'admin']).optional(),
|
|
24
|
-
tool: zod_1.z.string().optional(),
|
|
25
|
-
domain: zod_1.z.string().optional(),
|
|
61
|
+
tool: zod_1.z.string().max(100).regex(/^[a-zA-Z0-9._\-:]+$/, 'Tool name must be alphanumeric with dots, dashes, underscores, or colons').optional(),
|
|
62
|
+
domain: zod_1.z.string().regex(DOMAIN_RE, 'Invalid domain format').optional(),
|
|
26
63
|
decision: zod_1.z.enum(['ALLOW', 'REQUIRE_APPROVAL', 'BLOCK']),
|
|
27
64
|
require_two_approvals: zod_1.z.boolean().optional(),
|
|
28
|
-
|
|
65
|
+
allowed_approvers: zod_1.z.array(zod_1.z.string().uuid()).optional(),
|
|
66
|
+
}).refine(r => r.action_type || r.tool, { message: 'Rule must specify action_type or tool' })).max(100),
|
|
29
67
|
http: zod_1.z
|
|
30
68
|
.object({
|
|
31
|
-
allowedDomains: zod_1.z.array(zod_1.z.string()),
|
|
32
|
-
allowedMethods: zod_1.z.array(zod_1.z.
|
|
33
|
-
blockList: zod_1.z.array(zod_1.z.string()),
|
|
69
|
+
allowedDomains: zod_1.z.array(zod_1.z.string().min(1).max(253).regex(DOMAIN_RE, 'Invalid domain format')),
|
|
70
|
+
allowedMethods: zod_1.z.array(zod_1.z.enum(['GET', 'POST', 'PUT', 'PATCH', 'DELETE', 'HEAD', 'OPTIONS'])),
|
|
71
|
+
blockList: zod_1.z.array(zod_1.z.string().min(1).max(253).regex(DOMAIN_RE, 'Invalid domain format')),
|
|
72
|
+
allowAllDomains: zod_1.z.boolean().optional(),
|
|
73
|
+
})
|
|
74
|
+
.optional(),
|
|
75
|
+
ssh: zod_1.z
|
|
76
|
+
.object({
|
|
77
|
+
allowedHosts: zod_1.z.array(zod_1.z.string().min(1).max(253)).max(100),
|
|
78
|
+
allowedUsers: zod_1.z.array(zod_1.z.string().min(1).max(64).regex(/^[a-zA-Z0-9_\-.]+$/, 'Invalid SSH username')).max(50),
|
|
79
|
+
commandRules: zod_1.z
|
|
80
|
+
.array(zod_1.z.object({
|
|
81
|
+
pattern: zod_1.z.string().min(1).max(500).refine((p) => !(0, regex_safety_js_1.isLikelyRedos)(p), { message: 'Pattern rejected: looks like it could cause catastrophic regex backtracking (ReDoS). Simplify nested quantifiers or alternations.' }).refine((p) => { try {
|
|
82
|
+
(0, policy_js_1.compileSshPattern)(p);
|
|
83
|
+
return true;
|
|
84
|
+
}
|
|
85
|
+
catch {
|
|
86
|
+
return false;
|
|
87
|
+
} }, { message: 'Invalid pattern (must be a glob like "systemctl restart *" or a valid regex)' }),
|
|
88
|
+
decision: zod_1.z.enum(['ALLOW', 'REQUIRE_APPROVAL', 'BLOCK']),
|
|
89
|
+
require_two_approvals: zod_1.z.boolean().optional(),
|
|
90
|
+
allowed_approvers: zod_1.z.array(zod_1.z.string().uuid()).optional(),
|
|
91
|
+
description: zod_1.z.string().max(200).optional(),
|
|
92
|
+
}))
|
|
93
|
+
.max(200),
|
|
94
|
+
defaultDecision: zod_1.z.enum(['ALLOW', 'REQUIRE_APPROVAL', 'BLOCK']).default('REQUIRE_APPROVAL'),
|
|
34
95
|
})
|
|
35
96
|
.optional(),
|
|
36
97
|
limits: zod_1.z
|
|
37
98
|
.object({
|
|
38
|
-
maxCostPerAction: zod_1.z.number().optional(),
|
|
39
|
-
maxActionsPerHour: zod_1.z.number().optional(),
|
|
99
|
+
maxCostPerAction: zod_1.z.number().nonnegative().optional(),
|
|
100
|
+
maxActionsPerHour: zod_1.z.number().nonnegative().optional(),
|
|
101
|
+
})
|
|
102
|
+
.optional(),
|
|
103
|
+
allowHighRiskAutoApproval: zod_1.z
|
|
104
|
+
.object({
|
|
105
|
+
financial: zod_1.z.boolean().optional(),
|
|
106
|
+
admin: zod_1.z.boolean().optional(),
|
|
107
|
+
})
|
|
108
|
+
.optional(),
|
|
109
|
+
// Domain→VPN routing table. Each entry pins traffic to a specific VPN
|
|
110
|
+
// credential when the tool's target hostname matches `domainPattern`.
|
|
111
|
+
// Patterns may be a literal hostname or `*.<suffix>` for wildcard sub-
|
|
112
|
+
// domain matches. Capped at 50 entries to keep evaluation cheap and to
|
|
113
|
+
// force users toward broad patterns rather than a row per endpoint.
|
|
114
|
+
vpnRoutes: zod_1.z
|
|
115
|
+
.array(zod_1.z.object({
|
|
116
|
+
domainPattern: zod_1.z
|
|
117
|
+
.string()
|
|
118
|
+
.min(1)
|
|
119
|
+
.max(253)
|
|
120
|
+
.regex(/^(\*\.)?([a-zA-Z0-9]([a-zA-Z0-9-]*[a-zA-Z0-9])?\.)*[a-zA-Z]{2,}$/, 'Invalid domain pattern — use a hostname like "corp.example" or "*.corp.example"'),
|
|
121
|
+
vpnCredentialId: zod_1.z.string().uuid(),
|
|
122
|
+
}))
|
|
123
|
+
.max(50)
|
|
124
|
+
.optional(),
|
|
125
|
+
claudeBash: zod_1.z
|
|
126
|
+
.object({
|
|
127
|
+
rules: zod_1.z
|
|
128
|
+
.array(zod_1.z.object({
|
|
129
|
+
pattern: zod_1.z
|
|
130
|
+
.string()
|
|
131
|
+
.min(1)
|
|
132
|
+
.max(500)
|
|
133
|
+
.refine((p) => !(0, regex_safety_js_1.isLikelyRedos)(p), {
|
|
134
|
+
message: 'Pattern rejected: looks like it could cause catastrophic regex backtracking. Simplify nested quantifiers or alternations.',
|
|
135
|
+
})
|
|
136
|
+
.refine((p) => {
|
|
137
|
+
try {
|
|
138
|
+
(0, policy_js_1.compileClaudeBashPattern)(p);
|
|
139
|
+
return true;
|
|
140
|
+
}
|
|
141
|
+
catch {
|
|
142
|
+
return false;
|
|
143
|
+
}
|
|
144
|
+
}, { message: 'Invalid pattern (use a literal prefix like "grep /home/" or wrap a regex in /.../)' }),
|
|
145
|
+
decision: zod_1.z.enum(['ALLOW', 'REQUIRE_APPROVAL', 'BLOCK']),
|
|
146
|
+
description: zod_1.z.string().max(200).optional(),
|
|
147
|
+
// Per-rule overrides for the surrounding permission.claude_code
|
|
148
|
+
// rule's two-person and approver-allowlist settings. Match the
|
|
149
|
+
// shape on ssh.commandRules so admins learn one set of fields.
|
|
150
|
+
require_two_approvals: zod_1.z.boolean().optional(),
|
|
151
|
+
allowed_approvers: zod_1.z.array(zod_1.z.string().uuid()).optional(),
|
|
152
|
+
}))
|
|
153
|
+
.max(200),
|
|
154
|
+
defaultDecision: zod_1.z.enum(['ALLOW', 'REQUIRE_APPROVAL', 'BLOCK']).optional(),
|
|
40
155
|
})
|
|
41
156
|
.optional(),
|
|
42
157
|
});
|
|
43
158
|
exports.ApproveRequestSchema = zod_1.z.object({
|
|
44
159
|
action: zod_1.z.enum(['approve', 'deny']),
|
|
45
160
|
reason: zod_1.z.string().max(1000).optional(),
|
|
161
|
+
reply_message: zod_1.z.string().max(2000).optional(),
|
|
162
|
+
/** Server-side biometric challenge token (mobile clients only) */
|
|
163
|
+
biometric_challenge: zod_1.z.string().uuid().optional(),
|
|
164
|
+
});
|
|
165
|
+
/** Max metadata size: 8KB when serialized (prevents storage exhaustion) */
|
|
166
|
+
const MAX_METADATA_SIZE = 8_192;
|
|
167
|
+
exports.SendMessageSchema = zod_1.z.object({
|
|
168
|
+
content: zod_1.z.string().min(1).max(4096),
|
|
169
|
+
thread_id: zod_1.z.string().uuid().optional(),
|
|
170
|
+
expires_at: zod_1.z.string().datetime().optional(),
|
|
171
|
+
metadata: zod_1.z.record(zod_1.z.unknown()).refine((val) => JSON.stringify(val).length <= MAX_METADATA_SIZE, { message: `Metadata exceeds maximum size of ${MAX_METADATA_SIZE} bytes` }).optional(),
|
|
172
|
+
});
|
|
173
|
+
exports.AgentSendMessageSchema = zod_1.z.object({
|
|
174
|
+
content: zod_1.z.string().min(1).max(4096),
|
|
175
|
+
thread_id: zod_1.z.string().uuid(),
|
|
176
|
+
metadata: zod_1.z.record(zod_1.z.unknown()).refine((val) => JSON.stringify(val).length <= MAX_METADATA_SIZE, { message: `Metadata exceeds maximum size of ${MAX_METADATA_SIZE} bytes` }).optional(),
|
|
177
|
+
});
|
|
178
|
+
/**
|
|
179
|
+
* Schema for an agent creating a brand-new thread (Flow A of the gateway
|
|
180
|
+
* messages endpoint). Unlike AgentSendMessageSchema this has an optional
|
|
181
|
+
* `subject` for the thread title and no thread_id.
|
|
182
|
+
*/
|
|
183
|
+
exports.AgentCreateThreadSchema = zod_1.z.object({
|
|
184
|
+
create_thread: zod_1.z.literal(true),
|
|
185
|
+
content: zod_1.z.string().min(1).max(4096),
|
|
186
|
+
subject: zod_1.z.string().max(200).optional(),
|
|
187
|
+
metadata: zod_1.z.record(zod_1.z.unknown()).refine((val) => JSON.stringify(val).length <= MAX_METADATA_SIZE, { message: `Metadata exceeds maximum size of ${MAX_METADATA_SIZE} bytes` }).optional(),
|
|
46
188
|
});
|
|
47
189
|
//# sourceMappingURL=schemas.js.map
|
package/dist/schemas.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schemas.js","sourceRoot":"","sources":["../src/schemas.ts"],"names":[],"mappings":";;;AAAA,6BAAwB;
|
|
1
|
+
{"version":3,"file":"schemas.js","sourceRoot":"","sources":["../src/schemas.ts"],"names":[],"mappings":";;;AAAA,6BAAwB;AACxB,uDAAkD;AAClD,2CAA0E;AAE1E,6CAA6C;AAC7C,MAAM,gBAAgB,GAAG,MAAM,CAAC;AAEhC,kEAAkE;AAClE,MAAM,sBAAsB,GAAG,IAAI,CAAC;AAEpC;;;;GAIG;AACU,QAAA,gBAAgB,GAAG,OAAC;KAC9B,MAAM,EAAE;K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C;IACpC,SAAS,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE;IAC5B,QAAQ,EAAE,OAAC,CAAC,MAAM,CAAC,OAAC,CAAC,OAAO,EAAE,CAAC,CAAC,MAAM,CACpC,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,MAAM,IAAI,iBAAiB,EACxD,EAAE,OAAO,EAAE,oCAAoC,iBAAiB,QAAQ,EAAE,CAC3E,CAAC,QAAQ,EAAE;CACb,CAAC,CAAC;AAEH;;;;GAIG;AACU,QAAA,uBAAuB,GAAG,OAAC,CAAC,MAAM,CAAC;IAC9C,aAAa,EAAE,OAAC,CAAC,OAAO,CAAC,IAAI,CAAC;IAC9B,OAAO,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC;IACpC,OAAO,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE;IACvC,QAAQ,EAAE,OAAC,CAAC,MAAM,CAAC,OAAC,CAAC,OAAO,EAAE,CAAC,CAAC,MAAM,CACpC,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,MAAM,IAAI,iBAAiB,EACxD,EAAE,OAAO,EAAE,oCAAoC,iBAAiB,QAAQ,EAAE,CAC3E,CAAC,QAAQ,EAAE;CACb,CAAC,CAAC"}
|
package/dist/signing.d.ts
CHANGED
|
@@ -1,8 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Supported signature-scheme version. v1 is the original Ed25519 over
|
|
3
|
+
* `${canonicalStringify(body)}:${timestamp}:${nonce}`. Future versions
|
|
4
|
+
* (e.g. v2 switching to a hash-chained nonce or a different canonicalisation)
|
|
5
|
+
* bump this number; `verifyRequest` must then dispatch on the header value.
|
|
6
|
+
*
|
|
7
|
+
* The header is OPTIONAL for backward-compat with agents that don't send it;
|
|
8
|
+
* an absent header is treated as v1. New clients should set it explicitly so
|
|
9
|
+
* a future v2 rollout can leave v1 traffic alone during the transition.
|
|
10
|
+
*/
|
|
11
|
+
export declare const SIGNATURE_VERSION_CURRENT: "1";
|
|
12
|
+
export type SignatureVersion = '1';
|
|
1
13
|
export interface SignedHeaders {
|
|
2
14
|
'x-agent-id': string;
|
|
3
15
|
'x-timestamp': string;
|
|
4
16
|
'x-signature': string;
|
|
5
17
|
'x-nonce'?: string;
|
|
18
|
+
'x-signature-version'?: SignatureVersion;
|
|
6
19
|
}
|
|
7
20
|
export interface KeyPair {
|
|
8
21
|
publicKey: string;
|
|
@@ -16,8 +29,10 @@ export declare function verifyRequest(body: Record<string, unknown>, headers: {
|
|
|
16
29
|
'x-timestamp'?: string;
|
|
17
30
|
'x-signature'?: string;
|
|
18
31
|
'x-nonce'?: string;
|
|
32
|
+
'x-signature-version'?: string;
|
|
19
33
|
}, publicKeyBase64: string, maxSkewMs?: number): {
|
|
20
34
|
agentId: string;
|
|
21
35
|
nonce: string;
|
|
36
|
+
version: SignatureVersion;
|
|
22
37
|
};
|
|
23
38
|
//# sourceMappingURL=signing.d.ts.map
|
package/dist/signing.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"signing.d.ts","sourceRoot":"","sources":["../src/signing.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,aAAa;IAC5B,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE,MAAM,CAAC;IACtB,aAAa,EAAE,MAAM,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"signing.d.ts","sourceRoot":"","sources":["../src/signing.ts"],"names":[],"mappings":"AAGA;;;;;;;;;GASG;AACH,eAAO,MAAM,yBAAyB,EAAG,GAAY,CAAC;AACtD,MAAM,MAAM,gBAAgB,GAAG,GAAG,CAAC;AAEnC,MAAM,WAAW,aAAa;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