@aegis-scan/core 0.16.6 → 0.18.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.
Files changed (125) hide show
  1. package/README.md +37 -0
  2. package/dist/index.d.ts +5 -0
  3. package/dist/index.d.ts.map +1 -1
  4. package/dist/index.js +5 -0
  5. package/dist/index.js.map +1 -1
  6. package/dist/manipulation-resistance/ai-io-boundary.d.ts +84 -0
  7. package/dist/manipulation-resistance/ai-io-boundary.d.ts.map +1 -0
  8. package/dist/manipulation-resistance/ai-io-boundary.js +216 -0
  9. package/dist/manipulation-resistance/ai-io-boundary.js.map +1 -0
  10. package/dist/manipulation-resistance/config-integrity.d.ts +28 -0
  11. package/dist/manipulation-resistance/config-integrity.d.ts.map +1 -0
  12. package/dist/manipulation-resistance/config-integrity.js +53 -0
  13. package/dist/manipulation-resistance/config-integrity.js.map +1 -0
  14. package/dist/manipulation-resistance/index.d.ts +16 -0
  15. package/dist/manipulation-resistance/index.d.ts.map +1 -0
  16. package/dist/manipulation-resistance/index.js +16 -0
  17. package/dist/manipulation-resistance/index.js.map +1 -0
  18. package/dist/manipulation-resistance/instruction-boundary.d.ts +50 -0
  19. package/dist/manipulation-resistance/instruction-boundary.d.ts.map +1 -0
  20. package/dist/manipulation-resistance/instruction-boundary.js +114 -0
  21. package/dist/manipulation-resistance/instruction-boundary.js.map +1 -0
  22. package/dist/manipulation-resistance/oob-blocker.d.ts +58 -0
  23. package/dist/manipulation-resistance/oob-blocker.d.ts.map +1 -0
  24. package/dist/manipulation-resistance/oob-blocker.js +55 -0
  25. package/dist/manipulation-resistance/oob-blocker.js.map +1 -0
  26. package/dist/manipulation-resistance/redirect-policy.d.ts +43 -0
  27. package/dist/manipulation-resistance/redirect-policy.d.ts.map +1 -0
  28. package/dist/manipulation-resistance/redirect-policy.js +197 -0
  29. package/dist/manipulation-resistance/redirect-policy.js.map +1 -0
  30. package/dist/manipulation-resistance/response-validator.d.ts +33 -0
  31. package/dist/manipulation-resistance/response-validator.d.ts.map +1 -0
  32. package/dist/manipulation-resistance/response-validator.js +186 -0
  33. package/dist/manipulation-resistance/response-validator.js.map +1 -0
  34. package/dist/manipulation-resistance/scope-expansion-detector.d.ts +33 -0
  35. package/dist/manipulation-resistance/scope-expansion-detector.d.ts.map +1 -0
  36. package/dist/manipulation-resistance/scope-expansion-detector.js +68 -0
  37. package/dist/manipulation-resistance/scope-expansion-detector.js.map +1 -0
  38. package/dist/oversight/approval-gates.d.ts +77 -0
  39. package/dist/oversight/approval-gates.d.ts.map +1 -0
  40. package/dist/oversight/approval-gates.js +133 -0
  41. package/dist/oversight/approval-gates.js.map +1 -0
  42. package/dist/oversight/authority-matrix.d.ts +39 -0
  43. package/dist/oversight/authority-matrix.d.ts.map +1 -0
  44. package/dist/oversight/authority-matrix.js +75 -0
  45. package/dist/oversight/authority-matrix.js.map +1 -0
  46. package/dist/oversight/cia-scoring.d.ts +56 -0
  47. package/dist/oversight/cia-scoring.d.ts.map +1 -0
  48. package/dist/oversight/cia-scoring.js +98 -0
  49. package/dist/oversight/cia-scoring.js.map +1 -0
  50. package/dist/oversight/escalation.d.ts +58 -0
  51. package/dist/oversight/escalation.d.ts.map +1 -0
  52. package/dist/oversight/escalation.js +97 -0
  53. package/dist/oversight/escalation.js.map +1 -0
  54. package/dist/oversight/index.d.ts +15 -0
  55. package/dist/oversight/index.d.ts.map +1 -0
  56. package/dist/oversight/index.js +15 -0
  57. package/dist/oversight/index.js.map +1 -0
  58. package/dist/roe/index.d.ts +3 -0
  59. package/dist/roe/index.d.ts.map +1 -0
  60. package/dist/roe/index.js +3 -0
  61. package/dist/roe/index.js.map +1 -0
  62. package/dist/roe/loader.d.ts +15 -0
  63. package/dist/roe/loader.d.ts.map +1 -0
  64. package/dist/roe/loader.js +56 -0
  65. package/dist/roe/loader.js.map +1 -0
  66. package/dist/roe/types.d.ts +738 -0
  67. package/dist/roe/types.d.ts.map +1 -0
  68. package/dist/roe/types.js +525 -0
  69. package/dist/roe/types.js.map +1 -0
  70. package/dist/runtime/chain.d.ts +60 -0
  71. package/dist/runtime/chain.d.ts.map +1 -0
  72. package/dist/runtime/chain.js +156 -0
  73. package/dist/runtime/chain.js.map +1 -0
  74. package/dist/runtime/events.d.ts +104 -0
  75. package/dist/runtime/events.d.ts.map +1 -0
  76. package/dist/runtime/events.js +68 -0
  77. package/dist/runtime/events.js.map +1 -0
  78. package/dist/runtime/hash.d.ts +16 -0
  79. package/dist/runtime/hash.d.ts.map +1 -0
  80. package/dist/runtime/hash.js +70 -0
  81. package/dist/runtime/hash.js.map +1 -0
  82. package/dist/runtime/index.d.ts +7 -0
  83. package/dist/runtime/index.d.ts.map +1 -0
  84. package/dist/runtime/index.js +7 -0
  85. package/dist/runtime/index.js.map +1 -0
  86. package/dist/runtime/notifications.d.ts +24 -0
  87. package/dist/runtime/notifications.d.ts.map +1 -0
  88. package/dist/runtime/notifications.js +41 -0
  89. package/dist/runtime/notifications.js.map +1 -0
  90. package/dist/runtime/signals.d.ts +56 -0
  91. package/dist/runtime/signals.d.ts.map +1 -0
  92. package/dist/runtime/signals.js +72 -0
  93. package/dist/runtime/signals.js.map +1 -0
  94. package/dist/runtime/state.d.ts +88 -0
  95. package/dist/runtime/state.d.ts.map +1 -0
  96. package/dist/runtime/state.js +172 -0
  97. package/dist/runtime/state.js.map +1 -0
  98. package/dist/safety-controls/boundary-monitor.d.ts +45 -0
  99. package/dist/safety-controls/boundary-monitor.d.ts.map +1 -0
  100. package/dist/safety-controls/boundary-monitor.js +77 -0
  101. package/dist/safety-controls/boundary-monitor.js.map +1 -0
  102. package/dist/safety-controls/decision-timeout.d.ts +56 -0
  103. package/dist/safety-controls/decision-timeout.d.ts.map +1 -0
  104. package/dist/safety-controls/decision-timeout.js +67 -0
  105. package/dist/safety-controls/decision-timeout.js.map +1 -0
  106. package/dist/safety-controls/health-monitor.d.ts +61 -0
  107. package/dist/safety-controls/health-monitor.d.ts.map +1 -0
  108. package/dist/safety-controls/health-monitor.js +79 -0
  109. package/dist/safety-controls/health-monitor.js.map +1 -0
  110. package/dist/safety-controls/index.d.ts +13 -0
  111. package/dist/safety-controls/index.d.ts.map +1 -0
  112. package/dist/safety-controls/index.js +13 -0
  113. package/dist/safety-controls/index.js.map +1 -0
  114. package/dist/safety-controls/kill-switch.d.ts +45 -0
  115. package/dist/safety-controls/kill-switch.d.ts.map +1 -0
  116. package/dist/safety-controls/kill-switch.js +117 -0
  117. package/dist/safety-controls/kill-switch.js.map +1 -0
  118. package/dist/safety-controls/post-test-integrity.d.ts +51 -0
  119. package/dist/safety-controls/post-test-integrity.d.ts.map +1 -0
  120. package/dist/safety-controls/post-test-integrity.js +79 -0
  121. package/dist/safety-controls/post-test-integrity.js.map +1 -0
  122. package/dist/types.d.ts +17 -0
  123. package/dist/types.d.ts.map +1 -1
  124. package/package.json +2 -1
  125. package/sbom.cdx.json +1 -1
@@ -0,0 +1,738 @@
1
+ /**
2
+ * Rules of Engagement (RoE) schema for AEGIS Autonomous Pentest Layer.
3
+ *
4
+ * Closes APTS Tier-1 requirements:
5
+ * - APTS-SE-001 — Rules of Engagement Specification and Validation
6
+ * - APTS-SE-003 — Domain Scope Validation and Wildcard Handling
7
+ * - APTS-SE-004 — Temporal Boundary and Timezone Handling
8
+ * - APTS-SE-005 — Asset Criticality Classification and Integration
9
+ * - APTS-SE-006 — Pre-Action Scope Validation
10
+ * - APTS-AL-006 — Basic Scope Validation and Policy Enforcement
11
+ * - APTS-AL-014 — Boundary Definition and Enforcement Framework
12
+ *
13
+ * Design notes:
14
+ * - JSON-shaped, Zod-strict-validated. Operators may author in YAML and
15
+ * pre-convert at load time, but the canonical on-disk form is JSON.
16
+ * - The schema captures authorization-attestation, in-/out-of-scope
17
+ * domains and IP ranges, asset criticality classification, temporal
18
+ * envelope (with optional blackout windows), and stop conditions.
19
+ * - Per-action validators are pure functions on a loaded RoE — they
20
+ * take a target/action and return an explicit allow/deny decision
21
+ * with rationale. The decision is logged by the orchestrator into
22
+ * the audit channel.
23
+ */
24
+ import { z } from 'zod';
25
+ export declare const RoESchema: z.ZodObject<{
26
+ roe_id: z.ZodString;
27
+ spec_version: z.ZodLiteral<"0.1.0">;
28
+ operator: z.ZodObject<{
29
+ organization: z.ZodString;
30
+ authorized_by: z.ZodString;
31
+ contact: z.ZodString;
32
+ }, "strict", z.ZodTypeAny, {
33
+ organization: string;
34
+ authorized_by: string;
35
+ contact: string;
36
+ }, {
37
+ organization: string;
38
+ authorized_by: string;
39
+ contact: string;
40
+ }>;
41
+ authorization: z.ZodObject<{
42
+ statement: z.ZodString;
43
+ authority_url: z.ZodOptional<z.ZodString>;
44
+ signature_method: z.ZodDefault<z.ZodEnum<["operator-attested", "external-signed"]>>;
45
+ /** APTS-HO-004 — declarative role↔action authority delegation matrix. */
46
+ delegation_matrix: z.ZodOptional<z.ZodArray<z.ZodObject<{
47
+ role: z.ZodString;
48
+ can_approve: z.ZodArray<z.ZodString, "many">;
49
+ }, "strict", z.ZodTypeAny, {
50
+ role: string;
51
+ can_approve: string[];
52
+ }, {
53
+ role: string;
54
+ can_approve: string[];
55
+ }>, "many">>;
56
+ }, "strict", z.ZodTypeAny, {
57
+ statement: string;
58
+ signature_method: "operator-attested" | "external-signed";
59
+ authority_url?: string | undefined;
60
+ delegation_matrix?: {
61
+ role: string;
62
+ can_approve: string[];
63
+ }[] | undefined;
64
+ }, {
65
+ statement: string;
66
+ authority_url?: string | undefined;
67
+ signature_method?: "operator-attested" | "external-signed" | undefined;
68
+ delegation_matrix?: {
69
+ role: string;
70
+ can_approve: string[];
71
+ }[] | undefined;
72
+ }>;
73
+ in_scope: z.ZodObject<{
74
+ domains: z.ZodDefault<z.ZodArray<z.ZodObject<{
75
+ pattern: z.ZodEffects<z.ZodString, string, string>;
76
+ includeSubdomains: z.ZodDefault<z.ZodBoolean>;
77
+ }, "strip", z.ZodTypeAny, {
78
+ pattern: string;
79
+ includeSubdomains: boolean;
80
+ }, {
81
+ pattern: string;
82
+ includeSubdomains?: boolean | undefined;
83
+ }>, "many">>;
84
+ ip_ranges: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
85
+ repository_paths: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
86
+ }, "strict", z.ZodTypeAny, {
87
+ domains: {
88
+ pattern: string;
89
+ includeSubdomains: boolean;
90
+ }[];
91
+ ip_ranges: string[];
92
+ repository_paths: string[];
93
+ }, {
94
+ domains?: {
95
+ pattern: string;
96
+ includeSubdomains?: boolean | undefined;
97
+ }[] | undefined;
98
+ ip_ranges?: string[] | undefined;
99
+ repository_paths?: string[] | undefined;
100
+ }>;
101
+ out_of_scope: z.ZodDefault<z.ZodObject<{
102
+ domains: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
103
+ ip_ranges: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
104
+ paths: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
105
+ }, "strict", z.ZodTypeAny, {
106
+ domains: string[];
107
+ ip_ranges: string[];
108
+ paths: string[];
109
+ }, {
110
+ domains?: string[] | undefined;
111
+ ip_ranges?: string[] | undefined;
112
+ paths?: string[] | undefined;
113
+ }>>;
114
+ asset_criticality: z.ZodDefault<z.ZodArray<z.ZodObject<{
115
+ pattern: z.ZodString;
116
+ classification: z.ZodEnum<["critical", "high", "medium", "low"]>;
117
+ notes: z.ZodOptional<z.ZodString>;
118
+ }, "strict", z.ZodTypeAny, {
119
+ pattern: string;
120
+ classification: "critical" | "high" | "medium" | "low";
121
+ notes?: string | undefined;
122
+ }, {
123
+ pattern: string;
124
+ classification: "critical" | "high" | "medium" | "low";
125
+ notes?: string | undefined;
126
+ }>, "many">>;
127
+ temporal: z.ZodEffects<z.ZodObject<{
128
+ start: z.ZodString;
129
+ end: z.ZodString;
130
+ timezone: z.ZodString;
131
+ blackout_windows: z.ZodDefault<z.ZodArray<z.ZodEffects<z.ZodObject<{
132
+ start: z.ZodString;
133
+ end: z.ZodString;
134
+ reason: z.ZodString;
135
+ }, "strict", z.ZodTypeAny, {
136
+ reason: string;
137
+ start: string;
138
+ end: string;
139
+ }, {
140
+ reason: string;
141
+ start: string;
142
+ end: string;
143
+ }>, {
144
+ reason: string;
145
+ start: string;
146
+ end: string;
147
+ }, {
148
+ reason: string;
149
+ start: string;
150
+ end: string;
151
+ }>, "many">>;
152
+ }, "strict", z.ZodTypeAny, {
153
+ start: string;
154
+ end: string;
155
+ timezone: string;
156
+ blackout_windows: {
157
+ reason: string;
158
+ start: string;
159
+ end: string;
160
+ }[];
161
+ }, {
162
+ start: string;
163
+ end: string;
164
+ timezone: string;
165
+ blackout_windows?: {
166
+ reason: string;
167
+ start: string;
168
+ end: string;
169
+ }[] | undefined;
170
+ }>, {
171
+ start: string;
172
+ end: string;
173
+ timezone: string;
174
+ blackout_windows: {
175
+ reason: string;
176
+ start: string;
177
+ end: string;
178
+ }[];
179
+ }, {
180
+ start: string;
181
+ end: string;
182
+ timezone: string;
183
+ blackout_windows?: {
184
+ reason: string;
185
+ start: string;
186
+ end: string;
187
+ }[] | undefined;
188
+ }>;
189
+ stop_conditions: z.ZodDefault<z.ZodObject<{
190
+ on_critical_finding: z.ZodDefault<z.ZodEnum<["halt", "notify-and-continue", "continue"]>>;
191
+ max_findings: z.ZodOptional<z.ZodNumber>;
192
+ max_duration_minutes: z.ZodOptional<z.ZodNumber>;
193
+ /** APTS-HO-003 — per-phase decision timeout. Falls back to max_duration_minutes/4 when omitted. */
194
+ phase_timeout_minutes: z.ZodOptional<z.ZodNumber>;
195
+ on_target_unreachable_seconds: z.ZodOptional<z.ZodNumber>;
196
+ }, "strict", z.ZodTypeAny, {
197
+ on_critical_finding: "halt" | "notify-and-continue" | "continue";
198
+ max_findings?: number | undefined;
199
+ max_duration_minutes?: number | undefined;
200
+ phase_timeout_minutes?: number | undefined;
201
+ on_target_unreachable_seconds?: number | undefined;
202
+ }, {
203
+ on_critical_finding?: "halt" | "notify-and-continue" | "continue" | undefined;
204
+ max_findings?: number | undefined;
205
+ max_duration_minutes?: number | undefined;
206
+ phase_timeout_minutes?: number | undefined;
207
+ on_target_unreachable_seconds?: number | undefined;
208
+ }>>;
209
+ notifications: z.ZodOptional<z.ZodObject<{
210
+ channels: z.ZodDefault<z.ZodArray<z.ZodObject<{
211
+ type: z.ZodEnum<["webhook", "log"]>;
212
+ url: z.ZodOptional<z.ZodString>;
213
+ events: z.ZodArray<z.ZodEnum<["start", "halt", "critical-finding", "completion"]>, "many">;
214
+ }, "strict", z.ZodTypeAny, {
215
+ type: "webhook" | "log";
216
+ events: ("start" | "halt" | "critical-finding" | "completion")[];
217
+ url?: string | undefined;
218
+ }, {
219
+ type: "webhook" | "log";
220
+ events: ("start" | "halt" | "critical-finding" | "completion")[];
221
+ url?: string | undefined;
222
+ }>, "many">>;
223
+ }, "strict", z.ZodTypeAny, {
224
+ channels: {
225
+ type: "webhook" | "log";
226
+ events: ("start" | "halt" | "critical-finding" | "completion")[];
227
+ url?: string | undefined;
228
+ }[];
229
+ }, {
230
+ channels?: {
231
+ type: "webhook" | "log";
232
+ events: ("start" | "halt" | "critical-finding" | "completion")[];
233
+ url?: string | undefined;
234
+ }[] | undefined;
235
+ }>>;
236
+ references: z.ZodOptional<z.ZodObject<{
237
+ incident_response_plan: z.ZodOptional<z.ZodString>;
238
+ contract_id: z.ZodOptional<z.ZodString>;
239
+ apts_conformance_claim: z.ZodOptional<z.ZodString>;
240
+ }, "strict", z.ZodTypeAny, {
241
+ incident_response_plan?: string | undefined;
242
+ contract_id?: string | undefined;
243
+ apts_conformance_claim?: string | undefined;
244
+ }, {
245
+ incident_response_plan?: string | undefined;
246
+ contract_id?: string | undefined;
247
+ apts_conformance_claim?: string | undefined;
248
+ }>>;
249
+ /** APTS-MR-018 — declarative sandboxing constraints for LLM-pentest wrappers. */
250
+ sandboxing: z.ZodDefault<z.ZodObject<{
251
+ mode: z.ZodDefault<z.ZodEnum<["docker", "firejail", "none"]>>;
252
+ docker_network: z.ZodOptional<z.ZodString>;
253
+ image_overrides: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
254
+ extra_docker_args: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
255
+ }, "strict", z.ZodTypeAny, {
256
+ mode: "none" | "docker" | "firejail";
257
+ docker_network?: string | undefined;
258
+ image_overrides?: Record<string, string> | undefined;
259
+ extra_docker_args?: string[] | undefined;
260
+ }, {
261
+ mode?: "none" | "docker" | "firejail" | undefined;
262
+ docker_network?: string | undefined;
263
+ image_overrides?: Record<string, string> | undefined;
264
+ extra_docker_args?: string[] | undefined;
265
+ }>>;
266
+ /** APTS-SC-009/010, HO-003 — declarative safety-control overrides. */
267
+ safety_controls: z.ZodOptional<z.ZodObject<{
268
+ /** APTS-SC-010 — auto-halt thresholds. */
269
+ health_thresholds: z.ZodOptional<z.ZodObject<{
270
+ max_heap_mb: z.ZodOptional<z.ZodNumber>;
271
+ max_error_rate: z.ZodOptional<z.ZodNumber>;
272
+ max_target_response_ms: z.ZodOptional<z.ZodNumber>;
273
+ }, "strict", z.ZodTypeAny, {
274
+ max_heap_mb?: number | undefined;
275
+ max_error_rate?: number | undefined;
276
+ max_target_response_ms?: number | undefined;
277
+ }, {
278
+ max_heap_mb?: number | undefined;
279
+ max_error_rate?: number | undefined;
280
+ max_target_response_ms?: number | undefined;
281
+ }>>;
282
+ /** APTS-SC-009 — operator dead-man-switch heartbeat URL (HTTPS only). */
283
+ heartbeat_url: z.ZodOptional<z.ZodString>;
284
+ /** APTS-SC-009 — heartbeat interval in seconds. */
285
+ heartbeat_interval_seconds: z.ZodOptional<z.ZodNumber>;
286
+ }, "strict", z.ZodTypeAny, {
287
+ health_thresholds?: {
288
+ max_heap_mb?: number | undefined;
289
+ max_error_rate?: number | undefined;
290
+ max_target_response_ms?: number | undefined;
291
+ } | undefined;
292
+ heartbeat_url?: string | undefined;
293
+ heartbeat_interval_seconds?: number | undefined;
294
+ }, {
295
+ health_thresholds?: {
296
+ max_heap_mb?: number | undefined;
297
+ max_error_rate?: number | undefined;
298
+ max_target_response_ms?: number | undefined;
299
+ } | undefined;
300
+ heartbeat_url?: string | undefined;
301
+ heartbeat_interval_seconds?: number | undefined;
302
+ }>>;
303
+ /** APTS-HO-001/010 — per-autonomy-level pre-approval gating. */
304
+ autonomy_levels: z.ZodOptional<z.ZodObject<{
305
+ L1: z.ZodOptional<z.ZodObject<{
306
+ approval_required: z.ZodOptional<z.ZodBoolean>;
307
+ pre_approved: z.ZodOptional<z.ZodBoolean>;
308
+ irreversible_action_classes: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
309
+ }, "strict", z.ZodTypeAny, {
310
+ approval_required?: boolean | undefined;
311
+ pre_approved?: boolean | undefined;
312
+ irreversible_action_classes?: string[] | undefined;
313
+ }, {
314
+ approval_required?: boolean | undefined;
315
+ pre_approved?: boolean | undefined;
316
+ irreversible_action_classes?: string[] | undefined;
317
+ }>>;
318
+ L2: z.ZodOptional<z.ZodObject<{
319
+ approval_required: z.ZodOptional<z.ZodBoolean>;
320
+ pre_approved: z.ZodOptional<z.ZodBoolean>;
321
+ irreversible_action_classes: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
322
+ }, "strict", z.ZodTypeAny, {
323
+ approval_required?: boolean | undefined;
324
+ pre_approved?: boolean | undefined;
325
+ irreversible_action_classes?: string[] | undefined;
326
+ }, {
327
+ approval_required?: boolean | undefined;
328
+ pre_approved?: boolean | undefined;
329
+ irreversible_action_classes?: string[] | undefined;
330
+ }>>;
331
+ L3: z.ZodOptional<z.ZodObject<{
332
+ approval_required: z.ZodOptional<z.ZodBoolean>;
333
+ pre_approved: z.ZodOptional<z.ZodBoolean>;
334
+ irreversible_action_classes: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
335
+ }, "strict", z.ZodTypeAny, {
336
+ approval_required?: boolean | undefined;
337
+ pre_approved?: boolean | undefined;
338
+ irreversible_action_classes?: string[] | undefined;
339
+ }, {
340
+ approval_required?: boolean | undefined;
341
+ pre_approved?: boolean | undefined;
342
+ irreversible_action_classes?: string[] | undefined;
343
+ }>>;
344
+ L4: z.ZodOptional<z.ZodObject<{
345
+ approval_required: z.ZodOptional<z.ZodBoolean>;
346
+ pre_approved: z.ZodOptional<z.ZodBoolean>;
347
+ irreversible_action_classes: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
348
+ }, "strict", z.ZodTypeAny, {
349
+ approval_required?: boolean | undefined;
350
+ pre_approved?: boolean | undefined;
351
+ irreversible_action_classes?: string[] | undefined;
352
+ }, {
353
+ approval_required?: boolean | undefined;
354
+ pre_approved?: boolean | undefined;
355
+ irreversible_action_classes?: string[] | undefined;
356
+ }>>;
357
+ }, "strict", z.ZodTypeAny, {
358
+ L1?: {
359
+ approval_required?: boolean | undefined;
360
+ pre_approved?: boolean | undefined;
361
+ irreversible_action_classes?: string[] | undefined;
362
+ } | undefined;
363
+ L2?: {
364
+ approval_required?: boolean | undefined;
365
+ pre_approved?: boolean | undefined;
366
+ irreversible_action_classes?: string[] | undefined;
367
+ } | undefined;
368
+ L3?: {
369
+ approval_required?: boolean | undefined;
370
+ pre_approved?: boolean | undefined;
371
+ irreversible_action_classes?: string[] | undefined;
372
+ } | undefined;
373
+ L4?: {
374
+ approval_required?: boolean | undefined;
375
+ pre_approved?: boolean | undefined;
376
+ irreversible_action_classes?: string[] | undefined;
377
+ } | undefined;
378
+ }, {
379
+ L1?: {
380
+ approval_required?: boolean | undefined;
381
+ pre_approved?: boolean | undefined;
382
+ irreversible_action_classes?: string[] | undefined;
383
+ } | undefined;
384
+ L2?: {
385
+ approval_required?: boolean | undefined;
386
+ pre_approved?: boolean | undefined;
387
+ irreversible_action_classes?: string[] | undefined;
388
+ } | undefined;
389
+ L3?: {
390
+ approval_required?: boolean | undefined;
391
+ pre_approved?: boolean | undefined;
392
+ irreversible_action_classes?: string[] | undefined;
393
+ } | undefined;
394
+ L4?: {
395
+ approval_required?: boolean | undefined;
396
+ pre_approved?: boolean | undefined;
397
+ irreversible_action_classes?: string[] | undefined;
398
+ } | undefined;
399
+ }>>;
400
+ /** APTS-HO-014 — regulatory class triggers for finding-text escalation. */
401
+ compliance_triggers: z.ZodOptional<z.ZodObject<{
402
+ regulatory_class: z.ZodArray<z.ZodString, "many">;
403
+ on_match: z.ZodDefault<z.ZodEnum<["halt", "notify"]>>;
404
+ }, "strict", z.ZodTypeAny, {
405
+ regulatory_class: string[];
406
+ on_match: "halt" | "notify";
407
+ }, {
408
+ regulatory_class: string[];
409
+ on_match?: "halt" | "notify" | undefined;
410
+ }>>;
411
+ /** APTS-HO-011/012/013 — escalation thresholds for severity / CIA vector / confidence. */
412
+ escalation: z.ZodOptional<z.ZodObject<{
413
+ /** APTS-HO-011 — severity at which an unexpected-finding halt fires. */
414
+ severity_threshold: z.ZodOptional<z.ZodEnum<["info", "low", "medium", "high", "critical", "blocker"]>>;
415
+ /** APTS-HO-012 — CIA-axis halt thresholds. */
416
+ cia_threshold: z.ZodOptional<z.ZodObject<{
417
+ c: z.ZodOptional<z.ZodEnum<["none", "low", "medium", "high"]>>;
418
+ i: z.ZodOptional<z.ZodEnum<["none", "low", "medium", "high"]>>;
419
+ a: z.ZodOptional<z.ZodEnum<["none", "low", "medium", "high"]>>;
420
+ }, "strict", z.ZodTypeAny, {
421
+ c?: "high" | "medium" | "low" | "none" | undefined;
422
+ i?: "high" | "medium" | "low" | "none" | undefined;
423
+ a?: "high" | "medium" | "low" | "none" | undefined;
424
+ }, {
425
+ c?: "high" | "medium" | "low" | "none" | undefined;
426
+ i?: "high" | "medium" | "low" | "none" | undefined;
427
+ a?: "high" | "medium" | "low" | "none" | undefined;
428
+ }>>;
429
+ /** APTS-HO-013 — when true, low-confidence findings halt-pause the engagement. */
430
+ pause_on_low_confidence: z.ZodOptional<z.ZodBoolean>;
431
+ }, "strict", z.ZodTypeAny, {
432
+ severity_threshold?: "blocker" | "critical" | "high" | "medium" | "low" | "info" | undefined;
433
+ cia_threshold?: {
434
+ c?: "high" | "medium" | "low" | "none" | undefined;
435
+ i?: "high" | "medium" | "low" | "none" | undefined;
436
+ a?: "high" | "medium" | "low" | "none" | undefined;
437
+ } | undefined;
438
+ pause_on_low_confidence?: boolean | undefined;
439
+ }, {
440
+ severity_threshold?: "blocker" | "critical" | "high" | "medium" | "low" | "info" | undefined;
441
+ cia_threshold?: {
442
+ c?: "high" | "medium" | "low" | "none" | undefined;
443
+ i?: "high" | "medium" | "low" | "none" | undefined;
444
+ a?: "high" | "medium" | "low" | "none" | undefined;
445
+ } | undefined;
446
+ pause_on_low_confidence?: boolean | undefined;
447
+ }>>;
448
+ }, "strict", z.ZodTypeAny, {
449
+ roe_id: string;
450
+ spec_version: "0.1.0";
451
+ operator: {
452
+ organization: string;
453
+ authorized_by: string;
454
+ contact: string;
455
+ };
456
+ authorization: {
457
+ statement: string;
458
+ signature_method: "operator-attested" | "external-signed";
459
+ authority_url?: string | undefined;
460
+ delegation_matrix?: {
461
+ role: string;
462
+ can_approve: string[];
463
+ }[] | undefined;
464
+ };
465
+ in_scope: {
466
+ domains: {
467
+ pattern: string;
468
+ includeSubdomains: boolean;
469
+ }[];
470
+ ip_ranges: string[];
471
+ repository_paths: string[];
472
+ };
473
+ out_of_scope: {
474
+ domains: string[];
475
+ ip_ranges: string[];
476
+ paths: string[];
477
+ };
478
+ asset_criticality: {
479
+ pattern: string;
480
+ classification: "critical" | "high" | "medium" | "low";
481
+ notes?: string | undefined;
482
+ }[];
483
+ temporal: {
484
+ start: string;
485
+ end: string;
486
+ timezone: string;
487
+ blackout_windows: {
488
+ reason: string;
489
+ start: string;
490
+ end: string;
491
+ }[];
492
+ };
493
+ stop_conditions: {
494
+ on_critical_finding: "halt" | "notify-and-continue" | "continue";
495
+ max_findings?: number | undefined;
496
+ max_duration_minutes?: number | undefined;
497
+ phase_timeout_minutes?: number | undefined;
498
+ on_target_unreachable_seconds?: number | undefined;
499
+ };
500
+ sandboxing: {
501
+ mode: "none" | "docker" | "firejail";
502
+ docker_network?: string | undefined;
503
+ image_overrides?: Record<string, string> | undefined;
504
+ extra_docker_args?: string[] | undefined;
505
+ };
506
+ notifications?: {
507
+ channels: {
508
+ type: "webhook" | "log";
509
+ events: ("start" | "halt" | "critical-finding" | "completion")[];
510
+ url?: string | undefined;
511
+ }[];
512
+ } | undefined;
513
+ references?: {
514
+ incident_response_plan?: string | undefined;
515
+ contract_id?: string | undefined;
516
+ apts_conformance_claim?: string | undefined;
517
+ } | undefined;
518
+ safety_controls?: {
519
+ health_thresholds?: {
520
+ max_heap_mb?: number | undefined;
521
+ max_error_rate?: number | undefined;
522
+ max_target_response_ms?: number | undefined;
523
+ } | undefined;
524
+ heartbeat_url?: string | undefined;
525
+ heartbeat_interval_seconds?: number | undefined;
526
+ } | undefined;
527
+ autonomy_levels?: {
528
+ L1?: {
529
+ approval_required?: boolean | undefined;
530
+ pre_approved?: boolean | undefined;
531
+ irreversible_action_classes?: string[] | undefined;
532
+ } | undefined;
533
+ L2?: {
534
+ approval_required?: boolean | undefined;
535
+ pre_approved?: boolean | undefined;
536
+ irreversible_action_classes?: string[] | undefined;
537
+ } | undefined;
538
+ L3?: {
539
+ approval_required?: boolean | undefined;
540
+ pre_approved?: boolean | undefined;
541
+ irreversible_action_classes?: string[] | undefined;
542
+ } | undefined;
543
+ L4?: {
544
+ approval_required?: boolean | undefined;
545
+ pre_approved?: boolean | undefined;
546
+ irreversible_action_classes?: string[] | undefined;
547
+ } | undefined;
548
+ } | undefined;
549
+ compliance_triggers?: {
550
+ regulatory_class: string[];
551
+ on_match: "halt" | "notify";
552
+ } | undefined;
553
+ escalation?: {
554
+ severity_threshold?: "blocker" | "critical" | "high" | "medium" | "low" | "info" | undefined;
555
+ cia_threshold?: {
556
+ c?: "high" | "medium" | "low" | "none" | undefined;
557
+ i?: "high" | "medium" | "low" | "none" | undefined;
558
+ a?: "high" | "medium" | "low" | "none" | undefined;
559
+ } | undefined;
560
+ pause_on_low_confidence?: boolean | undefined;
561
+ } | undefined;
562
+ }, {
563
+ roe_id: string;
564
+ spec_version: "0.1.0";
565
+ operator: {
566
+ organization: string;
567
+ authorized_by: string;
568
+ contact: string;
569
+ };
570
+ authorization: {
571
+ statement: string;
572
+ authority_url?: string | undefined;
573
+ signature_method?: "operator-attested" | "external-signed" | undefined;
574
+ delegation_matrix?: {
575
+ role: string;
576
+ can_approve: string[];
577
+ }[] | undefined;
578
+ };
579
+ in_scope: {
580
+ domains?: {
581
+ pattern: string;
582
+ includeSubdomains?: boolean | undefined;
583
+ }[] | undefined;
584
+ ip_ranges?: string[] | undefined;
585
+ repository_paths?: string[] | undefined;
586
+ };
587
+ temporal: {
588
+ start: string;
589
+ end: string;
590
+ timezone: string;
591
+ blackout_windows?: {
592
+ reason: string;
593
+ start: string;
594
+ end: string;
595
+ }[] | undefined;
596
+ };
597
+ out_of_scope?: {
598
+ domains?: string[] | undefined;
599
+ ip_ranges?: string[] | undefined;
600
+ paths?: string[] | undefined;
601
+ } | undefined;
602
+ asset_criticality?: {
603
+ pattern: string;
604
+ classification: "critical" | "high" | "medium" | "low";
605
+ notes?: string | undefined;
606
+ }[] | undefined;
607
+ stop_conditions?: {
608
+ on_critical_finding?: "halt" | "notify-and-continue" | "continue" | undefined;
609
+ max_findings?: number | undefined;
610
+ max_duration_minutes?: number | undefined;
611
+ phase_timeout_minutes?: number | undefined;
612
+ on_target_unreachable_seconds?: number | undefined;
613
+ } | undefined;
614
+ notifications?: {
615
+ channels?: {
616
+ type: "webhook" | "log";
617
+ events: ("start" | "halt" | "critical-finding" | "completion")[];
618
+ url?: string | undefined;
619
+ }[] | undefined;
620
+ } | undefined;
621
+ references?: {
622
+ incident_response_plan?: string | undefined;
623
+ contract_id?: string | undefined;
624
+ apts_conformance_claim?: string | undefined;
625
+ } | undefined;
626
+ sandboxing?: {
627
+ mode?: "none" | "docker" | "firejail" | undefined;
628
+ docker_network?: string | undefined;
629
+ image_overrides?: Record<string, string> | undefined;
630
+ extra_docker_args?: string[] | undefined;
631
+ } | undefined;
632
+ safety_controls?: {
633
+ health_thresholds?: {
634
+ max_heap_mb?: number | undefined;
635
+ max_error_rate?: number | undefined;
636
+ max_target_response_ms?: number | undefined;
637
+ } | undefined;
638
+ heartbeat_url?: string | undefined;
639
+ heartbeat_interval_seconds?: number | undefined;
640
+ } | undefined;
641
+ autonomy_levels?: {
642
+ L1?: {
643
+ approval_required?: boolean | undefined;
644
+ pre_approved?: boolean | undefined;
645
+ irreversible_action_classes?: string[] | undefined;
646
+ } | undefined;
647
+ L2?: {
648
+ approval_required?: boolean | undefined;
649
+ pre_approved?: boolean | undefined;
650
+ irreversible_action_classes?: string[] | undefined;
651
+ } | undefined;
652
+ L3?: {
653
+ approval_required?: boolean | undefined;
654
+ pre_approved?: boolean | undefined;
655
+ irreversible_action_classes?: string[] | undefined;
656
+ } | undefined;
657
+ L4?: {
658
+ approval_required?: boolean | undefined;
659
+ pre_approved?: boolean | undefined;
660
+ irreversible_action_classes?: string[] | undefined;
661
+ } | undefined;
662
+ } | undefined;
663
+ compliance_triggers?: {
664
+ regulatory_class: string[];
665
+ on_match?: "halt" | "notify" | undefined;
666
+ } | undefined;
667
+ escalation?: {
668
+ severity_threshold?: "blocker" | "critical" | "high" | "medium" | "low" | "info" | undefined;
669
+ cia_threshold?: {
670
+ c?: "high" | "medium" | "low" | "none" | undefined;
671
+ i?: "high" | "medium" | "low" | "none" | undefined;
672
+ a?: "high" | "medium" | "low" | "none" | undefined;
673
+ } | undefined;
674
+ pause_on_low_confidence?: boolean | undefined;
675
+ } | undefined;
676
+ }>;
677
+ export type RoE = z.infer<typeof RoESchema>;
678
+ export interface ValidationDecision {
679
+ allowed: boolean;
680
+ reason: string;
681
+ /** APTS requirement IDs satisfied or violated by this decision (for audit). */
682
+ apts_refs?: string[];
683
+ }
684
+ /**
685
+ * Validate that a target (URL, hostname, or IP) is in scope and not in the
686
+ * out_of_scope deny list. Closes APTS-SE-003 + APTS-SE-006 + APTS-AL-006.
687
+ */
688
+ export declare function validateTargetInScope(target: string, roe: RoE): ValidationDecision;
689
+ /**
690
+ * Validate the current time is within the temporal envelope and not in a
691
+ * blackout window. Closes APTS-SE-004 + APTS-SE-008.
692
+ */
693
+ export declare function validateTemporalEnvelope(roe: RoE, now?: Date): ValidationDecision;
694
+ /**
695
+ * Classify a target's asset criticality per APTS-SE-005. Returns
696
+ * `'unspecified'` if no asset_criticality entry matches.
697
+ */
698
+ export declare function getAssetCriticality(target: string, roe: RoE): 'critical' | 'high' | 'medium' | 'low' | 'unspecified';
699
+ /**
700
+ * Composite pre-action validator. Combines scope + temporal + per-action
701
+ * stop-condition checks. Returns an explicit allow/deny with the
702
+ * complete reason chain. Closes APTS-SE-006.
703
+ */
704
+ export declare function validateAction(target: string, action: string, roe: RoE, now?: Date): ValidationDecision;
705
+ /**
706
+ * Synthesize a minimal RoE from a `--target` flag for back-compat with the
707
+ * pre-RoE `aegis siege --target URL --confirm` interface. Operator should
708
+ * graduate to a real RoE file for any non-trivial engagement; this helper
709
+ * exists so existing scripts continue to function. Marks the synthesized
710
+ * RoE as such so audit logs can flag the difference.
711
+ *
712
+ * Defaults are CONSERVATIVE-strict, not permissive-back-compat:
713
+ * - `safety_controls.health_thresholds` non-trivial so SC-010 health
714
+ * check actually trips on a runaway engagement.
715
+ * - `autonomy_levels.L3.approval_required: true` — exploitation halts
716
+ * unless the operator provides a real RoE that explicitly
717
+ * pre-approves L3. This is a back-compat BREAK from earlier
718
+ * versions where --confirm authorized everything; the rationale is
719
+ * that synthesized minimal RoE should never silently authorize
720
+ * exploitation phase. Operators who need exploitation must author
721
+ * a full RoE.
722
+ * - `escalation.severity_threshold: 'critical'` — matches the
723
+ * `stop_conditions.on_critical_finding: 'halt'` policy on the
724
+ * finding-text path (HO-011).
725
+ * - `escalation.cia_threshold: { c:'high', i:'high', a:'high' }` —
726
+ * CIA-axis halt on any high-impact finding (HO-012).
727
+ * - `pause_on_low_confidence: false` — operator opt-in for HO-013
728
+ * to avoid noisy halts during normal scans.
729
+ *
730
+ * The previous permissive defaults were flagged by an internal audit
731
+ * as "mechanism-MET but inert in default mode". Closing that gap
732
+ * required this BC break.
733
+ */
734
+ export declare function synthesizeMinimalRoE(target: string, options?: {
735
+ organization?: string;
736
+ durationMinutes?: number;
737
+ }): RoE;
738
+ //# sourceMappingURL=types.d.ts.map