@vellumai/assistant 0.10.11-dev.202607231425.01b751a → 0.10.11-dev.202607231636.18b8bbb

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 (82) hide show
  1. package/docs/architecture/security.md +7 -2
  2. package/openapi.yaml +73 -0
  3. package/package.json +1 -1
  4. package/src/__tests__/browser-fill-credential.test.ts +3 -3
  5. package/src/__tests__/config-schema.test.ts +1 -0
  6. package/src/__tests__/credential-broker-browser-fill.test.ts +2 -2
  7. package/src/__tests__/credential-broker-server-use.test.ts +2 -2
  8. package/src/__tests__/credential-broker.test.ts +1 -1
  9. package/src/__tests__/credential-routes.test.ts +167 -0
  10. package/src/__tests__/credential-transcript-scrub.test.ts +550 -0
  11. package/src/__tests__/external-plugin-loader.test.ts +94 -1
  12. package/src/__tests__/log-redact.test.ts +64 -0
  13. package/src/__tests__/plugin-secret-pattern-contribution.test.ts +304 -0
  14. package/src/__tests__/plugin-secret-patterns.test.ts +234 -0
  15. package/src/__tests__/plugin-types.test.ts +3 -0
  16. package/src/__tests__/secret-ingress.test.ts +137 -0
  17. package/src/__tests__/secret-routes-scrub.test.ts +276 -0
  18. package/src/__tests__/secret-scanner.test.ts +85 -1
  19. package/src/acp/__tests__/prepare-agent-env.test.ts +2 -2
  20. package/src/acp/agent-process.ts +1 -1
  21. package/src/acp/prepare-agent-env.ts +6 -4
  22. package/src/api/events/client-settings-update.ts +25 -0
  23. package/src/api/events/config-changed.ts +19 -0
  24. package/src/api/events/document-editor-show.ts +26 -0
  25. package/src/api/events/skill-state-changed.ts +23 -0
  26. package/src/api/events/sounds-config-updated.ts +21 -0
  27. package/src/api/index.ts +30 -0
  28. package/src/calls/call-domain.ts +1 -1
  29. package/src/calls/fish-audio-client.ts +1 -1
  30. package/src/cli/commands/__tests__/credentials.test.ts +216 -0
  31. package/src/cli/commands/__tests__/keys.test.ts +189 -0
  32. package/src/cli/commands/config.help.ts +6 -2
  33. package/src/cli/commands/contacts.ts +1 -9
  34. package/src/cli/commands/credentials.help.ts +14 -1
  35. package/src/cli/commands/credentials.ts +12 -13
  36. package/src/cli/commands/keys.help.ts +16 -1
  37. package/src/cli/commands/keys.ts +37 -12
  38. package/src/cli/commands/oauth/connect.ts +1 -1
  39. package/src/cli/commands/routes-worker.ts +102 -0
  40. package/src/cli/commands/routes.help.ts +49 -0
  41. package/src/cli/commands/routes.ts +6 -1
  42. package/src/cli/output.ts +9 -0
  43. package/src/cli/utils/inline-secret-guard.ts +35 -0
  44. package/src/config/bundled-skills/_shared/CLI_RETRIEVAL_PATTERN.md +1 -1
  45. package/src/config/schemas/security.ts +8 -0
  46. package/src/credential-execution/prompted-credential.ts +24 -0
  47. package/src/daemon/chat-credential-redaction.ts +36 -13
  48. package/src/daemon/conversation-registry.ts +14 -2
  49. package/src/daemon/credential-transcript-scrub.ts +482 -0
  50. package/src/daemon/external-plugins-bootstrap.ts +13 -0
  51. package/src/daemon/message-protocol.ts +4 -16
  52. package/src/daemon/message-types/documents.ts +10 -79
  53. package/src/daemon/message-types/settings.ts +11 -55
  54. package/src/daemon/message-types/skills.ts +8 -148
  55. package/src/persistence/message-content-file.ts +25 -15
  56. package/src/plugins/defaults/main.ts +30 -14
  57. package/src/plugins/external-plugin-loader.ts +73 -3
  58. package/src/plugins/mtime-cache.ts +75 -4
  59. package/src/plugins/types.ts +21 -0
  60. package/src/prompts/templates/system-sections.ts +3 -1
  61. package/src/providers/connection-resolution.ts +7 -86
  62. package/src/providers/routing-identity.ts +99 -0
  63. package/src/routes/control.ts +82 -0
  64. package/src/runtime/routes/__tests__/default-plugin-routes.test.ts +41 -71
  65. package/src/runtime/routes/__tests__/route-host-worker-routes.test.ts +121 -0
  66. package/src/runtime/routes/credential-routes.ts +33 -0
  67. package/src/runtime/routes/index.ts +2 -0
  68. package/src/runtime/routes/oauth-connect-routes.ts +1 -1
  69. package/src/runtime/routes/route-host-worker-routes.ts +144 -0
  70. package/src/runtime/routes/secret-routes.ts +45 -0
  71. package/src/runtime/routes/user-route-resolution.ts +19 -44
  72. package/src/security/plugin-secret-patterns.ts +465 -0
  73. package/src/security/secret-ingress.ts +93 -6
  74. package/src/security/secret-scanner.ts +38 -7
  75. package/src/tools/browser/browser-execution.ts +2 -2
  76. package/src/tools/credentials/broker.ts +48 -24
  77. package/src/tts/providers/deepgram-provider.ts +4 -2
  78. package/src/tts/providers/elevenlabs-provider.ts +2 -2
  79. package/src/tts/providers/fish-audio-provider.ts +1 -1
  80. package/src/tts/providers/xai-provider.ts +2 -2
  81. package/src/usage/attribution.ts +1 -1
  82. package/src/util/log-redact.ts +16 -4
@@ -276,13 +276,17 @@ The `allowOneTimeSend` config gate (default: `false`) enables a secondary "Send
276
276
  - The credentials prompt route output confirms delivery without including the secret value — the value is never returned to the model
277
277
  - The config gate must be explicitly enabled by the operator
278
278
 
279
+ ### Ingress Secret Detection
280
+
281
+ User messages are scanned at ingress (`secret-ingress.ts`) against known credential prefix patterns plus any plugin-declared patterns: plugins can declare `credentialKeyPatterns` in their manifest, and those patterns feed ingress blocking, display-time secret scanning (`secret-scanner.ts`), and log redaction (`log-redact.ts`) while the plugin is active. In addition, when `secretDetection.blockTokenShapedMessages` is enabled (default: `true`), a whole-message heuristic blocks messages whose entire trimmed content is a single token-shaped value — an alphanumeric head, a secret-keyword infix (`token`, `key`, `secret`, …), and a long random tail — catching pasted credentials whose prefix is not a known format while keeping false positives near zero.
282
+
279
283
  ### Storage Layout
280
284
 
281
285
  | Component | Location | What it stores |
282
286
  | ------------------- | ------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------- |
283
287
  | Secret values | CES credential store or encrypted file store | Encrypted credential values keyed as `credential/{service}/{field}`. Stored via CES RPC (primary), CES HTTP (containerized), or encrypted file store (fallback). |
284
288
  | Credential metadata | `$VELLUM_WORKSPACE_DIR/data/credentials/metadata.json` | Service, field, label, policy (allowedTools, allowedDomains), timestamps |
285
- | Config | `$VELLUM_WORKSPACE_DIR/config.*` | `secretDetection` settings: enabled, blockIngress, allowOneTimeSend |
289
+ | Config | `$VELLUM_WORKSPACE_DIR/config.*` | `secretDetection` settings: enabled, blockIngress, allowOneTimeSend, blockTokenShapedMessages (default `true` — whole-message token-shape heuristic) |
286
290
 
287
291
  ### Key Files
288
292
 
@@ -296,7 +300,8 @@ The `allowOneTimeSend` config gate (default: `false`) enables a secondary "Send
296
300
  | `assistant/src/tools/credentials/policy-validate.ts` | Policy input validation (allowedTools, allowedDomains) |
297
301
  | `assistant/src/permissions/secret-prompter.ts` | HTTP secret_request/secret_response flow |
298
302
  | `assistant/src/security/secret-scanner.ts` | Prefix + shape-based secret regex detection (used by display-time `redactSecrets`) |
299
- | `assistant/src/security/secret-ingress.ts` | Prefix-only ingress check on user messages |
303
+ | `assistant/src/security/secret-ingress.ts` | Ingress check on user messages: prefix + plugin patterns + token-shape heuristic |
304
+ | `assistant/src/security/plugin-secret-patterns.ts` | Registry of plugin-declared `credentialKeyPatterns` feeding detection/redaction |
300
305
  | `assistant/src/util/log-redact.ts` | Pino log serializers — prefix-based redaction for logs |
301
306
  | `clients/web/src/domains/chat/components/secret-prompt-card.tsx` | UI for secure credential entry |
302
307
 
package/openapi.yaml CHANGED
@@ -24318,6 +24318,79 @@ paths:
24318
24318
  - runs
24319
24319
  - nextCursor
24320
24320
  additionalProperties: false
24321
+ /v1/routes/worker/start:
24322
+ post:
24323
+ operationId: routes_worker_start_post
24324
+ summary: Start the route host
24325
+ description: Spawns (or reuses) the route host process as a child of the daemon.
24326
+ tags:
24327
+ - system
24328
+ responses:
24329
+ "200":
24330
+ description: Successful response
24331
+ content:
24332
+ application/json:
24333
+ schema:
24334
+ type: object
24335
+ properties:
24336
+ pid:
24337
+ type: number
24338
+ alreadyRunning:
24339
+ type: boolean
24340
+ pidPath:
24341
+ type: string
24342
+ required:
24343
+ - pid
24344
+ - alreadyRunning
24345
+ - pidPath
24346
+ additionalProperties: false
24347
+ /v1/routes/worker/status:
24348
+ get:
24349
+ operationId: routes_worker_status_get
24350
+ summary: Route host status
24351
+ description: Reports the route host process liveness.
24352
+ tags:
24353
+ - system
24354
+ responses:
24355
+ "200":
24356
+ description: Successful response
24357
+ content:
24358
+ application/json:
24359
+ schema:
24360
+ type: object
24361
+ properties:
24362
+ status:
24363
+ type: string
24364
+ enum:
24365
+ - running
24366
+ - not_running
24367
+ pid:
24368
+ type: number
24369
+ required:
24370
+ - status
24371
+ additionalProperties: false
24372
+ /v1/routes/worker/stop:
24373
+ post:
24374
+ operationId: routes_worker_stop_post
24375
+ summary: Stop the route host
24376
+ description: SIGTERMs the route host process if it is running; the next request respawns it.
24377
+ tags:
24378
+ - system
24379
+ responses:
24380
+ "200":
24381
+ description: Successful response
24382
+ content:
24383
+ application/json:
24384
+ schema:
24385
+ type: object
24386
+ properties:
24387
+ workerWasRunning:
24388
+ type: boolean
24389
+ pid:
24390
+ type: number
24391
+ required:
24392
+ - workerWasRunning
24393
+ additionalProperties: false
24321
24394
  /v1/sanity/connect:
24322
24395
  post:
24323
24396
  operationId: sanity_connect_post
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vellumai/assistant",
3
- "version": "0.10.11-dev.202607231425.01b751a",
3
+ "version": "0.10.11-dev.202607231636.18b8bbb",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "exports": {
@@ -312,7 +312,7 @@ describe("executeBrowserFillCredential", () => {
312
312
  );
313
313
  expect(result.isError).toBe(true);
314
314
  expect(result.content).toContain("No credential stored for slack/api_key");
315
- expect(result.content).toContain("assistant credentials set");
315
+ expect(result.content).toContain("assistant credentials prompt");
316
316
  // The broker short-circuits before DOM.focus is dispatched.
317
317
  const methods = sendCalls.map((c) => c.method);
318
318
  expect(methods).not.toContain("DOM.focus");
@@ -328,7 +328,7 @@ describe("executeBrowserFillCredential", () => {
328
328
  );
329
329
  expect(result.isError).toBe(true);
330
330
  expect(result.content).toContain("No credential stored for slack/api_key");
331
- expect(result.content).toContain("assistant credentials set");
331
+ expect(result.content).toContain("assistant credentials prompt");
332
332
  const methods = sendCalls.map((c) => c.method);
333
333
  expect(methods).not.toContain("Input.insertText");
334
334
  });
@@ -458,7 +458,7 @@ describe("executeBrowserFillCredential", () => {
458
458
  expect(result.isError).toBe(true);
459
459
  expect(result.content).toContain("Policy denied");
460
460
  expect(result.content).toContain("not allowed to use credential");
461
- expect(result.content).toContain("assistant credentials set");
461
+ expect(result.content).toContain("assistant credentials prompt");
462
462
  // The broker short-circuits before Input.insertText fires.
463
463
  const methods = sendCalls.map((c) => c.method);
464
464
  expect(methods).not.toContain("Input.insertText");
@@ -94,6 +94,7 @@ describe("AssistantConfigSchema", () => {
94
94
  enabled: true,
95
95
  blockIngress: true,
96
96
  allowOneTimeSend: false,
97
+ blockTokenShapedMessages: true,
97
98
  });
98
99
  expect(result.auditLog).toEqual({ retentionDays: 0 });
99
100
  });
@@ -452,7 +452,7 @@ describe("CredentialBroker.browserFill", () => {
452
452
  expect(result.reason).toContain("not allowed");
453
453
  });
454
454
 
455
- test("denies with empty allowedTools and suggests assistant credentials set", async () => {
455
+ test("denies with empty allowedTools and suggests assistant credentials prompt", async () => {
456
456
  upsertCredentialMetadata("custom", "key", {
457
457
  allowedTools: [],
458
458
  });
@@ -469,7 +469,7 @@ describe("CredentialBroker.browserFill", () => {
469
469
 
470
470
  expect(result.success).toBe(false);
471
471
  expect(result.reason).toContain("No tools are currently allowed");
472
- expect(result.reason).toContain("assistant credentials set");
472
+ expect(result.reason).toContain("assistant credentials prompt");
473
473
  });
474
474
  });
475
475
 
@@ -296,7 +296,7 @@ describe("CredentialBroker.serverUse", () => {
296
296
 
297
297
  expect(result.success).toBe(false);
298
298
  expect(result.reason).toContain("No tools are currently allowed");
299
- expect(result.reason).toContain("assistant credentials set");
299
+ expect(result.reason).toContain("assistant credentials prompt");
300
300
  });
301
301
 
302
302
  test("denies when credential has domain restrictions even if tool matches", async () => {
@@ -585,7 +585,7 @@ describe("CredentialBroker.serverUseById", () => {
585
585
  expect(result.success).toBe(false);
586
586
  if (result.success) throw new Error("expected denial");
587
587
  expect(result.reason).toContain("No tools are currently allowed");
588
- expect(result.reason).toContain("assistant credentials set");
588
+ expect(result.reason).toContain("assistant credentials prompt");
589
589
  });
590
590
 
591
591
  test("denies when metadata exists but no stored secret value", async () => {
@@ -95,7 +95,7 @@ describe("CredentialBroker", () => {
95
95
  if (!result.authorized) {
96
96
  expect(result.reason).toContain("not allowed");
97
97
  expect(result.reason).toContain("No tools are currently allowed");
98
- expect(result.reason).toContain("assistant credentials set");
98
+ expect(result.reason).toContain("assistant credentials prompt");
99
99
  }
100
100
  });
101
101
 
@@ -10,8 +10,11 @@ import type { CredentialMetadata } from "../tools/credentials/metadata-store.js"
10
10
  let secureStore: Map<string, string>;
11
11
  let metadataStore: Map<string, CredentialMetadata>;
12
12
  let syncedServices: string[];
13
+ let syncRejects: boolean;
13
14
  let disconnectedProviders: string[];
14
15
  let credentialIdCounter: number;
16
+ let scrubbedValues: string[];
17
+ let scrubRejects: boolean;
15
18
 
16
19
  function metaKey(service: string, field: string): string {
17
20
  return `${service}:${field}`;
@@ -100,6 +103,9 @@ mock.module("../tools/credentials/metadata-store.js", () => ({
100
103
 
101
104
  mock.module("../oauth/manual-token-connection.js", () => ({
102
105
  syncManualTokenConnection: mock(async (service: string) => {
106
+ if (syncRejects) {
107
+ throw new Error("simulated oauth-store failure");
108
+ }
103
109
  syncedServices.push(service);
104
110
  }),
105
111
  }));
@@ -117,6 +123,16 @@ mock.module("../credential-execution/managed-catalog.js", () => ({
117
123
  fetchManagedCatalog: mock(async () => ({ ok: true, descriptors: [] })),
118
124
  }));
119
125
 
126
+ mock.module("../daemon/credential-transcript-scrub.js", () => ({
127
+ scrubStoredCredentialFromTranscripts: mock(async (value: string) => {
128
+ scrubbedValues.push(value);
129
+ if (scrubRejects) {
130
+ throw new Error("transcript sweep failed");
131
+ }
132
+ return { dbMessagesScrubbed: 0, residentMessagesScrubbed: 0 };
133
+ }),
134
+ }));
135
+
120
136
  // Stub the prompted-credential persist path's Slack + broker collaborators so
121
137
  // importing it exercises the ACP guard without loading their real dep chains.
122
138
  mock.module("../daemon/handlers/config-slack-channel.js", () => ({
@@ -166,8 +182,11 @@ describe("credentials routes", () => {
166
182
  secureStore = new Map();
167
183
  metadataStore = new Map();
168
184
  syncedServices = [];
185
+ syncRejects = false;
169
186
  disconnectedProviders = [];
170
187
  credentialIdCounter = 0;
188
+ scrubbedValues = [];
189
+ scrubRejects = false;
171
190
  _resetRevealSuccessRegistryForTest();
172
191
  resetForChatMintRegistryForTest();
173
192
  chatCredentialRevealFlag = false;
@@ -488,6 +507,123 @@ describe("credentials routes", () => {
488
507
  );
489
508
  });
490
509
 
510
+ test("a successful set scrubs the normalized value from transcripts exactly once", async () => {
511
+ /**
512
+ * The pasted plaintext may already sit in recent transcripts, so a
513
+ * successful store triggers one retroactive scrub — with the
514
+ * normalized (edge-trimmed) value that was actually persisted, not
515
+ * the raw paste.
516
+ */
517
+ // WHEN a credential is stored with paste-artifact edge whitespace
518
+ await setRoute!.handler({
519
+ body: {
520
+ service: "vercel",
521
+ field: "api_token",
522
+ value: ` ${SECRET_VALUE}\n`,
523
+ },
524
+ });
525
+
526
+ // THEN the transcript scrub runs exactly once with the stored value
527
+ expect(scrubbedValues).toEqual([SECRET_VALUE]);
528
+ });
529
+
530
+ test("a validation-rejected set never triggers a transcript scrub", async () => {
531
+ /**
532
+ * Nothing was stored, so there is nothing to scrub — neither the
533
+ * whitespace-only value guard nor the ACP token-format guard may
534
+ * reach the scrub.
535
+ */
536
+ // WHEN a whitespace-only value is rejected by normalization
537
+ await expect(
538
+ setRoute!.handler({
539
+ body: { service: "vercel", field: "api_token", value: " " },
540
+ }),
541
+ ).rejects.toBeInstanceOf(BadRequestError);
542
+
543
+ // AND an Anthropic API key is rejected by the ACP format guard
544
+ await expect(
545
+ setRoute!.handler({
546
+ body: {
547
+ service: "acp",
548
+ field: "claude_oauth_token",
549
+ value: "sk-ant-api03-not-an-oauth-token",
550
+ },
551
+ }),
552
+ ).rejects.toBeInstanceOf(BadRequestError);
553
+
554
+ // THEN the scrub never runs
555
+ expect(scrubbedValues).toEqual([]);
556
+ });
557
+
558
+ test("the scrub still runs when the post-store connection sync throws", async () => {
559
+ /**
560
+ * `syncManualTokenConnection` performs oauth-store work that can
561
+ * throw. The secret is already in secure storage at that point, so
562
+ * the transcript scrub must have run BEFORE the failing side effect
563
+ * — a stored secret whose plaintext lingers in transcripts is the
564
+ * leak this seam exists to close.
565
+ */
566
+ // GIVEN a connection sync that throws after the store
567
+ syncRejects = true;
568
+
569
+ // WHEN the set is attempted
570
+ await expect(
571
+ setRoute!.handler({
572
+ body: { service: "vercel", field: "api_token", value: SECRET_VALUE },
573
+ }),
574
+ ).rejects.toThrow("simulated oauth-store failure");
575
+
576
+ // THEN the secret was stored and the scrub ran despite the failure
577
+ expect(secureStore.get("vercel:api_token")).toBe(SECRET_VALUE);
578
+ expect(scrubbedValues).toEqual([SECRET_VALUE]);
579
+ });
580
+
581
+ test("non-secret vellum platform fields are stored but never scrubbed", async () => {
582
+ /**
583
+ * Platform identity ids and the base URL are benign UUIDs/URLs that
584
+ * legitimately appear in transcripts; scrubbing them would redact
585
+ * ordinary conversation content. Shares the exemption with the
586
+ * /v1/secrets credential branch via isNonSecretPlatformField.
587
+ */
588
+ for (const field of [
589
+ "platform_assistant_id",
590
+ "platform_organization_id",
591
+ "platform_user_id",
592
+ "platform_base_url",
593
+ ]) {
594
+ const result = (await setRoute!.handler({
595
+ body: {
596
+ service: "vellum",
597
+ field,
598
+ value: "0198f4c2-1111-2222-3333-444455556666",
599
+ },
600
+ })) as SetResponse;
601
+ expect(result.service).toBe("vellum");
602
+ }
603
+
604
+ expect(scrubbedValues).toEqual([]);
605
+ });
606
+
607
+ test("the set still succeeds when the transcript scrub rejects", async () => {
608
+ /**
609
+ * The scrub is post-store hygiene: the credential IS stored, so a
610
+ * scrub failure is logged and must stay invisible to the caller.
611
+ */
612
+ // GIVEN a scrub that rejects
613
+ scrubRejects = true;
614
+
615
+ // WHEN a credential is stored
616
+ const result = (await setRoute!.handler({
617
+ body: { service: "vercel", field: "api_token", value: SECRET_VALUE },
618
+ })) as SetResponse;
619
+
620
+ // THEN the route still returns success and the secret is persisted
621
+ expect(result.service).toBe("vercel");
622
+ expect(result.credentialId).toBe("cred-1");
623
+ expect(secureStore.get("vercel:api_token")).toBe(SECRET_VALUE);
624
+ expect(scrubbedValues).toEqual([SECRET_VALUE]);
625
+ });
626
+
491
627
  test("leaves a non-ACP service unaffected by the OAuth-field guard", async () => {
492
628
  /**
493
629
  * The guard is scoped to the ACP service; the same field name on another
@@ -544,6 +680,37 @@ describe("credentials routes", () => {
544
680
  "sk-ant-oat01-a-real-oauth-token",
545
681
  );
546
682
  });
683
+
684
+ test("a stored prompted credential scrubs recent transcripts", async () => {
685
+ /**
686
+ * The prompt flow is routinely used to RE-collect a secret the user
687
+ * already pasted into chat; the 06 rail promises the pasted message
688
+ * is scrubbed after storage, so the store path must run the scrub.
689
+ */
690
+ const result = await persistPromptedCredential({
691
+ service: "vercel",
692
+ field: "api_token",
693
+ value: SECRET_VALUE,
694
+ delivery: "store",
695
+ policy: {},
696
+ });
697
+
698
+ expect(result.outcome).toBe("stored");
699
+ expect(scrubbedValues).toEqual([SECRET_VALUE]);
700
+ });
701
+
702
+ test("a rejected prompted credential never scrubs", async () => {
703
+ const result = await persistPromptedCredential({
704
+ service: "acp",
705
+ field: "claude_oauth_token",
706
+ value: "sk-ant-api03-not-an-oauth-token",
707
+ delivery: "store",
708
+ policy: {},
709
+ });
710
+
711
+ expect(result.outcome).toBe("error");
712
+ expect(scrubbedValues).toEqual([]);
713
+ });
547
714
  });
548
715
 
549
716
  describe("credentials_list", () => {