@reticlehq/core 2.2.1 → 2.4.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/brand.d.ts +0 -1
- package/dist/brand.js +0 -1
- package/dist/consequence.d.ts +0 -1
- package/dist/consequence.js +0 -1
- package/dist/constants.d.ts +30 -33
- package/dist/constants.js +33 -31
- package/dist/daemon-registry.d.ts +0 -1
- package/dist/daemon-registry.js +0 -1
- package/dist/desktop-contract.cjs +11 -0
- package/dist/desktop-contract.d.cts +6 -0
- package/dist/desktop-contract.d.ts +58 -0
- package/dist/desktop-contract.js +59 -0
- package/dist/event-payloads.d.ts +62 -5
- package/dist/event-payloads.js +35 -4
- package/dist/event-priority.d.ts +25 -0
- package/dist/event-priority.js +45 -0
- package/dist/findings.d.ts +124 -0
- package/dist/findings.js +122 -0
- package/dist/flow-constants.d.ts +0 -1
- package/dist/flow-constants.js +0 -1
- package/dist/flow-types.d.ts +26 -2
- package/dist/flow-types.js +0 -1
- package/dist/index.d.ts +8 -1
- package/dist/index.js +9 -2
- package/dist/journal.d.ts +0 -1
- package/dist/journal.js +0 -1
- package/dist/messages.d.ts +40 -11
- package/dist/messages.js +14 -1
- package/dist/net.d.ts +41 -0
- package/dist/net.js +40 -0
- package/dist/notices.d.ts +0 -1
- package/dist/notices.js +0 -1
- package/dist/redaction.d.ts +64 -1
- package/dist/redaction.js +119 -3
- package/dist/schema/event-message.json +3 -1
- package/dist/schema/event-type.json +3 -1
- package/dist/schema/hello-message.json +9 -0
- package/dist/schema/reticle-event.json +3 -1
- package/dist/schema/reticle-message.json +12 -1
- package/dist/security.d.ts +20 -1
- package/dist/security.js +45 -1
- package/dist/session-constants.d.ts +0 -1
- package/dist/session-constants.js +0 -1
- package/dist/source-constants.d.ts +26 -0
- package/dist/source-constants.js +26 -0
- package/dist/state-select.d.ts +10 -1
- package/dist/state-select.js +56 -8
- package/dist/telemetry-feedback.d.ts +265 -0
- package/dist/telemetry-feedback.js +163 -0
- package/dist/telemetry-session.d.ts +524 -0
- package/dist/telemetry-session.js +245 -0
- package/dist/telemetry.d.ts +1410 -37
- package/dist/telemetry.js +338 -18
- package/dist/toon.d.ts +0 -1
- package/dist/toon.js +0 -1
- package/dist/types.d.ts +15 -8
- package/dist/types.js +0 -1
- package/dist/upgrade.d.ts +0 -1
- package/dist/upgrade.js +0 -1
- package/dist/verification-run.d.ts +14 -15
- package/dist/verification-run.js +0 -1
- package/dist/verified-constants.d.ts +104 -0
- package/dist/verified-constants.js +102 -0
- package/package.json +7 -3
- package/dist/brand.d.ts.map +0 -1
- package/dist/brand.js.map +0 -1
- package/dist/consequence.d.ts.map +0 -1
- package/dist/consequence.js.map +0 -1
- package/dist/constants.d.ts.map +0 -1
- package/dist/constants.js.map +0 -1
- package/dist/daemon-registry.d.ts.map +0 -1
- package/dist/daemon-registry.js.map +0 -1
- package/dist/event-payloads.d.ts.map +0 -1
- package/dist/event-payloads.js.map +0 -1
- package/dist/flow-constants.d.ts.map +0 -1
- package/dist/flow-constants.js.map +0 -1
- package/dist/flow-types.d.ts.map +0 -1
- package/dist/flow-types.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/journal.d.ts.map +0 -1
- package/dist/journal.js.map +0 -1
- package/dist/messages.d.ts.map +0 -1
- package/dist/messages.js.map +0 -1
- package/dist/notices.d.ts.map +0 -1
- package/dist/notices.js.map +0 -1
- package/dist/redaction.d.ts.map +0 -1
- package/dist/redaction.js.map +0 -1
- package/dist/security.d.ts.map +0 -1
- package/dist/security.js.map +0 -1
- package/dist/session-constants.d.ts.map +0 -1
- package/dist/session-constants.js.map +0 -1
- package/dist/state-select.d.ts.map +0 -1
- package/dist/state-select.js.map +0 -1
- package/dist/telemetry.d.ts.map +0 -1
- package/dist/telemetry.js.map +0 -1
- package/dist/toon.d.ts.map +0 -1
- package/dist/toon.js.map +0 -1
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js.map +0 -1
- package/dist/upgrade.d.ts.map +0 -1
- package/dist/upgrade.js.map +0 -1
- package/dist/verification-run.d.ts.map +0 -1
- package/dist/verification-run.js.map +0 -1
package/dist/messages.d.ts
CHANGED
|
@@ -114,9 +114,11 @@ export declare const ReticleEventSchema: z.ZodObject<{
|
|
|
114
114
|
readonly TRANSPORT_OVERFLOW: "transport.overflow";
|
|
115
115
|
readonly TRUNCATED: "truncated";
|
|
116
116
|
readonly BLIND_SPOT: "blind-spot";
|
|
117
|
+
readonly SDK_FAILED: "sdk.failed";
|
|
117
118
|
readonly NET_DETAIL: "net.detail";
|
|
118
119
|
readonly HUMAN_CONTROL: "human.control";
|
|
119
120
|
readonly HUMAN_MARK: "human.mark";
|
|
121
|
+
readonly DOWNLOAD: "download";
|
|
120
122
|
}>;
|
|
121
123
|
sessionId: z.ZodString;
|
|
122
124
|
/** Stable element reference this event concerns, when applicable (e.g. "e7"). */
|
|
@@ -139,7 +141,7 @@ export declare const ReticleEventSchema: z.ZodObject<{
|
|
|
139
141
|
/** Event-type-specific payload. Kept open here; refined per observer at the edges. */
|
|
140
142
|
data: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
141
143
|
}, "strip", z.ZodTypeAny, {
|
|
142
|
-
type: "signal" | "dom.added" | "dom.removed" | "dom.attr" | "dom.text" | "net.request" | "net.pending" | "net.stream" | "perf" | "route.change" | "console.log" | "console.warn" | "console.error" | "console.info" | "console.debug" | "error.uncaught" | "visible.shown" | "anim.start" | "anim.end" | "scroll.position" | "reveal.shown" | "state.change" | "storage.change" | "page.health" | "render.commit" | "focus.change" | "flow.recorded" | "transport.overflow" | "truncated" | "blind-spot" | "net.detail" | "human.control" | "human.mark";
|
|
144
|
+
type: "signal" | "dom.added" | "dom.removed" | "dom.attr" | "dom.text" | "net.request" | "net.pending" | "net.stream" | "perf" | "route.change" | "console.log" | "console.warn" | "console.error" | "console.info" | "console.debug" | "error.uncaught" | "visible.shown" | "anim.start" | "anim.end" | "scroll.position" | "reveal.shown" | "state.change" | "storage.change" | "page.health" | "render.commit" | "focus.change" | "flow.recorded" | "transport.overflow" | "truncated" | "blind-spot" | "sdk.failed" | "net.detail" | "human.control" | "human.mark" | "download";
|
|
143
145
|
t: number;
|
|
144
146
|
sessionId: string;
|
|
145
147
|
data: Record<string, unknown>;
|
|
@@ -148,7 +150,7 @@ export declare const ReticleEventSchema: z.ZodObject<{
|
|
|
148
150
|
actionId?: string | undefined;
|
|
149
151
|
attribution?: "window" | undefined;
|
|
150
152
|
}, {
|
|
151
|
-
type: "signal" | "dom.added" | "dom.removed" | "dom.attr" | "dom.text" | "net.request" | "net.pending" | "net.stream" | "perf" | "route.change" | "console.log" | "console.warn" | "console.error" | "console.info" | "console.debug" | "error.uncaught" | "visible.shown" | "anim.start" | "anim.end" | "scroll.position" | "reveal.shown" | "state.change" | "storage.change" | "page.health" | "render.commit" | "focus.change" | "flow.recorded" | "transport.overflow" | "truncated" | "blind-spot" | "net.detail" | "human.control" | "human.mark";
|
|
153
|
+
type: "signal" | "dom.added" | "dom.removed" | "dom.attr" | "dom.text" | "net.request" | "net.pending" | "net.stream" | "perf" | "route.change" | "console.log" | "console.warn" | "console.error" | "console.info" | "console.debug" | "error.uncaught" | "visible.shown" | "anim.start" | "anim.end" | "scroll.position" | "reveal.shown" | "state.change" | "storage.change" | "page.health" | "render.commit" | "focus.change" | "flow.recorded" | "transport.overflow" | "truncated" | "blind-spot" | "sdk.failed" | "net.detail" | "human.control" | "human.mark" | "download";
|
|
152
154
|
t: number;
|
|
153
155
|
sessionId: string;
|
|
154
156
|
ref?: string | undefined;
|
|
@@ -177,6 +179,16 @@ export declare const HelloMessageSchema: z.ZodObject<{
|
|
|
177
179
|
token: z.ZodOptional<z.ZodString>;
|
|
178
180
|
/** Whether the app has advertised a capability registry (reticle.describe). */
|
|
179
181
|
hasCapabilities: z.ZodOptional<z.ZodBoolean>;
|
|
182
|
+
/**
|
|
183
|
+
* Extra key names this app declared sensitive via `connect({ redact: { keys } })`.
|
|
184
|
+
*
|
|
185
|
+
* Sent so the DRIVEN path redacts them too: a request body captured by the daemon from the network
|
|
186
|
+
* stack never passes through the SDK, so an app-declared credential would otherwise reach the
|
|
187
|
+
* journal in cleartext on exactly the path the user cannot see. Literal names only — a pattern
|
|
188
|
+
* compiled from the wire would be a ReDoS surface, and the exemption list is never sent because it
|
|
189
|
+
* is the only part of the config that could REMOVE redaction. See `wireRedactionKeys`.
|
|
190
|
+
*/
|
|
191
|
+
redactKeys: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
180
192
|
}, "strip", z.ZodTypeAny, {
|
|
181
193
|
kind: "hello";
|
|
182
194
|
sessionId: string;
|
|
@@ -187,6 +199,7 @@ export declare const HelloMessageSchema: z.ZodObject<{
|
|
|
187
199
|
projectId?: string | undefined;
|
|
188
200
|
token?: string | undefined;
|
|
189
201
|
hasCapabilities?: boolean | undefined;
|
|
202
|
+
redactKeys?: string[] | undefined;
|
|
190
203
|
}, {
|
|
191
204
|
kind: "hello";
|
|
192
205
|
sessionId: string;
|
|
@@ -197,6 +210,7 @@ export declare const HelloMessageSchema: z.ZodObject<{
|
|
|
197
210
|
projectId?: string | undefined;
|
|
198
211
|
token?: string | undefined;
|
|
199
212
|
hasCapabilities?: boolean | undefined;
|
|
213
|
+
redactKeys?: string[] | undefined;
|
|
200
214
|
}>;
|
|
201
215
|
export type HelloMessage = z.infer<typeof HelloMessageSchema>;
|
|
202
216
|
/** Agent -> browser request, routed by the bridge with a correlation id. */
|
|
@@ -277,9 +291,11 @@ export declare const EventMessageSchema: z.ZodObject<{
|
|
|
277
291
|
readonly TRANSPORT_OVERFLOW: "transport.overflow";
|
|
278
292
|
readonly TRUNCATED: "truncated";
|
|
279
293
|
readonly BLIND_SPOT: "blind-spot";
|
|
294
|
+
readonly SDK_FAILED: "sdk.failed";
|
|
280
295
|
readonly NET_DETAIL: "net.detail";
|
|
281
296
|
readonly HUMAN_CONTROL: "human.control";
|
|
282
297
|
readonly HUMAN_MARK: "human.mark";
|
|
298
|
+
readonly DOWNLOAD: "download";
|
|
283
299
|
}>;
|
|
284
300
|
sessionId: z.ZodString;
|
|
285
301
|
/** Stable element reference this event concerns, when applicable (e.g. "e7"). */
|
|
@@ -302,7 +318,7 @@ export declare const EventMessageSchema: z.ZodObject<{
|
|
|
302
318
|
/** Event-type-specific payload. Kept open here; refined per observer at the edges. */
|
|
303
319
|
data: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
304
320
|
}, "strip", z.ZodTypeAny, {
|
|
305
|
-
type: "signal" | "dom.added" | "dom.removed" | "dom.attr" | "dom.text" | "net.request" | "net.pending" | "net.stream" | "perf" | "route.change" | "console.log" | "console.warn" | "console.error" | "console.info" | "console.debug" | "error.uncaught" | "visible.shown" | "anim.start" | "anim.end" | "scroll.position" | "reveal.shown" | "state.change" | "storage.change" | "page.health" | "render.commit" | "focus.change" | "flow.recorded" | "transport.overflow" | "truncated" | "blind-spot" | "net.detail" | "human.control" | "human.mark";
|
|
321
|
+
type: "signal" | "dom.added" | "dom.removed" | "dom.attr" | "dom.text" | "net.request" | "net.pending" | "net.stream" | "perf" | "route.change" | "console.log" | "console.warn" | "console.error" | "console.info" | "console.debug" | "error.uncaught" | "visible.shown" | "anim.start" | "anim.end" | "scroll.position" | "reveal.shown" | "state.change" | "storage.change" | "page.health" | "render.commit" | "focus.change" | "flow.recorded" | "transport.overflow" | "truncated" | "blind-spot" | "sdk.failed" | "net.detail" | "human.control" | "human.mark" | "download";
|
|
306
322
|
t: number;
|
|
307
323
|
sessionId: string;
|
|
308
324
|
data: Record<string, unknown>;
|
|
@@ -311,7 +327,7 @@ export declare const EventMessageSchema: z.ZodObject<{
|
|
|
311
327
|
actionId?: string | undefined;
|
|
312
328
|
attribution?: "window" | undefined;
|
|
313
329
|
}, {
|
|
314
|
-
type: "signal" | "dom.added" | "dom.removed" | "dom.attr" | "dom.text" | "net.request" | "net.pending" | "net.stream" | "perf" | "route.change" | "console.log" | "console.warn" | "console.error" | "console.info" | "console.debug" | "error.uncaught" | "visible.shown" | "anim.start" | "anim.end" | "scroll.position" | "reveal.shown" | "state.change" | "storage.change" | "page.health" | "render.commit" | "focus.change" | "flow.recorded" | "transport.overflow" | "truncated" | "blind-spot" | "net.detail" | "human.control" | "human.mark";
|
|
330
|
+
type: "signal" | "dom.added" | "dom.removed" | "dom.attr" | "dom.text" | "net.request" | "net.pending" | "net.stream" | "perf" | "route.change" | "console.log" | "console.warn" | "console.error" | "console.info" | "console.debug" | "error.uncaught" | "visible.shown" | "anim.start" | "anim.end" | "scroll.position" | "reveal.shown" | "state.change" | "storage.change" | "page.health" | "render.commit" | "focus.change" | "flow.recorded" | "transport.overflow" | "truncated" | "blind-spot" | "sdk.failed" | "net.detail" | "human.control" | "human.mark" | "download";
|
|
315
331
|
t: number;
|
|
316
332
|
sessionId: string;
|
|
317
333
|
ref?: string | undefined;
|
|
@@ -322,7 +338,7 @@ export declare const EventMessageSchema: z.ZodObject<{
|
|
|
322
338
|
}>;
|
|
323
339
|
}, "strip", z.ZodTypeAny, {
|
|
324
340
|
event: {
|
|
325
|
-
type: "signal" | "dom.added" | "dom.removed" | "dom.attr" | "dom.text" | "net.request" | "net.pending" | "net.stream" | "perf" | "route.change" | "console.log" | "console.warn" | "console.error" | "console.info" | "console.debug" | "error.uncaught" | "visible.shown" | "anim.start" | "anim.end" | "scroll.position" | "reveal.shown" | "state.change" | "storage.change" | "page.health" | "render.commit" | "focus.change" | "flow.recorded" | "transport.overflow" | "truncated" | "blind-spot" | "net.detail" | "human.control" | "human.mark";
|
|
341
|
+
type: "signal" | "dom.added" | "dom.removed" | "dom.attr" | "dom.text" | "net.request" | "net.pending" | "net.stream" | "perf" | "route.change" | "console.log" | "console.warn" | "console.error" | "console.info" | "console.debug" | "error.uncaught" | "visible.shown" | "anim.start" | "anim.end" | "scroll.position" | "reveal.shown" | "state.change" | "storage.change" | "page.health" | "render.commit" | "focus.change" | "flow.recorded" | "transport.overflow" | "truncated" | "blind-spot" | "sdk.failed" | "net.detail" | "human.control" | "human.mark" | "download";
|
|
326
342
|
t: number;
|
|
327
343
|
sessionId: string;
|
|
328
344
|
data: Record<string, unknown>;
|
|
@@ -334,7 +350,7 @@ export declare const EventMessageSchema: z.ZodObject<{
|
|
|
334
350
|
kind: "event";
|
|
335
351
|
}, {
|
|
336
352
|
event: {
|
|
337
|
-
type: "signal" | "dom.added" | "dom.removed" | "dom.attr" | "dom.text" | "net.request" | "net.pending" | "net.stream" | "perf" | "route.change" | "console.log" | "console.warn" | "console.error" | "console.info" | "console.debug" | "error.uncaught" | "visible.shown" | "anim.start" | "anim.end" | "scroll.position" | "reveal.shown" | "state.change" | "storage.change" | "page.health" | "render.commit" | "focus.change" | "flow.recorded" | "transport.overflow" | "truncated" | "blind-spot" | "net.detail" | "human.control" | "human.mark";
|
|
353
|
+
type: "signal" | "dom.added" | "dom.removed" | "dom.attr" | "dom.text" | "net.request" | "net.pending" | "net.stream" | "perf" | "route.change" | "console.log" | "console.warn" | "console.error" | "console.info" | "console.debug" | "error.uncaught" | "visible.shown" | "anim.start" | "anim.end" | "scroll.position" | "reveal.shown" | "state.change" | "storage.change" | "page.health" | "render.commit" | "focus.change" | "flow.recorded" | "transport.overflow" | "truncated" | "blind-spot" | "sdk.failed" | "net.detail" | "human.control" | "human.mark" | "download";
|
|
338
354
|
t: number;
|
|
339
355
|
sessionId: string;
|
|
340
356
|
ref?: string | undefined;
|
|
@@ -364,6 +380,16 @@ export declare const ReticleMessageSchema: z.ZodDiscriminatedUnion<"kind", [z.Zo
|
|
|
364
380
|
token: z.ZodOptional<z.ZodString>;
|
|
365
381
|
/** Whether the app has advertised a capability registry (reticle.describe). */
|
|
366
382
|
hasCapabilities: z.ZodOptional<z.ZodBoolean>;
|
|
383
|
+
/**
|
|
384
|
+
* Extra key names this app declared sensitive via `connect({ redact: { keys } })`.
|
|
385
|
+
*
|
|
386
|
+
* Sent so the DRIVEN path redacts them too: a request body captured by the daemon from the network
|
|
387
|
+
* stack never passes through the SDK, so an app-declared credential would otherwise reach the
|
|
388
|
+
* journal in cleartext on exactly the path the user cannot see. Literal names only — a pattern
|
|
389
|
+
* compiled from the wire would be a ReDoS surface, and the exemption list is never sent because it
|
|
390
|
+
* is the only part of the config that could REMOVE redaction. See `wireRedactionKeys`.
|
|
391
|
+
*/
|
|
392
|
+
redactKeys: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
367
393
|
}, "strip", z.ZodTypeAny, {
|
|
368
394
|
kind: "hello";
|
|
369
395
|
sessionId: string;
|
|
@@ -374,6 +400,7 @@ export declare const ReticleMessageSchema: z.ZodDiscriminatedUnion<"kind", [z.Zo
|
|
|
374
400
|
projectId?: string | undefined;
|
|
375
401
|
token?: string | undefined;
|
|
376
402
|
hasCapabilities?: boolean | undefined;
|
|
403
|
+
redactKeys?: string[] | undefined;
|
|
377
404
|
}, {
|
|
378
405
|
kind: "hello";
|
|
379
406
|
sessionId: string;
|
|
@@ -384,6 +411,7 @@ export declare const ReticleMessageSchema: z.ZodDiscriminatedUnion<"kind", [z.Zo
|
|
|
384
411
|
projectId?: string | undefined;
|
|
385
412
|
token?: string | undefined;
|
|
386
413
|
hasCapabilities?: boolean | undefined;
|
|
414
|
+
redactKeys?: string[] | undefined;
|
|
387
415
|
}>, z.ZodObject<{
|
|
388
416
|
kind: z.ZodLiteral<"command">;
|
|
389
417
|
id: z.ZodString;
|
|
@@ -455,9 +483,11 @@ export declare const ReticleMessageSchema: z.ZodDiscriminatedUnion<"kind", [z.Zo
|
|
|
455
483
|
readonly TRANSPORT_OVERFLOW: "transport.overflow";
|
|
456
484
|
readonly TRUNCATED: "truncated";
|
|
457
485
|
readonly BLIND_SPOT: "blind-spot";
|
|
486
|
+
readonly SDK_FAILED: "sdk.failed";
|
|
458
487
|
readonly NET_DETAIL: "net.detail";
|
|
459
488
|
readonly HUMAN_CONTROL: "human.control";
|
|
460
489
|
readonly HUMAN_MARK: "human.mark";
|
|
490
|
+
readonly DOWNLOAD: "download";
|
|
461
491
|
}>;
|
|
462
492
|
sessionId: z.ZodString;
|
|
463
493
|
/** Stable element reference this event concerns, when applicable (e.g. "e7"). */
|
|
@@ -480,7 +510,7 @@ export declare const ReticleMessageSchema: z.ZodDiscriminatedUnion<"kind", [z.Zo
|
|
|
480
510
|
/** Event-type-specific payload. Kept open here; refined per observer at the edges. */
|
|
481
511
|
data: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
482
512
|
}, "strip", z.ZodTypeAny, {
|
|
483
|
-
type: "signal" | "dom.added" | "dom.removed" | "dom.attr" | "dom.text" | "net.request" | "net.pending" | "net.stream" | "perf" | "route.change" | "console.log" | "console.warn" | "console.error" | "console.info" | "console.debug" | "error.uncaught" | "visible.shown" | "anim.start" | "anim.end" | "scroll.position" | "reveal.shown" | "state.change" | "storage.change" | "page.health" | "render.commit" | "focus.change" | "flow.recorded" | "transport.overflow" | "truncated" | "blind-spot" | "net.detail" | "human.control" | "human.mark";
|
|
513
|
+
type: "signal" | "dom.added" | "dom.removed" | "dom.attr" | "dom.text" | "net.request" | "net.pending" | "net.stream" | "perf" | "route.change" | "console.log" | "console.warn" | "console.error" | "console.info" | "console.debug" | "error.uncaught" | "visible.shown" | "anim.start" | "anim.end" | "scroll.position" | "reveal.shown" | "state.change" | "storage.change" | "page.health" | "render.commit" | "focus.change" | "flow.recorded" | "transport.overflow" | "truncated" | "blind-spot" | "sdk.failed" | "net.detail" | "human.control" | "human.mark" | "download";
|
|
484
514
|
t: number;
|
|
485
515
|
sessionId: string;
|
|
486
516
|
data: Record<string, unknown>;
|
|
@@ -489,7 +519,7 @@ export declare const ReticleMessageSchema: z.ZodDiscriminatedUnion<"kind", [z.Zo
|
|
|
489
519
|
actionId?: string | undefined;
|
|
490
520
|
attribution?: "window" | undefined;
|
|
491
521
|
}, {
|
|
492
|
-
type: "signal" | "dom.added" | "dom.removed" | "dom.attr" | "dom.text" | "net.request" | "net.pending" | "net.stream" | "perf" | "route.change" | "console.log" | "console.warn" | "console.error" | "console.info" | "console.debug" | "error.uncaught" | "visible.shown" | "anim.start" | "anim.end" | "scroll.position" | "reveal.shown" | "state.change" | "storage.change" | "page.health" | "render.commit" | "focus.change" | "flow.recorded" | "transport.overflow" | "truncated" | "blind-spot" | "net.detail" | "human.control" | "human.mark";
|
|
522
|
+
type: "signal" | "dom.added" | "dom.removed" | "dom.attr" | "dom.text" | "net.request" | "net.pending" | "net.stream" | "perf" | "route.change" | "console.log" | "console.warn" | "console.error" | "console.info" | "console.debug" | "error.uncaught" | "visible.shown" | "anim.start" | "anim.end" | "scroll.position" | "reveal.shown" | "state.change" | "storage.change" | "page.health" | "render.commit" | "focus.change" | "flow.recorded" | "transport.overflow" | "truncated" | "blind-spot" | "sdk.failed" | "net.detail" | "human.control" | "human.mark" | "download";
|
|
493
523
|
t: number;
|
|
494
524
|
sessionId: string;
|
|
495
525
|
ref?: string | undefined;
|
|
@@ -500,7 +530,7 @@ export declare const ReticleMessageSchema: z.ZodDiscriminatedUnion<"kind", [z.Zo
|
|
|
500
530
|
}>;
|
|
501
531
|
}, "strip", z.ZodTypeAny, {
|
|
502
532
|
event: {
|
|
503
|
-
type: "signal" | "dom.added" | "dom.removed" | "dom.attr" | "dom.text" | "net.request" | "net.pending" | "net.stream" | "perf" | "route.change" | "console.log" | "console.warn" | "console.error" | "console.info" | "console.debug" | "error.uncaught" | "visible.shown" | "anim.start" | "anim.end" | "scroll.position" | "reveal.shown" | "state.change" | "storage.change" | "page.health" | "render.commit" | "focus.change" | "flow.recorded" | "transport.overflow" | "truncated" | "blind-spot" | "net.detail" | "human.control" | "human.mark";
|
|
533
|
+
type: "signal" | "dom.added" | "dom.removed" | "dom.attr" | "dom.text" | "net.request" | "net.pending" | "net.stream" | "perf" | "route.change" | "console.log" | "console.warn" | "console.error" | "console.info" | "console.debug" | "error.uncaught" | "visible.shown" | "anim.start" | "anim.end" | "scroll.position" | "reveal.shown" | "state.change" | "storage.change" | "page.health" | "render.commit" | "focus.change" | "flow.recorded" | "transport.overflow" | "truncated" | "blind-spot" | "sdk.failed" | "net.detail" | "human.control" | "human.mark" | "download";
|
|
504
534
|
t: number;
|
|
505
535
|
sessionId: string;
|
|
506
536
|
data: Record<string, unknown>;
|
|
@@ -512,7 +542,7 @@ export declare const ReticleMessageSchema: z.ZodDiscriminatedUnion<"kind", [z.Zo
|
|
|
512
542
|
kind: "event";
|
|
513
543
|
}, {
|
|
514
544
|
event: {
|
|
515
|
-
type: "signal" | "dom.added" | "dom.removed" | "dom.attr" | "dom.text" | "net.request" | "net.pending" | "net.stream" | "perf" | "route.change" | "console.log" | "console.warn" | "console.error" | "console.info" | "console.debug" | "error.uncaught" | "visible.shown" | "anim.start" | "anim.end" | "scroll.position" | "reveal.shown" | "state.change" | "storage.change" | "page.health" | "render.commit" | "focus.change" | "flow.recorded" | "transport.overflow" | "truncated" | "blind-spot" | "net.detail" | "human.control" | "human.mark";
|
|
545
|
+
type: "signal" | "dom.added" | "dom.removed" | "dom.attr" | "dom.text" | "net.request" | "net.pending" | "net.stream" | "perf" | "route.change" | "console.log" | "console.warn" | "console.error" | "console.info" | "console.debug" | "error.uncaught" | "visible.shown" | "anim.start" | "anim.end" | "scroll.position" | "reveal.shown" | "state.change" | "storage.change" | "page.health" | "render.commit" | "focus.change" | "flow.recorded" | "transport.overflow" | "truncated" | "blind-spot" | "sdk.failed" | "net.detail" | "human.control" | "human.mark" | "download";
|
|
516
546
|
t: number;
|
|
517
547
|
sessionId: string;
|
|
518
548
|
ref?: string | undefined;
|
|
@@ -523,4 +553,3 @@ export declare const ReticleMessageSchema: z.ZodDiscriminatedUnion<"kind", [z.Zo
|
|
|
523
553
|
};
|
|
524
554
|
kind: "event";
|
|
525
555
|
}>]>;
|
|
526
|
-
//# sourceMappingURL=messages.d.ts.map
|
package/dist/messages.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { EventAttribution, EventType, RETICLE_PROTOCOL_VERSION, MessageKind, TRANSPORT_LIMITS, } from './constants.js';
|
|
3
3
|
import { HumanControlKind, MarkAnchorStrategy } from './session-constants.js';
|
|
4
|
+
import { MAX_WIRE_REDACT_KEYS, MAX_WIRE_REDACT_KEY_LENGTH } from './redaction.js';
|
|
4
5
|
const sessionIdSchema = z.string().min(1).max(TRANSPORT_LIMITS.MAX_SESSION_ID_LENGTH);
|
|
5
6
|
const refSchema = z.string().max(TRANSPORT_LIMITS.MAX_REF_LENGTH);
|
|
6
7
|
/**
|
|
@@ -85,6 +86,19 @@ export const HelloMessageSchema = z.object({
|
|
|
85
86
|
token: z.string().max(TRANSPORT_LIMITS.MAX_TOKEN_LENGTH).optional(),
|
|
86
87
|
/** Whether the app has advertised a capability registry (reticle.describe). */
|
|
87
88
|
hasCapabilities: z.boolean().optional(),
|
|
89
|
+
/**
|
|
90
|
+
* Extra key names this app declared sensitive via `connect({ redact: { keys } })`.
|
|
91
|
+
*
|
|
92
|
+
* Sent so the DRIVEN path redacts them too: a request body captured by the daemon from the network
|
|
93
|
+
* stack never passes through the SDK, so an app-declared credential would otherwise reach the
|
|
94
|
+
* journal in cleartext on exactly the path the user cannot see. Literal names only — a pattern
|
|
95
|
+
* compiled from the wire would be a ReDoS surface, and the exemption list is never sent because it
|
|
96
|
+
* is the only part of the config that could REMOVE redaction. See `wireRedactionKeys`.
|
|
97
|
+
*/
|
|
98
|
+
redactKeys: z
|
|
99
|
+
.array(z.string().min(1).max(MAX_WIRE_REDACT_KEY_LENGTH))
|
|
100
|
+
.max(MAX_WIRE_REDACT_KEYS)
|
|
101
|
+
.optional(),
|
|
88
102
|
});
|
|
89
103
|
/** Agent -> browser request, routed by the bridge with a correlation id. */
|
|
90
104
|
export const CommandMessageSchema = z.object({
|
|
@@ -113,4 +127,3 @@ export const ReticleMessageSchema = z.discriminatedUnion('kind', [
|
|
|
113
127
|
CommandResultSchema,
|
|
114
128
|
EventMessageSchema,
|
|
115
129
|
]);
|
|
116
|
-
//# sourceMappingURL=messages.js.map
|
package/dist/net.d.ts
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Network-call vocabulary shared by the browser SDK and the server. Split out of constants.ts to
|
|
3
|
+
* keep that file under the size cap.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* What issued a network-shaped call. Desktop apps (Electron, Tauri) reach their backend over IPC
|
|
7
|
+
* rather than HTTP, so an IPC call is recorded as a request with `initiator: 'ipc'` — that keeps
|
|
8
|
+
* `reticle_network`, settle-waiting and `assert { net }` working on desktop with no new wire shape.
|
|
9
|
+
*/
|
|
10
|
+
export declare const NetInitiator: {
|
|
11
|
+
readonly FETCH: "fetch";
|
|
12
|
+
readonly XHR: "xhr";
|
|
13
|
+
readonly BEACON: "beacon";
|
|
14
|
+
readonly IPC: "ipc";
|
|
15
|
+
};
|
|
16
|
+
export type NetInitiator = (typeof NetInitiator)[keyof typeof NetInitiator];
|
|
17
|
+
/**
|
|
18
|
+
* Synthetic URL scheme for an IPC call, so a channel/command name occupies the `url` field the way a
|
|
19
|
+
* real endpoint does: `ipc://get_user`. Agents filter and assert on it with the ordinary net tools.
|
|
20
|
+
*/
|
|
21
|
+
export declare const IPC_URL_SCHEME = "ipc://";
|
|
22
|
+
/**
|
|
23
|
+
* IPC has no status code, but every existing filter and assertion in Reticle keys on one
|
|
24
|
+
* (`reticle_network { status: 500 }`, "did POST /x return 200?"). Mapping a settled IPC call onto
|
|
25
|
+
* these two synthetic codes is what makes a FAILED main-process handler or Rust command visible to
|
|
26
|
+
* the tools an agent already uses — without it, an IPC failure is unqueryable and the desktop story
|
|
27
|
+
* is a false green by construction. `ok` is still emitted alongside and is the authoritative field.
|
|
28
|
+
*/
|
|
29
|
+
export declare const IpcStatus: {
|
|
30
|
+
readonly OK: 200;
|
|
31
|
+
readonly ERROR: 500;
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* `202 Accepted` — the server took the request and has NOT finished processing it.
|
|
35
|
+
*
|
|
36
|
+
* The only status in HTTP whose meaning is "no outcome yet". Folding it into the 2xx success band is
|
|
37
|
+
* how an asynchronous workflow gets verified at exactly the moment nothing has been decided:
|
|
38
|
+
* measured on a logistics console, a dispatch answered 202, the UI rendered success, the page
|
|
39
|
+
* settled, and the server reverted the shipment 1.2s later.
|
|
40
|
+
*/
|
|
41
|
+
export declare const HTTP_ACCEPTED = 202;
|
package/dist/net.js
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Network-call vocabulary shared by the browser SDK and the server. Split out of constants.ts to
|
|
3
|
+
* keep that file under the size cap.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* What issued a network-shaped call. Desktop apps (Electron, Tauri) reach their backend over IPC
|
|
7
|
+
* rather than HTTP, so an IPC call is recorded as a request with `initiator: 'ipc'` — that keeps
|
|
8
|
+
* `reticle_network`, settle-waiting and `assert { net }` working on desktop with no new wire shape.
|
|
9
|
+
*/
|
|
10
|
+
export const NetInitiator = {
|
|
11
|
+
FETCH: 'fetch',
|
|
12
|
+
XHR: 'xhr',
|
|
13
|
+
BEACON: 'beacon',
|
|
14
|
+
IPC: 'ipc',
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* Synthetic URL scheme for an IPC call, so a channel/command name occupies the `url` field the way a
|
|
18
|
+
* real endpoint does: `ipc://get_user`. Agents filter and assert on it with the ordinary net tools.
|
|
19
|
+
*/
|
|
20
|
+
export const IPC_URL_SCHEME = 'ipc://';
|
|
21
|
+
/**
|
|
22
|
+
* IPC has no status code, but every existing filter and assertion in Reticle keys on one
|
|
23
|
+
* (`reticle_network { status: 500 }`, "did POST /x return 200?"). Mapping a settled IPC call onto
|
|
24
|
+
* these two synthetic codes is what makes a FAILED main-process handler or Rust command visible to
|
|
25
|
+
* the tools an agent already uses — without it, an IPC failure is unqueryable and the desktop story
|
|
26
|
+
* is a false green by construction. `ok` is still emitted alongside and is the authoritative field.
|
|
27
|
+
*/
|
|
28
|
+
export const IpcStatus = {
|
|
29
|
+
OK: 200,
|
|
30
|
+
ERROR: 500,
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* `202 Accepted` — the server took the request and has NOT finished processing it.
|
|
34
|
+
*
|
|
35
|
+
* The only status in HTTP whose meaning is "no outcome yet". Folding it into the 2xx success band is
|
|
36
|
+
* how an asynchronous workflow gets verified at exactly the moment nothing has been decided:
|
|
37
|
+
* measured on a logistics console, a dispatch answered 202, the UI rendered success, the page
|
|
38
|
+
* settled, and the server reverted the shipment 1.2s later.
|
|
39
|
+
*/
|
|
40
|
+
export const HTTP_ACCEPTED = 202;
|
package/dist/notices.d.ts
CHANGED
|
@@ -57,4 +57,3 @@ export declare const AGENT_ASK_NOTICE = "Agent needs your input \u2014 answer in
|
|
|
57
57
|
* context). Reticle cannot bring such a tab to front or recover it, so it names the limit instead.
|
|
58
58
|
*/
|
|
59
59
|
export declare const UNSCRIPTABLE_TAB_RECOMMENDATION = "tab hidden/throttled and may be un-focusable from here; refocus it, or run `reticle drive <url>` for a guaranteed scriptable context";
|
|
60
|
-
//# sourceMappingURL=notices.d.ts.map
|
package/dist/notices.js
CHANGED
|
@@ -61,4 +61,3 @@ export const AGENT_ASK_NOTICE = 'Agent needs your input — answer in your termi
|
|
|
61
61
|
* context). Reticle cannot bring such a tab to front or recover it, so it names the limit instead.
|
|
62
62
|
*/
|
|
63
63
|
export const UNSCRIPTABLE_TAB_RECOMMENDATION = 'tab hidden/throttled and may be un-focusable from here; refocus it, or run `reticle drive <url>` for a guaranteed scriptable context';
|
|
64
|
-
//# sourceMappingURL=notices.js.map
|
package/dist/redaction.d.ts
CHANGED
|
@@ -1,4 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The built-in rule, always available and never configurable.
|
|
3
|
+
*
|
|
4
|
+
* Separate from `isSensitiveKey` on purpose: the driven path needs a floor that no page-supplied
|
|
5
|
+
* config can lower, and the conformance test needs something to compare an unconfigured policy
|
|
6
|
+
* against. Every existing caller wants `isSensitiveKey`.
|
|
7
|
+
*/
|
|
8
|
+
export declare function defaultIsSensitiveKey(key: string): boolean;
|
|
9
|
+
/**
|
|
10
|
+
* An app's additions to (and subtractions from) the default rule.
|
|
11
|
+
*
|
|
12
|
+
* Additive by construction: `keys` can only ever redact MORE, and `allow` only exempts from the
|
|
13
|
+
* DEFAULT rule. There is deliberately no way to replace the default set — a user who could would
|
|
14
|
+
* eventually ship an app that leaks, and Reticle would be the thing that recorded it.
|
|
15
|
+
*/
|
|
16
|
+
export interface RedactionConfig {
|
|
17
|
+
/**
|
|
18
|
+
* Extra keys to redact. A string matches a key name EXACTLY (case-insensitively) — `'code'` does
|
|
19
|
+
* not redact `codeOwner` — and a RegExp is tested against the key. Use a string unless you need a
|
|
20
|
+
* pattern: only strings cross the bridge (see `wireRedactionKeys`).
|
|
21
|
+
*/
|
|
22
|
+
keys?: ReadonlyArray<string | RegExp>;
|
|
23
|
+
/**
|
|
24
|
+
* Keys to exempt from the DEFAULT rule, for the false positives every app has its own version of
|
|
25
|
+
* (`designToken`, an internal `sessionId` that is not a credential). Exact, case-insensitive.
|
|
26
|
+
* Loses to `keys`: an explicit redact instruction beats an exemption.
|
|
27
|
+
*/
|
|
28
|
+
allow?: readonly string[];
|
|
29
|
+
}
|
|
30
|
+
/** A resolved rule. An object rather than a bare function so a caller can hold one per session. */
|
|
31
|
+
export interface RedactionPolicy {
|
|
32
|
+
isSensitiveKey: (key: string) => boolean;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Resolve a config into a rule.
|
|
36
|
+
*
|
|
37
|
+
* `onWarn` fires ONCE here, at build time, rather than per key: the check runs on every serialized
|
|
38
|
+
* key of every event, so a per-key warning would flood the console of the app it is trying to help.
|
|
39
|
+
*/
|
|
40
|
+
export declare function buildRedactionPolicy(config?: RedactionConfig, onWarn?: (message: string) => void): RedactionPolicy;
|
|
41
|
+
export declare function setActiveRedactionPolicy(policy: RedactionPolicy): void;
|
|
42
|
+
export declare function resetActiveRedactionPolicy(): void;
|
|
43
|
+
/** Whether a key carries a credential, under the policy in force. */
|
|
1
44
|
export declare function isSensitiveKey(key: string): boolean;
|
|
45
|
+
/** Cap on how many declared keys travel in a hello — a bound, not a limit anyone should reach. */
|
|
46
|
+
export declare const MAX_WIRE_REDACT_KEYS = 64;
|
|
47
|
+
/** Cap on one declared key's length, so a hello cannot be inflated by a pathological name. */
|
|
48
|
+
export declare const MAX_WIRE_REDACT_KEY_LENGTH = 128;
|
|
49
|
+
/**
|
|
50
|
+
* The part of a config that may cross the bridge, so the server redacts an app's own credentials on
|
|
51
|
+
* the driven path too — where request bodies are captured raw from the network stack and never pass
|
|
52
|
+
* through the SDK at all.
|
|
53
|
+
*
|
|
54
|
+
* Two deliberate exclusions, and both are the safe direction of the asymmetry:
|
|
55
|
+
*
|
|
56
|
+
* - **RegExp entries do not travel.** Compiling a pattern that arrived over a socket and running it
|
|
57
|
+
* against every key of every request body is a ReDoS surface handed to whatever is on the page.
|
|
58
|
+
* A dropped pattern means the driven path over-redacts relative to the config, never under.
|
|
59
|
+
* - **`allow` never travels.** It is the only part of the config that REMOVES redaction, so a page
|
|
60
|
+
* able to send it could quietly un-redact `password` in the daemon's journal for every session.
|
|
61
|
+
* The driven path keeps the default floor.
|
|
62
|
+
*
|
|
63
|
+
* Both limitations are documented for users in docs/usage.md ("Extending the redaction rules").
|
|
64
|
+
*/
|
|
65
|
+
export declare function wireRedactionKeys(config?: RedactionConfig): string[];
|
|
2
66
|
/** Redact high-confidence secret shapes anywhere in a text/value, independent of any surrounding key. */
|
|
3
67
|
export declare function scrubKnownSecrets(text: string): string;
|
|
4
|
-
//# sourceMappingURL=redaction.d.ts.map
|
package/dist/redaction.js
CHANGED
|
@@ -17,10 +17,127 @@ import { REDACTED_VALUE } from './constants.js';
|
|
|
17
17
|
// bundle the session credential and were the one wire payload reaching the journal + the agent
|
|
18
18
|
// unredacted), NOT any key that merely contains the substring — `scopecookie`, `cookieConsent`,
|
|
19
19
|
// `cookiePolicy` are legitimate app values an agent may need to read, and stay visible.
|
|
20
|
-
const SENSITIVE_KEY = /password|passwd|passcode|secret|(?:(?:access|refresh|auth|bearer|api|id|session|csrf|client)[-_]?tokens?|(?:^|[-_])tokens?(?=$|[-_]))|session[-_]?id|(?:^|[-_])(?:sid|pwd|jwt)(?=$|[-_])|authorization|(?:^|[-_])(?:set[-_])?cookie(?=$|[-_])|api[-_]?key|access[-_]?key|private[-_]?key|client[-_]?secret|credit[-_]?card|card[-_]?number|cvv|cvc|ssn
|
|
21
|
-
|
|
20
|
+
const SENSITIVE_KEY = /password|passwd|passcode|secret|(?:(?:access|refresh|auth|bearer|api|id|session|csrf|client)[-_]?tokens?|(?:^|[-_])tokens?(?=$|[-_]))|session[-_]?id|(?:^|[-_])(?:sid|pwd|jwt)(?=$|[-_])|authorization|(?:^|[-_])(?:set[-_])?cookie(?=$|[-_])|api[-_]?key|access[-_]?key|private[-_]?key|client[-_]?secret|credit[-_]?card|card[-_]?number|cvv|cvc|ssn|(?:^|[-_])(?:signature|sig)$|(?:^|[-_])credential$|x-(?:amz|goog)-(?:signature|credential|security-token)$/i;
|
|
21
|
+
/**
|
|
22
|
+
* The built-in rule, always available and never configurable.
|
|
23
|
+
*
|
|
24
|
+
* Separate from `isSensitiveKey` on purpose: the driven path needs a floor that no page-supplied
|
|
25
|
+
* config can lower, and the conformance test needs something to compare an unconfigured policy
|
|
26
|
+
* against. Every existing caller wants `isSensitiveKey`.
|
|
27
|
+
*/
|
|
28
|
+
export function defaultIsSensitiveKey(key) {
|
|
22
29
|
return SENSITIVE_KEY.test(key);
|
|
23
30
|
}
|
|
31
|
+
function normalizeNames(values) {
|
|
32
|
+
const out = new Set();
|
|
33
|
+
for (const value of values ?? []) {
|
|
34
|
+
const trimmed = value.trim().toLowerCase();
|
|
35
|
+
if (trimmed.length > 0)
|
|
36
|
+
out.add(trimmed);
|
|
37
|
+
}
|
|
38
|
+
return out;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Resolve a config into a rule.
|
|
42
|
+
*
|
|
43
|
+
* `onWarn` fires ONCE here, at build time, rather than per key: the check runs on every serialized
|
|
44
|
+
* key of every event, so a per-key warning would flood the console of the app it is trying to help.
|
|
45
|
+
*/
|
|
46
|
+
export function buildRedactionPolicy(config, onWarn) {
|
|
47
|
+
const literalKeys = normalizeNames(config?.keys?.filter((k) => typeof k === 'string'));
|
|
48
|
+
const patterns = (config?.keys ?? []).filter((k) => k instanceof RegExp);
|
|
49
|
+
const allowed = normalizeNames(config?.allow);
|
|
50
|
+
// Exempting a key the default rule calls a credential is a deliberate choice with a real blast
|
|
51
|
+
// radius: that value now reaches the agent transcript and the on-disk journal. Say it once, name
|
|
52
|
+
// the keys, and say nothing about the ordinary case — an exemption for a key the rule never
|
|
53
|
+
// matched is the false-positive fix this option exists for, and warning about it would train
|
|
54
|
+
// people to ignore the warning that matters.
|
|
55
|
+
const exemptedCredentials = [...allowed].filter((key) => defaultIsSensitiveKey(key) && !literalKeys.has(key));
|
|
56
|
+
if (exemptedCredentials.length > 0 && onWarn !== undefined) {
|
|
57
|
+
onWarn(`[reticle] redact.allow is exempting ${exemptedCredentials.join(', ')} from redaction. The ` +
|
|
58
|
+
`default rule treats ${exemptedCredentials.length === 1 ? 'that key' : 'those keys'} as a ` +
|
|
59
|
+
`credential, so ${exemptedCredentials.length === 1 ? 'its value' : 'their values'} will now ` +
|
|
60
|
+
`reach the agent transcript and the on-disk journal in cleartext.`);
|
|
61
|
+
}
|
|
62
|
+
return {
|
|
63
|
+
isSensitiveKey: (key) => {
|
|
64
|
+
const normalized = key.toLowerCase();
|
|
65
|
+
if (literalKeys.has(normalized))
|
|
66
|
+
return true;
|
|
67
|
+
for (const pattern of patterns) {
|
|
68
|
+
// `test` on a /g regex advances lastIndex between calls, so the same key alternates
|
|
69
|
+
// true/false. Reset it rather than trusting every caller to omit the flag.
|
|
70
|
+
pattern.lastIndex = 0;
|
|
71
|
+
if (pattern.test(key))
|
|
72
|
+
return true;
|
|
73
|
+
}
|
|
74
|
+
if (allowed.has(normalized))
|
|
75
|
+
return false;
|
|
76
|
+
return defaultIsSensitiveKey(key);
|
|
77
|
+
},
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* The rule in force for THIS process.
|
|
82
|
+
*
|
|
83
|
+
* Ambient rather than threaded through the ~10 call sites that redact, so configuring it changes
|
|
84
|
+
* every one of them at once and adding a new one cannot accidentally opt out. Set by `connect()` in
|
|
85
|
+
* the browser, where one page means one config.
|
|
86
|
+
*
|
|
87
|
+
* The server deliberately does NOT set this. A daemon serves many sessions in one process, so an
|
|
88
|
+
* ambient policy there would let one app's config decide another app's redaction; the driven path
|
|
89
|
+
* holds its own policy per daemon instead, built only from what sessions declared as EXTRA keys.
|
|
90
|
+
*/
|
|
91
|
+
let activePolicy;
|
|
92
|
+
export function setActiveRedactionPolicy(policy) {
|
|
93
|
+
activePolicy = policy;
|
|
94
|
+
}
|
|
95
|
+
export function resetActiveRedactionPolicy() {
|
|
96
|
+
activePolicy = undefined;
|
|
97
|
+
}
|
|
98
|
+
/** Whether a key carries a credential, under the policy in force. */
|
|
99
|
+
export function isSensitiveKey(key) {
|
|
100
|
+
return activePolicy === undefined ? defaultIsSensitiveKey(key) : activePolicy.isSensitiveKey(key);
|
|
101
|
+
}
|
|
102
|
+
/** Cap on how many declared keys travel in a hello — a bound, not a limit anyone should reach. */
|
|
103
|
+
export const MAX_WIRE_REDACT_KEYS = 64;
|
|
104
|
+
/** Cap on one declared key's length, so a hello cannot be inflated by a pathological name. */
|
|
105
|
+
export const MAX_WIRE_REDACT_KEY_LENGTH = 128;
|
|
106
|
+
/**
|
|
107
|
+
* The part of a config that may cross the bridge, so the server redacts an app's own credentials on
|
|
108
|
+
* the driven path too — where request bodies are captured raw from the network stack and never pass
|
|
109
|
+
* through the SDK at all.
|
|
110
|
+
*
|
|
111
|
+
* Two deliberate exclusions, and both are the safe direction of the asymmetry:
|
|
112
|
+
*
|
|
113
|
+
* - **RegExp entries do not travel.** Compiling a pattern that arrived over a socket and running it
|
|
114
|
+
* against every key of every request body is a ReDoS surface handed to whatever is on the page.
|
|
115
|
+
* A dropped pattern means the driven path over-redacts relative to the config, never under.
|
|
116
|
+
* - **`allow` never travels.** It is the only part of the config that REMOVES redaction, so a page
|
|
117
|
+
* able to send it could quietly un-redact `password` in the daemon's journal for every session.
|
|
118
|
+
* The driven path keeps the default floor.
|
|
119
|
+
*
|
|
120
|
+
* Both limitations are documented for users in docs/usage.md ("Extending the redaction rules").
|
|
121
|
+
*/
|
|
122
|
+
export function wireRedactionKeys(config) {
|
|
123
|
+
const seen = new Set();
|
|
124
|
+
const out = [];
|
|
125
|
+
for (const key of config?.keys ?? []) {
|
|
126
|
+
if (typeof key !== 'string')
|
|
127
|
+
continue;
|
|
128
|
+
const trimmed = key.trim();
|
|
129
|
+
if (trimmed.length === 0 || trimmed.length > MAX_WIRE_REDACT_KEY_LENGTH)
|
|
130
|
+
continue;
|
|
131
|
+
const normalized = trimmed.toLowerCase();
|
|
132
|
+
if (seen.has(normalized))
|
|
133
|
+
continue;
|
|
134
|
+
seen.add(normalized);
|
|
135
|
+
out.push(trimmed);
|
|
136
|
+
if (out.length >= MAX_WIRE_REDACT_KEYS)
|
|
137
|
+
break;
|
|
138
|
+
}
|
|
139
|
+
return out;
|
|
140
|
+
}
|
|
24
141
|
// High-confidence credential SHAPES, redacted regardless of key name — for scanning body/value text where
|
|
25
142
|
// a secret can sit under a benign key (`{"note":"<jwt>"}`, `<meta content="sk_live_…">`). Deliberately
|
|
26
143
|
// narrow (JWT, known provider prefixes) so it never corrupts legitimate prose the way a broad
|
|
@@ -30,4 +147,3 @@ const KNOWN_SECRET = /eyJ[A-Za-z0-9_-]{4,}\.[A-Za-z0-9_-]{4,}\.[A-Za-z0-9_-]{4,}
|
|
|
30
147
|
export function scrubKnownSecrets(text) {
|
|
31
148
|
return text.replace(KNOWN_SECRET, REDACTED_VALUE);
|
|
32
149
|
}
|
|
33
|
-
//# sourceMappingURL=redaction.js.map
|
|
@@ -44,6 +44,15 @@
|
|
|
44
44
|
},
|
|
45
45
|
"hasCapabilities": {
|
|
46
46
|
"type": "boolean"
|
|
47
|
+
},
|
|
48
|
+
"redactKeys": {
|
|
49
|
+
"type": "array",
|
|
50
|
+
"items": {
|
|
51
|
+
"type": "string",
|
|
52
|
+
"minLength": 1,
|
|
53
|
+
"maxLength": 128
|
|
54
|
+
},
|
|
55
|
+
"maxItems": 64
|
|
47
56
|
}
|
|
48
57
|
},
|
|
49
58
|
"required": [
|
|
@@ -163,9 +172,11 @@
|
|
|
163
172
|
"transport.overflow",
|
|
164
173
|
"truncated",
|
|
165
174
|
"blind-spot",
|
|
175
|
+
"sdk.failed",
|
|
166
176
|
"net.detail",
|
|
167
177
|
"human.control",
|
|
168
|
-
"human.mark"
|
|
178
|
+
"human.mark",
|
|
179
|
+
"download"
|
|
169
180
|
]
|
|
170
181
|
},
|
|
171
182
|
"sessionId": {
|