-
-
Notifications
You must be signed in to change notification settings - Fork 81k
Expand file tree
/
Copy pathfix-metadata.ts
More file actions
456 lines (451 loc) 路 15 KB
/
Copy pathfix-metadata.ts
File metadata and controls
456 lines (451 loc) 路 15 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
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
// Policy doctor fix metadata classifies findings before patch builders exist.
import { CHECK_IDS, POLICY_CHECK_IDS } from "./metadata.js";
export type PolicyFixClass =
| "automatic"
| "reviewRequired"
| "manual"
| "validateOnly"
| "unsupported";
export type PolicyFixMetadata = {
readonly checkId: (typeof POLICY_CHECK_IDS)[number];
readonly fixClass: PolicyFixClass;
readonly policyPath?: readonly string[];
readonly configTargets?: readonly string[];
readonly summary: string;
};
const m = (
checkId: (typeof POLICY_CHECK_IDS)[number],
fixClass: PolicyFixClass,
summary: string,
options: Omit<PolicyFixMetadata, "checkId" | "fixClass" | "summary"> = {},
): PolicyFixMetadata => ({
checkId,
fixClass,
summary,
...options,
});
export const POLICY_FIX_METADATA = [
m(CHECK_IDS.policyMissingFile, "manual", "Restore or author the approved policy artifact."),
m(CHECK_IDS.policyInvalidFile, "manual", "Repair the policy JSONC syntax or schema."),
m(
CHECK_IDS.policyHashMismatch,
"manual",
"Restore the approved artifact or update the expected hash after review.",
{ configTargets: ["plugins.entries.policy.config.expectedHash"] },
),
m(
CHECK_IDS.policyAttestationMismatch,
"manual",
"Review the current attestation and update accepted hashes after approval.",
{ configTargets: ["plugins.entries.policy.config.expectedAttestationHash"] },
),
m(
CHECK_IDS.policyDeniedChannelProvider,
"automatic",
"Disable product-managed channels matching the denied provider.",
{ policyPath: ["channels", "denyRules"], configTargets: ["channels"] },
),
m(CHECK_IDS.policyDeniedMcpServer, "reviewRequired", "Remove or disable the denied MCP server.", {
policyPath: ["mcp", "servers", "deny"],
configTargets: ["mcp.servers"],
}),
m(
CHECK_IDS.policyUnapprovedMcpServer,
"reviewRequired",
"Remove the unapproved MCP server or select an approved replacement.",
{ policyPath: ["mcp", "servers", "allow"], configTargets: ["mcp.servers"] },
),
m(
CHECK_IDS.policyDeniedModelProvider,
"reviewRequired",
"Remove the model provider or switch references to an approved provider.",
{ policyPath: ["models", "providers", "deny"], configTargets: ["models"] },
),
m(
CHECK_IDS.policyUnapprovedModelProvider,
"reviewRequired",
"Select an approved model provider.",
{ policyPath: ["models", "providers", "allow"], configTargets: ["models"] },
),
m(
CHECK_IDS.policyPrivateNetworkAccess,
"reviewRequired",
"Disable the concrete private-network access opt-in.",
{ policyPath: ["network", "privateNetwork", "allow"], configTargets: ["network"] },
),
m(
CHECK_IDS.policyIngressDmPolicyUnapproved,
"reviewRequired",
"Set channel DM policy to an allowed value.",
{ policyPath: ["ingress", "channels", "allowDmPolicies"], configTargets: ["channels"] },
),
m(
CHECK_IDS.policyIngressDmScopeUnapproved,
"reviewRequired",
"Move session DM scope to the required or stricter ordered value.",
{ policyPath: ["ingress", "session", "requireDmScope"], configTargets: ["ingress"] },
),
m(
CHECK_IDS.policyIngressOpenGroupsDenied,
"automatic",
"Disable product-managed open group ingress.",
{ policyPath: ["ingress", "channels", "denyOpenGroups"], configTargets: ["channels"] },
),
m(
CHECK_IDS.policyIngressGroupMentionRequired,
"automatic",
"Require mention in product-managed group channels.",
{ policyPath: ["ingress", "channels", "requireMentionInGroups"], configTargets: ["channels"] },
),
m(
CHECK_IDS.policyGatewayNonLoopbackBind,
"reviewRequired",
"Set gateway bind address to loopback when remote exposure is not intended.",
{
policyPath: ["gateway", "exposure", "allowNonLoopbackBind"],
configTargets: ["gateway.bind"],
},
),
m(
CHECK_IDS.policyGatewayAuthDisabled,
"manual",
"Configure token, password, or trusted-proxy auth.",
{ policyPath: ["gateway", "auth", "requireAuth"], configTargets: ["gateway.auth"] },
),
m(
CHECK_IDS.policyGatewayRateLimitMissing,
"reviewRequired",
"Add explicit gateway auth rate limits from product defaults.",
{
policyPath: ["gateway", "auth", "requireExplicitRateLimit"],
configTargets: ["gateway.auth.rateLimit"],
},
),
m(
CHECK_IDS.policyGatewayControlUiInsecure,
"automatic",
"Disable the insecure Control UI toggle.",
{ policyPath: ["gateway", "controlUi", "allowInsecure"], configTargets: ["gateway.controlUi"] },
),
m(
CHECK_IDS.policyGatewayTailscaleFunnel,
"reviewRequired",
"Disable Tailscale funnel or serve exposure.",
{ policyPath: ["gateway", "exposure", "allowTailscaleFunnel"], configTargets: ["tailscale"] },
),
m(
CHECK_IDS.policyGatewayRemoteEnabled,
"automatic",
"Disable product-managed remote gateway mode.",
{ policyPath: ["gateway", "remote", "allow"], configTargets: ["gateway.remote"] },
),
m(
CHECK_IDS.policyGatewayHttpEndpointEnabled,
"reviewRequired",
"Disable denied Gateway HTTP endpoints.",
{ policyPath: ["gateway", "http", "denyEndpoints"], configTargets: ["gateway.http"] },
),
m(
CHECK_IDS.policyGatewayHttpUrlFetchUnrestricted,
"manual",
"Add URL allowlists for each URL-fetch input.",
{ policyPath: ["gateway", "http", "requireUrlAllowlists"], configTargets: ["gateway.http"] },
),
m(
CHECK_IDS.policyGatewayNodeCommandDenied,
"reviewRequired",
"Add the command to gateway node denyCommands or update policy after review.",
{
policyPath: ["gateway", "nodes", "denyCommands"],
configTargets: ["gateway.nodes.denyCommands"],
},
),
m(
CHECK_IDS.policyAgentsWorkspaceAccessDenied,
"reviewRequired",
"Set agent workspace access to an allowed mode.",
{ policyPath: ["agents", "workspace", "allowedAccess"], configTargets: ["agents"] },
),
m(
CHECK_IDS.policyAgentsToolNotDenied,
"automatic",
"Merge required built-in workspace tool denies.",
{ policyPath: ["agents", "workspace", "denyTools"], configTargets: ["agents"] },
),
m(
CHECK_IDS.policyToolsProfileUnapproved,
"reviewRequired",
"Set the tool profile to an allowed profile.",
{ policyPath: ["tools", "profiles", "allow"], configTargets: ["tools.profile"] },
),
m(
CHECK_IDS.policyToolsFsWorkspaceOnlyRequired,
"reviewRequired",
"Set workspace-only filesystem posture when required assets remain readable.",
{
policyPath: ["tools", "fs", "requireWorkspaceOnly"],
configTargets: ["tools.fs.workspaceOnly"],
},
),
m(
CHECK_IDS.policyToolsExecSecurityUnapproved,
"reviewRequired",
"Set exec security to an allowed value.",
{ policyPath: ["tools", "exec", "allowSecurity"], configTargets: ["tools.exec.security"] },
),
m(
CHECK_IDS.policyToolsExecAskUnapproved,
"reviewRequired",
"Set exec ask mode to an allowed value.",
{ policyPath: ["tools", "exec", "requireAsk"], configTargets: ["tools.exec.ask"] },
),
m(
CHECK_IDS.policyToolsExecHostUnapproved,
"reviewRequired",
"Move exec host to an allowed host mode.",
{ policyPath: ["tools", "exec", "allowHosts"], configTargets: ["tools.exec.host"] },
),
m(CHECK_IDS.policyToolsElevatedEnabled, "automatic", "Set tools elevated mode to disabled.", {
policyPath: ["tools", "elevated", "allow"],
configTargets: ["tools.elevated.enabled"],
}),
m(
CHECK_IDS.policyToolsAlsoAllowMissing,
"reviewRequired",
"Add expected alsoAllow entries only when policy intentionally grants them.",
{ policyPath: ["tools", "alsoAllow", "expected"], configTargets: ["tools.alsoAllow"] },
),
m(
CHECK_IDS.policyToolsAlsoAllowUnexpected,
"reviewRequired",
"Remove unexpected alsoAllow entries.",
{ policyPath: ["tools", "alsoAllow", "expected"], configTargets: ["tools.alsoAllow"] },
),
m(
CHECK_IDS.policyToolsRequiredDenyMissing,
"automatic",
"Merge required built-in deny tool classes.",
{
policyPath: ["tools", "denyTools"],
configTargets: ["tools.deny", "agents.list[].tools.deny"],
},
),
m(
CHECK_IDS.policySandboxModeUnapproved,
"reviewRequired",
"Set sandbox mode to an allowed value.",
{ policyPath: ["sandbox", "requireMode"], configTargets: ["sandbox.mode"] },
),
m(
CHECK_IDS.policySandboxBackendUnapproved,
"reviewRequired",
"Choose an approved sandbox backend that is installed.",
{ policyPath: ["sandbox", "allowBackends"], configTargets: ["sandbox.backend"] },
),
m(
CHECK_IDS.policySandboxContainerPostureUnobservable,
"unsupported",
"Add observable container posture evidence before patching.",
),
m(
CHECK_IDS.policySandboxContainerHostNetworkDenied,
"reviewRequired",
"Disable container host networking.",
{
policyPath: ["sandbox", "containers", "denyHostNetwork"],
configTargets: ["sandbox.containers"],
},
),
m(
CHECK_IDS.policySandboxContainerNamespaceJoinDenied,
"reviewRequired",
"Disable joining container namespaces.",
{
policyPath: ["sandbox", "containers", "denyContainerNamespaceJoin"],
configTargets: ["sandbox.containers"],
},
),
m(
CHECK_IDS.policySandboxContainerMountModeRequired,
"reviewRequired",
"Change required mounts to read-only.",
{
policyPath: ["sandbox", "containers", "requireReadOnlyMounts"],
configTargets: ["sandbox.containers"],
},
),
m(
CHECK_IDS.policySandboxContainerRuntimeSocketMount,
"reviewRequired",
"Remove container runtime socket binds.",
{
policyPath: ["sandbox", "containers", "denyContainerRuntimeSocketMounts"],
configTargets: ["sandbox.containers"],
},
),
m(
CHECK_IDS.policySandboxContainerUnconfinedProfile,
"reviewRequired",
"Remove unconfined container profiles.",
{
policyPath: ["sandbox", "containers", "denyUnconfinedProfiles"],
configTargets: ["sandbox.containers"],
},
),
m(
CHECK_IDS.policySandboxBrowserCdpSourceRangeMissing,
"manual",
"Add an explicit browser CDP source range.",
{
policyPath: ["sandbox", "browser", "requireCdpSourceRange"],
configTargets: ["agents.sandbox.browser"],
},
),
m(
CHECK_IDS.policyDataHandlingRedactionDisabled,
"automatic",
"Set sensitive logging to a redacting mode.",
{
policyPath: ["dataHandling", "sensitiveLogging", "requireRedaction"],
configTargets: ["logging.redactSensitive"],
},
),
m(
CHECK_IDS.policyDataHandlingTelemetryContentCapture,
"automatic",
"Disable telemetry content capture.",
{
policyPath: ["dataHandling", "telemetry", "denyContentCapture"],
configTargets: ["diagnostics.otel.captureContent"],
},
),
m(
CHECK_IDS.policyDataHandlingSessionRetentionNotEnforced,
"reviewRequired",
"Set session maintenance to enforced mode.",
{
policyPath: ["dataHandling", "retention", "requireSessionMaintenance"],
configTargets: ["session.maintenance.mode"],
},
),
m(
CHECK_IDS.policyDataHandlingSessionTranscriptMemory,
"reviewRequired",
"Disable transcript indexing for the affected agent scope.",
{
policyPath: ["dataHandling", "memory", "denySessionTranscriptIndexing"],
configTargets: ["memory"],
},
),
m(
CHECK_IDS.policySecretsUnmanagedProvider,
"manual",
"Migrate the secret to a managed provider.",
{ policyPath: ["secrets", "requireManagedProviders"], configTargets: ["secrets"] },
),
m(
CHECK_IDS.policySecretsDeniedProviderSource,
"reviewRequired",
"Move the secret out of the denied source.",
{ policyPath: ["secrets", "denySources"], configTargets: ["secrets"] },
),
m(
CHECK_IDS.policySecretsInsecureProvider,
"reviewRequired",
"Remove insecure provider overrides.",
{ policyPath: ["secrets", "allowInsecureProviders"], configTargets: ["secrets"] },
),
m(
CHECK_IDS.policyAuthProfileInvalidMetadata,
"manual",
"Add required provider and mode metadata to auth profiles.",
{ policyPath: ["auth", "profiles", "requireMetadata"], configTargets: ["auth.profiles"] },
),
m(
CHECK_IDS.policyAuthProfileUnapprovedMode,
"manual",
"Change auth mode and credentials through the auth owner flow.",
{ policyPath: ["auth", "profiles", "allowModes"], configTargets: ["auth.profiles"] },
),
m(
CHECK_IDS.policyExecApprovalsMissing,
"manual",
"Restore an attributable exec-approvals evidence file.",
{ policyPath: ["execApprovals", "requireFile"], configTargets: ["exec-approvals.json"] },
),
m(CHECK_IDS.policyExecApprovalsInvalid, "manual", "Repair the exec approvals evidence artifact."),
m(
CHECK_IDS.policyExecApprovalsDefaultSecurityUnapproved,
"manual",
"Update reviewed default approval evidence or policy.",
{
policyPath: ["execApprovals", "defaults", "allowSecurity"],
configTargets: ["exec-approvals.json"],
},
),
m(
CHECK_IDS.policyExecApprovalsAgentSecurityUnapproved,
"manual",
"Update reviewed agent approval evidence or policy.",
{
policyPath: ["execApprovals", "agents", "allowSecurity"],
configTargets: ["exec-approvals.json"],
},
),
m(
CHECK_IDS.policyExecApprovalsAutoAllowSkillsEnabled,
"reviewRequired",
"Disable auto-allow skills in the approval owner surface.",
{
policyPath: ["execApprovals", "agents", "allowAutoAllowSkills"],
configTargets: ["exec-approvals.json"],
},
),
m(
CHECK_IDS.policyExecApprovalsAllowlistMissing,
"manual",
"Add expected approval patterns through approval review.",
{
policyPath: ["execApprovals", "agents", "allowlist", "expected"],
configTargets: ["exec-approvals.json"],
},
),
m(
CHECK_IDS.policyExecApprovalsAllowlistUnexpected,
"manual",
"Remove unexpected approval patterns through approval review.",
{
policyPath: ["execApprovals", "agents", "allowlist", "expected"],
configTargets: ["exec-approvals.json"],
},
),
m(
CHECK_IDS.policyMissingToolRisk,
"manual",
"Add tool risk metadata in the owning tool declaration.",
{ policyPath: ["tools", "requireMetadata"], configTargets: ["tools"] },
),
m(CHECK_IDS.policyUnknownToolRisk, "manual", "Use a supported tool risk level.", {
policyPath: ["tools", "requireMetadata"],
configTargets: ["tools"],
}),
m(
CHECK_IDS.policyMissingToolSensitivity,
"manual",
"Add tool sensitivity metadata in the owning tool declaration.",
{ policyPath: ["tools", "requireMetadata"], configTargets: ["tools"] },
),
m(
CHECK_IDS.policyMissingToolOwner,
"manual",
"Add owner metadata in the owning tool declaration.",
{ policyPath: ["tools", "requireMetadata"], configTargets: ["tools"] },
),
m(CHECK_IDS.policyUnknownToolSensitivity, "manual", "Use a supported tool sensitivity token.", {
policyPath: ["tools", "requireMetadata"],
configTargets: ["tools"],
}),
] as const satisfies readonly PolicyFixMetadata[];
export const POLICY_FIX_METADATA_BY_CHECK_ID = new Map(
POLICY_FIX_METADATA.map((rule) => [rule.checkId, rule] as const),
);