@vulcn/engine 0.3.0 → 0.3.1
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/CHANGELOG.md +36 -0
- package/dist/index.cjs +86 -797
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +38 -585
- package/dist/index.d.ts +38 -585
- package/dist/index.js +83 -783
- package/dist/index.js.map +1 -1
- package/package.json +38 -33
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { Page, Dialog, ConsoleMessage, Request, Response, Browser } from 'playwright';
|
|
3
2
|
|
|
4
3
|
/**
|
|
5
4
|
* Payload Types for Vulcn
|
|
@@ -48,20 +47,6 @@ interface CustomPayloadFile {
|
|
|
48
47
|
payloads: CustomPayload[];
|
|
49
48
|
}
|
|
50
49
|
|
|
51
|
-
type BrowserType = "chromium" | "firefox" | "webkit";
|
|
52
|
-
interface RecorderOptions {
|
|
53
|
-
browser?: BrowserType;
|
|
54
|
-
viewport?: {
|
|
55
|
-
width: number;
|
|
56
|
-
height: number;
|
|
57
|
-
};
|
|
58
|
-
headless?: boolean;
|
|
59
|
-
}
|
|
60
|
-
interface RunnerOptions {
|
|
61
|
-
browser?: BrowserType;
|
|
62
|
-
headless?: boolean;
|
|
63
|
-
onFinding?: (finding: Finding) => void;
|
|
64
|
-
}
|
|
65
50
|
interface Finding {
|
|
66
51
|
type: PayloadCategory;
|
|
67
52
|
severity: "critical" | "high" | "medium" | "low" | "info";
|
|
@@ -74,433 +59,14 @@ interface Finding {
|
|
|
74
59
|
/** Plugin-specific metadata */
|
|
75
60
|
metadata?: Record<string, unknown>;
|
|
76
61
|
}
|
|
77
|
-
interface RunResult$1 {
|
|
78
|
-
findings: Finding[];
|
|
79
|
-
stepsExecuted: number;
|
|
80
|
-
payloadsTested: number;
|
|
81
|
-
duration: number;
|
|
82
|
-
errors: string[];
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
declare const StepSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
86
|
-
id: z.ZodString;
|
|
87
|
-
type: z.ZodLiteral<"navigate">;
|
|
88
|
-
url: z.ZodString;
|
|
89
|
-
timestamp: z.ZodNumber;
|
|
90
|
-
}, "strip", z.ZodTypeAny, {
|
|
91
|
-
type: "navigate";
|
|
92
|
-
id: string;
|
|
93
|
-
url: string;
|
|
94
|
-
timestamp: number;
|
|
95
|
-
}, {
|
|
96
|
-
type: "navigate";
|
|
97
|
-
id: string;
|
|
98
|
-
url: string;
|
|
99
|
-
timestamp: number;
|
|
100
|
-
}>, z.ZodObject<{
|
|
101
|
-
id: z.ZodString;
|
|
102
|
-
type: z.ZodLiteral<"click">;
|
|
103
|
-
selector: z.ZodString;
|
|
104
|
-
position: z.ZodOptional<z.ZodObject<{
|
|
105
|
-
x: z.ZodNumber;
|
|
106
|
-
y: z.ZodNumber;
|
|
107
|
-
}, "strip", z.ZodTypeAny, {
|
|
108
|
-
x: number;
|
|
109
|
-
y: number;
|
|
110
|
-
}, {
|
|
111
|
-
x: number;
|
|
112
|
-
y: number;
|
|
113
|
-
}>>;
|
|
114
|
-
timestamp: z.ZodNumber;
|
|
115
|
-
}, "strip", z.ZodTypeAny, {
|
|
116
|
-
type: "click";
|
|
117
|
-
id: string;
|
|
118
|
-
timestamp: number;
|
|
119
|
-
selector: string;
|
|
120
|
-
position?: {
|
|
121
|
-
x: number;
|
|
122
|
-
y: number;
|
|
123
|
-
} | undefined;
|
|
124
|
-
}, {
|
|
125
|
-
type: "click";
|
|
126
|
-
id: string;
|
|
127
|
-
timestamp: number;
|
|
128
|
-
selector: string;
|
|
129
|
-
position?: {
|
|
130
|
-
x: number;
|
|
131
|
-
y: number;
|
|
132
|
-
} | undefined;
|
|
133
|
-
}>, z.ZodObject<{
|
|
134
|
-
id: z.ZodString;
|
|
135
|
-
type: z.ZodLiteral<"input">;
|
|
136
|
-
selector: z.ZodString;
|
|
137
|
-
value: z.ZodString;
|
|
138
|
-
injectable: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
139
|
-
timestamp: z.ZodNumber;
|
|
140
|
-
}, "strip", z.ZodTypeAny, {
|
|
141
|
-
type: "input";
|
|
142
|
-
value: string;
|
|
143
|
-
id: string;
|
|
144
|
-
timestamp: number;
|
|
145
|
-
selector: string;
|
|
146
|
-
injectable: boolean;
|
|
147
|
-
}, {
|
|
148
|
-
type: "input";
|
|
149
|
-
value: string;
|
|
150
|
-
id: string;
|
|
151
|
-
timestamp: number;
|
|
152
|
-
selector: string;
|
|
153
|
-
injectable?: boolean | undefined;
|
|
154
|
-
}>, z.ZodObject<{
|
|
155
|
-
id: z.ZodString;
|
|
156
|
-
type: z.ZodLiteral<"keypress">;
|
|
157
|
-
key: z.ZodString;
|
|
158
|
-
modifiers: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
159
|
-
timestamp: z.ZodNumber;
|
|
160
|
-
}, "strip", z.ZodTypeAny, {
|
|
161
|
-
type: "keypress";
|
|
162
|
-
id: string;
|
|
163
|
-
timestamp: number;
|
|
164
|
-
key: string;
|
|
165
|
-
modifiers?: string[] | undefined;
|
|
166
|
-
}, {
|
|
167
|
-
type: "keypress";
|
|
168
|
-
id: string;
|
|
169
|
-
timestamp: number;
|
|
170
|
-
key: string;
|
|
171
|
-
modifiers?: string[] | undefined;
|
|
172
|
-
}>, z.ZodObject<{
|
|
173
|
-
id: z.ZodString;
|
|
174
|
-
type: z.ZodLiteral<"scroll">;
|
|
175
|
-
selector: z.ZodOptional<z.ZodString>;
|
|
176
|
-
position: z.ZodObject<{
|
|
177
|
-
x: z.ZodNumber;
|
|
178
|
-
y: z.ZodNumber;
|
|
179
|
-
}, "strip", z.ZodTypeAny, {
|
|
180
|
-
x: number;
|
|
181
|
-
y: number;
|
|
182
|
-
}, {
|
|
183
|
-
x: number;
|
|
184
|
-
y: number;
|
|
185
|
-
}>;
|
|
186
|
-
timestamp: z.ZodNumber;
|
|
187
|
-
}, "strip", z.ZodTypeAny, {
|
|
188
|
-
type: "scroll";
|
|
189
|
-
id: string;
|
|
190
|
-
timestamp: number;
|
|
191
|
-
position: {
|
|
192
|
-
x: number;
|
|
193
|
-
y: number;
|
|
194
|
-
};
|
|
195
|
-
selector?: string | undefined;
|
|
196
|
-
}, {
|
|
197
|
-
type: "scroll";
|
|
198
|
-
id: string;
|
|
199
|
-
timestamp: number;
|
|
200
|
-
position: {
|
|
201
|
-
x: number;
|
|
202
|
-
y: number;
|
|
203
|
-
};
|
|
204
|
-
selector?: string | undefined;
|
|
205
|
-
}>, z.ZodObject<{
|
|
206
|
-
id: z.ZodString;
|
|
207
|
-
type: z.ZodLiteral<"wait">;
|
|
208
|
-
duration: z.ZodNumber;
|
|
209
|
-
timestamp: z.ZodNumber;
|
|
210
|
-
}, "strip", z.ZodTypeAny, {
|
|
211
|
-
type: "wait";
|
|
212
|
-
id: string;
|
|
213
|
-
timestamp: number;
|
|
214
|
-
duration: number;
|
|
215
|
-
}, {
|
|
216
|
-
type: "wait";
|
|
217
|
-
id: string;
|
|
218
|
-
timestamp: number;
|
|
219
|
-
duration: number;
|
|
220
|
-
}>]>;
|
|
221
|
-
type Step$1 = z.infer<typeof StepSchema>;
|
|
222
|
-
declare const SessionSchema: z.ZodObject<{
|
|
223
|
-
version: z.ZodDefault<z.ZodString>;
|
|
224
|
-
name: z.ZodString;
|
|
225
|
-
recordedAt: z.ZodString;
|
|
226
|
-
browser: z.ZodDefault<z.ZodEnum<["chromium", "firefox", "webkit"]>>;
|
|
227
|
-
viewport: z.ZodObject<{
|
|
228
|
-
width: z.ZodNumber;
|
|
229
|
-
height: z.ZodNumber;
|
|
230
|
-
}, "strip", z.ZodTypeAny, {
|
|
231
|
-
width: number;
|
|
232
|
-
height: number;
|
|
233
|
-
}, {
|
|
234
|
-
width: number;
|
|
235
|
-
height: number;
|
|
236
|
-
}>;
|
|
237
|
-
startUrl: z.ZodString;
|
|
238
|
-
steps: z.ZodArray<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
239
|
-
id: z.ZodString;
|
|
240
|
-
type: z.ZodLiteral<"navigate">;
|
|
241
|
-
url: z.ZodString;
|
|
242
|
-
timestamp: z.ZodNumber;
|
|
243
|
-
}, "strip", z.ZodTypeAny, {
|
|
244
|
-
type: "navigate";
|
|
245
|
-
id: string;
|
|
246
|
-
url: string;
|
|
247
|
-
timestamp: number;
|
|
248
|
-
}, {
|
|
249
|
-
type: "navigate";
|
|
250
|
-
id: string;
|
|
251
|
-
url: string;
|
|
252
|
-
timestamp: number;
|
|
253
|
-
}>, z.ZodObject<{
|
|
254
|
-
id: z.ZodString;
|
|
255
|
-
type: z.ZodLiteral<"click">;
|
|
256
|
-
selector: z.ZodString;
|
|
257
|
-
position: z.ZodOptional<z.ZodObject<{
|
|
258
|
-
x: z.ZodNumber;
|
|
259
|
-
y: z.ZodNumber;
|
|
260
|
-
}, "strip", z.ZodTypeAny, {
|
|
261
|
-
x: number;
|
|
262
|
-
y: number;
|
|
263
|
-
}, {
|
|
264
|
-
x: number;
|
|
265
|
-
y: number;
|
|
266
|
-
}>>;
|
|
267
|
-
timestamp: z.ZodNumber;
|
|
268
|
-
}, "strip", z.ZodTypeAny, {
|
|
269
|
-
type: "click";
|
|
270
|
-
id: string;
|
|
271
|
-
timestamp: number;
|
|
272
|
-
selector: string;
|
|
273
|
-
position?: {
|
|
274
|
-
x: number;
|
|
275
|
-
y: number;
|
|
276
|
-
} | undefined;
|
|
277
|
-
}, {
|
|
278
|
-
type: "click";
|
|
279
|
-
id: string;
|
|
280
|
-
timestamp: number;
|
|
281
|
-
selector: string;
|
|
282
|
-
position?: {
|
|
283
|
-
x: number;
|
|
284
|
-
y: number;
|
|
285
|
-
} | undefined;
|
|
286
|
-
}>, z.ZodObject<{
|
|
287
|
-
id: z.ZodString;
|
|
288
|
-
type: z.ZodLiteral<"input">;
|
|
289
|
-
selector: z.ZodString;
|
|
290
|
-
value: z.ZodString;
|
|
291
|
-
injectable: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
292
|
-
timestamp: z.ZodNumber;
|
|
293
|
-
}, "strip", z.ZodTypeAny, {
|
|
294
|
-
type: "input";
|
|
295
|
-
value: string;
|
|
296
|
-
id: string;
|
|
297
|
-
timestamp: number;
|
|
298
|
-
selector: string;
|
|
299
|
-
injectable: boolean;
|
|
300
|
-
}, {
|
|
301
|
-
type: "input";
|
|
302
|
-
value: string;
|
|
303
|
-
id: string;
|
|
304
|
-
timestamp: number;
|
|
305
|
-
selector: string;
|
|
306
|
-
injectable?: boolean | undefined;
|
|
307
|
-
}>, z.ZodObject<{
|
|
308
|
-
id: z.ZodString;
|
|
309
|
-
type: z.ZodLiteral<"keypress">;
|
|
310
|
-
key: z.ZodString;
|
|
311
|
-
modifiers: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
312
|
-
timestamp: z.ZodNumber;
|
|
313
|
-
}, "strip", z.ZodTypeAny, {
|
|
314
|
-
type: "keypress";
|
|
315
|
-
id: string;
|
|
316
|
-
timestamp: number;
|
|
317
|
-
key: string;
|
|
318
|
-
modifiers?: string[] | undefined;
|
|
319
|
-
}, {
|
|
320
|
-
type: "keypress";
|
|
321
|
-
id: string;
|
|
322
|
-
timestamp: number;
|
|
323
|
-
key: string;
|
|
324
|
-
modifiers?: string[] | undefined;
|
|
325
|
-
}>, z.ZodObject<{
|
|
326
|
-
id: z.ZodString;
|
|
327
|
-
type: z.ZodLiteral<"scroll">;
|
|
328
|
-
selector: z.ZodOptional<z.ZodString>;
|
|
329
|
-
position: z.ZodObject<{
|
|
330
|
-
x: z.ZodNumber;
|
|
331
|
-
y: z.ZodNumber;
|
|
332
|
-
}, "strip", z.ZodTypeAny, {
|
|
333
|
-
x: number;
|
|
334
|
-
y: number;
|
|
335
|
-
}, {
|
|
336
|
-
x: number;
|
|
337
|
-
y: number;
|
|
338
|
-
}>;
|
|
339
|
-
timestamp: z.ZodNumber;
|
|
340
|
-
}, "strip", z.ZodTypeAny, {
|
|
341
|
-
type: "scroll";
|
|
342
|
-
id: string;
|
|
343
|
-
timestamp: number;
|
|
344
|
-
position: {
|
|
345
|
-
x: number;
|
|
346
|
-
y: number;
|
|
347
|
-
};
|
|
348
|
-
selector?: string | undefined;
|
|
349
|
-
}, {
|
|
350
|
-
type: "scroll";
|
|
351
|
-
id: string;
|
|
352
|
-
timestamp: number;
|
|
353
|
-
position: {
|
|
354
|
-
x: number;
|
|
355
|
-
y: number;
|
|
356
|
-
};
|
|
357
|
-
selector?: string | undefined;
|
|
358
|
-
}>, z.ZodObject<{
|
|
359
|
-
id: z.ZodString;
|
|
360
|
-
type: z.ZodLiteral<"wait">;
|
|
361
|
-
duration: z.ZodNumber;
|
|
362
|
-
timestamp: z.ZodNumber;
|
|
363
|
-
}, "strip", z.ZodTypeAny, {
|
|
364
|
-
type: "wait";
|
|
365
|
-
id: string;
|
|
366
|
-
timestamp: number;
|
|
367
|
-
duration: number;
|
|
368
|
-
}, {
|
|
369
|
-
type: "wait";
|
|
370
|
-
id: string;
|
|
371
|
-
timestamp: number;
|
|
372
|
-
duration: number;
|
|
373
|
-
}>]>, "many">;
|
|
374
|
-
}, "strip", z.ZodTypeAny, {
|
|
375
|
-
version: string;
|
|
376
|
-
name: string;
|
|
377
|
-
recordedAt: string;
|
|
378
|
-
browser: "chromium" | "firefox" | "webkit";
|
|
379
|
-
viewport: {
|
|
380
|
-
width: number;
|
|
381
|
-
height: number;
|
|
382
|
-
};
|
|
383
|
-
startUrl: string;
|
|
384
|
-
steps: ({
|
|
385
|
-
type: "navigate";
|
|
386
|
-
id: string;
|
|
387
|
-
url: string;
|
|
388
|
-
timestamp: number;
|
|
389
|
-
} | {
|
|
390
|
-
type: "click";
|
|
391
|
-
id: string;
|
|
392
|
-
timestamp: number;
|
|
393
|
-
selector: string;
|
|
394
|
-
position?: {
|
|
395
|
-
x: number;
|
|
396
|
-
y: number;
|
|
397
|
-
} | undefined;
|
|
398
|
-
} | {
|
|
399
|
-
type: "input";
|
|
400
|
-
value: string;
|
|
401
|
-
id: string;
|
|
402
|
-
timestamp: number;
|
|
403
|
-
selector: string;
|
|
404
|
-
injectable: boolean;
|
|
405
|
-
} | {
|
|
406
|
-
type: "keypress";
|
|
407
|
-
id: string;
|
|
408
|
-
timestamp: number;
|
|
409
|
-
key: string;
|
|
410
|
-
modifiers?: string[] | undefined;
|
|
411
|
-
} | {
|
|
412
|
-
type: "scroll";
|
|
413
|
-
id: string;
|
|
414
|
-
timestamp: number;
|
|
415
|
-
position: {
|
|
416
|
-
x: number;
|
|
417
|
-
y: number;
|
|
418
|
-
};
|
|
419
|
-
selector?: string | undefined;
|
|
420
|
-
} | {
|
|
421
|
-
type: "wait";
|
|
422
|
-
id: string;
|
|
423
|
-
timestamp: number;
|
|
424
|
-
duration: number;
|
|
425
|
-
})[];
|
|
426
|
-
}, {
|
|
427
|
-
name: string;
|
|
428
|
-
recordedAt: string;
|
|
429
|
-
viewport: {
|
|
430
|
-
width: number;
|
|
431
|
-
height: number;
|
|
432
|
-
};
|
|
433
|
-
startUrl: string;
|
|
434
|
-
steps: ({
|
|
435
|
-
type: "navigate";
|
|
436
|
-
id: string;
|
|
437
|
-
url: string;
|
|
438
|
-
timestamp: number;
|
|
439
|
-
} | {
|
|
440
|
-
type: "click";
|
|
441
|
-
id: string;
|
|
442
|
-
timestamp: number;
|
|
443
|
-
selector: string;
|
|
444
|
-
position?: {
|
|
445
|
-
x: number;
|
|
446
|
-
y: number;
|
|
447
|
-
} | undefined;
|
|
448
|
-
} | {
|
|
449
|
-
type: "input";
|
|
450
|
-
value: string;
|
|
451
|
-
id: string;
|
|
452
|
-
timestamp: number;
|
|
453
|
-
selector: string;
|
|
454
|
-
injectable?: boolean | undefined;
|
|
455
|
-
} | {
|
|
456
|
-
type: "keypress";
|
|
457
|
-
id: string;
|
|
458
|
-
timestamp: number;
|
|
459
|
-
key: string;
|
|
460
|
-
modifiers?: string[] | undefined;
|
|
461
|
-
} | {
|
|
462
|
-
type: "scroll";
|
|
463
|
-
id: string;
|
|
464
|
-
timestamp: number;
|
|
465
|
-
position: {
|
|
466
|
-
x: number;
|
|
467
|
-
y: number;
|
|
468
|
-
};
|
|
469
|
-
selector?: string | undefined;
|
|
470
|
-
} | {
|
|
471
|
-
type: "wait";
|
|
472
|
-
id: string;
|
|
473
|
-
timestamp: number;
|
|
474
|
-
duration: number;
|
|
475
|
-
})[];
|
|
476
|
-
version?: string | undefined;
|
|
477
|
-
browser?: "chromium" | "firefox" | "webkit" | undefined;
|
|
478
|
-
}>;
|
|
479
|
-
type Session$1 = z.infer<typeof SessionSchema>;
|
|
480
|
-
/**
|
|
481
|
-
* Create a new session object
|
|
482
|
-
*/
|
|
483
|
-
declare function createSession(options: {
|
|
484
|
-
name: string;
|
|
485
|
-
startUrl: string;
|
|
486
|
-
browser?: "chromium" | "firefox" | "webkit";
|
|
487
|
-
viewport?: {
|
|
488
|
-
width: number;
|
|
489
|
-
height: number;
|
|
490
|
-
};
|
|
491
|
-
}): Session$1;
|
|
492
|
-
/**
|
|
493
|
-
* Parse a session from YAML string
|
|
494
|
-
*/
|
|
495
|
-
declare function parseSession(yaml: string): Session$1;
|
|
496
|
-
/**
|
|
497
|
-
* Serialize a session to YAML string
|
|
498
|
-
*/
|
|
499
|
-
declare function serializeSession(session: Session$1): string;
|
|
500
62
|
|
|
501
63
|
/**
|
|
502
64
|
* Vulcn Plugin System Types
|
|
503
65
|
* @module @vulcn/engine/plugin
|
|
66
|
+
*
|
|
67
|
+
* The plugin system is driver-agnostic. Detection plugins receive
|
|
68
|
+
* a generic page interface rather than Playwright types directly.
|
|
69
|
+
* This allows the same plugin to work across different driver types.
|
|
504
70
|
*/
|
|
505
71
|
|
|
506
72
|
/**
|
|
@@ -537,6 +103,10 @@ interface VulcnPlugin {
|
|
|
537
103
|
}
|
|
538
104
|
/**
|
|
539
105
|
* Plugin lifecycle hooks
|
|
106
|
+
*
|
|
107
|
+
* Detection hooks (onDialog, onConsoleMessage, etc.) receive
|
|
108
|
+
* Playwright types from the driver. Plugins that use these
|
|
109
|
+
* should declare playwright as a peer/dev dependency.
|
|
540
110
|
*/
|
|
541
111
|
interface PluginHooks {
|
|
542
112
|
/**
|
|
@@ -551,27 +121,27 @@ interface PluginHooks {
|
|
|
551
121
|
/** Called when recording starts */
|
|
552
122
|
onRecordStart?: (ctx: RecordContext) => Promise<void>;
|
|
553
123
|
/** Called for each recorded step, can transform */
|
|
554
|
-
onRecordStep?: (step: Step
|
|
124
|
+
onRecordStep?: (step: Step, ctx: RecordContext) => Promise<Step>;
|
|
555
125
|
/** Called when recording ends, can transform session */
|
|
556
|
-
onRecordEnd?: (session: Session
|
|
126
|
+
onRecordEnd?: (session: Session, ctx: RecordContext) => Promise<Session>;
|
|
557
127
|
/** Called when run starts */
|
|
558
128
|
onRunStart?: (ctx: RunContext$1) => Promise<void>;
|
|
559
129
|
/** Called before each payload is injected, can transform payload */
|
|
560
|
-
onBeforePayload?: (payload: string, step: Step
|
|
130
|
+
onBeforePayload?: (payload: string, step: Step, ctx: RunContext$1) => Promise<string>;
|
|
561
131
|
/** Called after payload injection, for detection */
|
|
562
132
|
onAfterPayload?: (ctx: DetectContext) => Promise<Finding[]>;
|
|
563
133
|
/** Called when run ends, can transform results */
|
|
564
|
-
onRunEnd?: (result: RunResult
|
|
565
|
-
/** Called on page load/navigation */
|
|
566
|
-
onPageLoad?: (page: Page, ctx: DetectContext) => Promise<Finding[]>;
|
|
134
|
+
onRunEnd?: (result: RunResult, ctx: RunContext$1) => Promise<RunResult>;
|
|
567
135
|
/** Called when JavaScript alert/confirm/prompt appears */
|
|
568
|
-
onDialog?: (dialog:
|
|
136
|
+
onDialog?: (dialog: unknown, ctx: DetectContext) => Promise<Finding | null>;
|
|
569
137
|
/** Called on console.log/warn/error */
|
|
570
|
-
onConsoleMessage?: (msg:
|
|
138
|
+
onConsoleMessage?: (msg: unknown, ctx: DetectContext) => Promise<Finding | null>;
|
|
139
|
+
/** Called on page load/navigation */
|
|
140
|
+
onPageLoad?: (page: unknown, ctx: DetectContext) => Promise<Finding[]>;
|
|
571
141
|
/** Called on network request */
|
|
572
|
-
onNetworkRequest?: (request:
|
|
142
|
+
onNetworkRequest?: (request: unknown, ctx: DetectContext) => Promise<Finding | null>;
|
|
573
143
|
/** Called on network response */
|
|
574
|
-
onNetworkResponse?: (response:
|
|
144
|
+
onNetworkResponse?: (response: unknown, ctx: DetectContext) => Promise<Finding | null>;
|
|
575
145
|
}
|
|
576
146
|
/**
|
|
577
147
|
* Logger interface for plugins
|
|
@@ -610,23 +180,17 @@ interface PluginContext {
|
|
|
610
180
|
* Context for recording phase hooks
|
|
611
181
|
*/
|
|
612
182
|
interface RecordContext extends PluginContext {
|
|
613
|
-
/**
|
|
614
|
-
|
|
615
|
-
/** Browser type being used */
|
|
616
|
-
browser: BrowserType;
|
|
617
|
-
/** Playwright page instance */
|
|
618
|
-
page: Page;
|
|
183
|
+
/** Page interface (driver-specific, e.g. Playwright Page) */
|
|
184
|
+
page: unknown;
|
|
619
185
|
}
|
|
620
186
|
/**
|
|
621
187
|
* Context for running phase hooks
|
|
622
188
|
*/
|
|
623
189
|
interface RunContext$1 extends PluginContext {
|
|
624
190
|
/** Session being executed */
|
|
625
|
-
session: Session
|
|
626
|
-
/** Playwright
|
|
627
|
-
page:
|
|
628
|
-
/** Browser type being used */
|
|
629
|
-
browser: BrowserType;
|
|
191
|
+
session: Session;
|
|
192
|
+
/** Page interface (driver-specific, e.g. Playwright Page) */
|
|
193
|
+
page: unknown;
|
|
630
194
|
/** Whether running headless */
|
|
631
195
|
headless: boolean;
|
|
632
196
|
}
|
|
@@ -635,7 +199,7 @@ interface RunContext$1 extends PluginContext {
|
|
|
635
199
|
*/
|
|
636
200
|
interface DetectContext extends RunContext$1 {
|
|
637
201
|
/** Current step being tested */
|
|
638
|
-
step: Step
|
|
202
|
+
step: Step;
|
|
639
203
|
/** Current payload set being tested */
|
|
640
204
|
payloadSet: RuntimePayload;
|
|
641
205
|
/** Actual payload value injected */
|
|
@@ -664,7 +228,6 @@ interface VulcnConfig {
|
|
|
664
228
|
plugins?: PluginConfig[];
|
|
665
229
|
/** Global settings */
|
|
666
230
|
settings?: {
|
|
667
|
-
browser?: BrowserType;
|
|
668
231
|
headless?: boolean;
|
|
669
232
|
timeout?: number;
|
|
670
233
|
};
|
|
@@ -1001,12 +564,25 @@ declare class DriverManager {
|
|
|
1001
564
|
* Get driver for a session
|
|
1002
565
|
*/
|
|
1003
566
|
getForSession(session: Session): VulcnDriver;
|
|
567
|
+
/**
|
|
568
|
+
* Parse a YAML session string into a Session object.
|
|
569
|
+
*
|
|
570
|
+
* Handles both new driver-format sessions and legacy v1 sessions.
|
|
571
|
+
* Legacy sessions (those with non-namespaced step types like "click",
|
|
572
|
+
* "input", "navigate") are automatically converted to the driver format
|
|
573
|
+
* (e.g., "browser.click", "browser.input", "browser.navigate").
|
|
574
|
+
*
|
|
575
|
+
* @param yaml - Raw YAML string
|
|
576
|
+
* @param defaultDriver - Driver to assign for legacy sessions (default: "browser")
|
|
577
|
+
*/
|
|
578
|
+
parseSession(yaml: string, defaultDriver?: string): Session;
|
|
1004
579
|
/**
|
|
1005
580
|
* Start recording with a driver
|
|
1006
581
|
*/
|
|
1007
582
|
startRecording(driverName: string, config: Record<string, unknown>, options?: RecordOptions): Promise<RecordingHandle>;
|
|
1008
583
|
/**
|
|
1009
584
|
* Execute a session
|
|
585
|
+
* Invokes plugin hooks (onRunStart, onRunEnd) around the driver runner.
|
|
1010
586
|
*/
|
|
1011
587
|
execute(session: Session, pluginManager: PluginManager, options?: RunOptions): Promise<RunResult>;
|
|
1012
588
|
/**
|
|
@@ -1023,127 +599,4 @@ declare class DriverManager {
|
|
|
1023
599
|
*/
|
|
1024
600
|
declare const driverManager: DriverManager;
|
|
1025
601
|
|
|
1026
|
-
|
|
1027
|
-
* Recorder - captures browser interactions as a replayable session
|
|
1028
|
-
* v0.2.0: Plugin hooks for recording customization
|
|
1029
|
-
*/
|
|
1030
|
-
|
|
1031
|
-
/**
|
|
1032
|
-
* Configuration for the recorder
|
|
1033
|
-
*/
|
|
1034
|
-
interface RecorderConfig {
|
|
1035
|
-
/** Plugin manager to use (defaults to shared instance) */
|
|
1036
|
-
pluginManager?: PluginManager;
|
|
1037
|
-
}
|
|
1038
|
-
/**
|
|
1039
|
-
* Active recording session handle
|
|
1040
|
-
*/
|
|
1041
|
-
interface RecordingSession {
|
|
1042
|
-
/** Stop recording and return the session */
|
|
1043
|
-
stop(): Promise<Session$1>;
|
|
1044
|
-
/** Get current recorded steps */
|
|
1045
|
-
getSteps(): Step$1[];
|
|
1046
|
-
/** Get the Playwright page (for advanced use) */
|
|
1047
|
-
getPage(): Page;
|
|
1048
|
-
}
|
|
1049
|
-
/**
|
|
1050
|
-
* Recorder - captures browser interactions as a replayable session
|
|
1051
|
-
*
|
|
1052
|
-
* Uses plugin hooks for:
|
|
1053
|
-
* - onRecordStart: Called when recording starts
|
|
1054
|
-
* - onRecordStep: Called for each step, can transform
|
|
1055
|
-
* - onRecordEnd: Called when recording ends, can transform session
|
|
1056
|
-
*/
|
|
1057
|
-
declare class Recorder {
|
|
1058
|
-
/**
|
|
1059
|
-
* Start a new recording session
|
|
1060
|
-
* Opens a browser window for the user to interact with
|
|
1061
|
-
*/
|
|
1062
|
-
static start(startUrl: string, options?: RecorderOptions, config?: RecorderConfig): Promise<RecordingSession>;
|
|
1063
|
-
/**
|
|
1064
|
-
* Transform a step through plugin hooks
|
|
1065
|
-
* Returns null if the step should be filtered out
|
|
1066
|
-
*/
|
|
1067
|
-
private static transformStep;
|
|
1068
|
-
private static attachListeners;
|
|
1069
|
-
private static injectRecordingScript;
|
|
1070
|
-
}
|
|
1071
|
-
|
|
1072
|
-
/**
|
|
1073
|
-
* Runner - replays sessions with security payloads
|
|
1074
|
-
* v0.2.0: Plugin-based architecture for extensibility
|
|
1075
|
-
*/
|
|
1076
|
-
|
|
1077
|
-
interface RunnerConfig {
|
|
1078
|
-
/** Plugin manager to use (defaults to shared instance) */
|
|
1079
|
-
pluginManager?: PluginManager;
|
|
1080
|
-
}
|
|
1081
|
-
/**
|
|
1082
|
-
* Runner - replays sessions with security payloads
|
|
1083
|
-
*
|
|
1084
|
-
* Uses plugin hooks for:
|
|
1085
|
-
* - Payload loading (onInit)
|
|
1086
|
-
* - Payload transformation (onBeforePayload)
|
|
1087
|
-
* - Vulnerability detection (onAfterPayload, onDialog, onConsoleMessage, etc.)
|
|
1088
|
-
* - Results processing (onRunEnd)
|
|
1089
|
-
*/
|
|
1090
|
-
declare class Runner {
|
|
1091
|
-
/**
|
|
1092
|
-
* Execute a session with security payloads from plugins
|
|
1093
|
-
*
|
|
1094
|
-
* @param session - The recorded session to replay
|
|
1095
|
-
* @param options - Runner configuration
|
|
1096
|
-
* @param config - Plugin manager configuration
|
|
1097
|
-
*/
|
|
1098
|
-
static execute(session: Session$1, options?: RunnerOptions, config?: RunnerConfig): Promise<RunResult$1>;
|
|
1099
|
-
/**
|
|
1100
|
-
* Execute with explicit payloads (legacy API, for backwards compatibility)
|
|
1101
|
-
*/
|
|
1102
|
-
static executeWithPayloads(session: Session$1, payloads: RuntimePayload[], options?: RunnerOptions): Promise<RunResult$1>;
|
|
1103
|
-
/**
|
|
1104
|
-
* Replay session steps with payload injected at target step
|
|
1105
|
-
*/
|
|
1106
|
-
private static replayWithPayload;
|
|
1107
|
-
/**
|
|
1108
|
-
* Basic reflection check - fallback when no detection plugin is loaded
|
|
1109
|
-
*/
|
|
1110
|
-
private static checkReflection;
|
|
1111
|
-
/**
|
|
1112
|
-
* Determine severity based on vulnerability category
|
|
1113
|
-
*/
|
|
1114
|
-
private static getSeverity;
|
|
1115
|
-
}
|
|
1116
|
-
|
|
1117
|
-
interface LaunchOptions {
|
|
1118
|
-
browser?: BrowserType;
|
|
1119
|
-
headless?: boolean;
|
|
1120
|
-
}
|
|
1121
|
-
interface BrowserLaunchResult {
|
|
1122
|
-
browser: Browser;
|
|
1123
|
-
channel?: string;
|
|
1124
|
-
}
|
|
1125
|
-
declare class BrowserNotFoundError extends Error {
|
|
1126
|
-
constructor(message: string);
|
|
1127
|
-
}
|
|
1128
|
-
/**
|
|
1129
|
-
* Launch a browser with smart fallback:
|
|
1130
|
-
* 1. Try system Chrome/Edge first (zero-install experience)
|
|
1131
|
-
* 2. Fall back to Playwright's bundled browsers
|
|
1132
|
-
*/
|
|
1133
|
-
declare function launchBrowser(options?: LaunchOptions): Promise<BrowserLaunchResult>;
|
|
1134
|
-
/**
|
|
1135
|
-
* Install Playwright browsers
|
|
1136
|
-
*/
|
|
1137
|
-
declare function installBrowsers(browsers?: BrowserType[]): Promise<void>;
|
|
1138
|
-
/**
|
|
1139
|
-
* Check which browsers are available
|
|
1140
|
-
*/
|
|
1141
|
-
declare function checkBrowsers(): Promise<{
|
|
1142
|
-
systemChrome: boolean;
|
|
1143
|
-
systemEdge: boolean;
|
|
1144
|
-
playwrightChromium: boolean;
|
|
1145
|
-
playwrightFirefox: boolean;
|
|
1146
|
-
playwrightWebkit: boolean;
|
|
1147
|
-
}>;
|
|
1148
|
-
|
|
1149
|
-
export { type BrowserLaunchResult, BrowserNotFoundError, type BrowserType, type CustomPayload, type CustomPayloadFile, DRIVER_API_VERSION, type DetectContext, type DriverLogger, DriverManager, type DriverSource, type EngineInfo, type Finding, type LaunchOptions, type Session$1 as LegacySession, type Step$1 as LegacyStep, type LoadedDriver, type LoadedPlugin as LoadedPluginInfo, PLUGIN_API_VERSION, type PayloadCategory, type PayloadSource, type PluginConfig, type PluginContext, type PluginHooks, type PluginLogger, PluginManager, type PluginSource, type RecordContext, type RecordOptions, Recorder, type RecorderDriver, type RecorderOptions, type RecordingHandle, type RecordingSession, type RunContext, type RunOptions, type RunResult, Runner, type RunnerDriver, type RunnerOptions, type RuntimePayload, type Session, SessionSchema, type Step, StepSchema, type VulcnConfig, type VulcnDriver, type VulcnPlugin, checkBrowsers, createSession, driverManager, installBrowsers, launchBrowser, parseSession, pluginManager, serializeSession };
|
|
602
|
+
export { type CustomPayload, type CustomPayloadFile, DRIVER_API_VERSION, type DetectContext, type DriverLogger, DriverManager, type DriverSource, type EngineInfo, type Finding, type LoadedDriver, type LoadedPlugin as LoadedPluginInfo, PLUGIN_API_VERSION, type PayloadCategory, type PayloadSource, type PluginConfig, type PluginContext, type PluginHooks, type PluginLogger, PluginManager, type RunContext$1 as PluginRunContext, type PluginSource, type RecordContext, type RecordOptions, type RecorderDriver, type RecordingHandle, type RunContext, type RunOptions, type RunResult, type RunnerDriver, type RuntimePayload, type Session, type Step, type VulcnConfig, type VulcnDriver, type VulcnPlugin, driverManager, pluginManager };
|