@vellumai/assistant 0.10.11-dev.202607222129.31c06e5 → 0.10.11-dev.202607222226.fdf0e3d
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/ARCHITECTURE.md +30 -21
- package/package.json +1 -1
- package/src/__tests__/channel-delivery-store.test.ts +141 -0
- package/src/__tests__/dynamic-skill-background-guard.test.ts +102 -13
- package/src/__tests__/inline-skill-load-permissions.test.ts +29 -6
- package/src/__tests__/record-persisted-seq-lock-resilience.test.ts +95 -0
- package/src/__tests__/tool-approval-handler.test.ts +25 -1
- package/src/api/events/bookmark-created.ts +37 -0
- package/src/api/events/bookmark-deleted.ts +20 -0
- package/src/api/index.ts +14 -0
- package/src/daemon/message-types/bookmarks.ts +9 -14
- package/src/messaging/providers/telegram-bot/send.test.ts +88 -0
- package/src/messaging/providers/telegram-bot/send.ts +43 -3
- package/src/messaging/providers/telegram-bot/transport.ts +26 -8
- package/src/permissions/checker.ts +18 -21
- package/src/permissions/confirmation-guardian-request.ts +17 -1
- package/src/permissions/prompter.ts +3 -0
- package/src/persistence/conversation-crud.ts +36 -8
- package/src/persistence/delivery-crud.ts +13 -1
- package/src/persistence/external-conversation-store.ts +22 -0
- package/src/runtime/routes/inbound-conversation.ts +19 -3
- package/src/runtime/routes/inbound-message-handler.ts +8 -5
- package/src/tools/permission-checker.ts +42 -9
- package/src/tools/tool-approval-handler.ts +24 -4
|
@@ -228,6 +228,44 @@ export class PermissionChecker {
|
|
|
228
228
|
};
|
|
229
229
|
}
|
|
230
230
|
|
|
231
|
+
// Inline-command ("dynamic") skill loads execute embedded shell at load
|
|
232
|
+
// time. The sensitive-tool gate (tools/tool-approval-handler.ts, lane A)
|
|
233
|
+
// already routes an uncovered one through the guardian-mediated capability
|
|
234
|
+
// floor, so a non-guardian is escalated there and never reaches this lane.
|
|
235
|
+
// The one thing that floor does not express is the absence of a human: an
|
|
236
|
+
// uncovered dynamic load in a non-interactive session is denied here,
|
|
237
|
+
// because embedded shell must never run unattended without a covering rule.
|
|
238
|
+
// (A covering trust rule, matchType "user_rule", is left to proceed.)
|
|
239
|
+
if (
|
|
240
|
+
context.isInteractive === false &&
|
|
241
|
+
isDynamicSkillLoadInvocation(name, input) &&
|
|
242
|
+
getCachedAssessment(name, input)?.matchType !== "user_rule"
|
|
243
|
+
) {
|
|
244
|
+
log.info(
|
|
245
|
+
{ toolName: name, riskLevel },
|
|
246
|
+
"Denying uncovered inline-command skill load in non-interactive session",
|
|
247
|
+
);
|
|
248
|
+
recordToolDenied({
|
|
249
|
+
conversationId: context.conversationId,
|
|
250
|
+
toolName: name,
|
|
251
|
+
input,
|
|
252
|
+
reason:
|
|
253
|
+
"Inline-command skill load requires human approval; no interactive client connected",
|
|
254
|
+
riskLevel,
|
|
255
|
+
durationMs: Date.now() - startTime,
|
|
256
|
+
wasPrompted: false,
|
|
257
|
+
});
|
|
258
|
+
return {
|
|
259
|
+
allowed: false,
|
|
260
|
+
decision: "denied",
|
|
261
|
+
riskLevel,
|
|
262
|
+
content: `Permission denied: tool "${name}" would load a skill containing inline command expansions, which execute shell commands at load time and require explicit human approval. No interactive client is connected. To allow this in non-interactive sessions, add a trust rule covering the skill via permission settings.`,
|
|
263
|
+
riskMeta,
|
|
264
|
+
...mapApprovalProvenance("denied", {}),
|
|
265
|
+
riskThreshold,
|
|
266
|
+
};
|
|
267
|
+
}
|
|
268
|
+
|
|
231
269
|
// Platform-hosted mode: auto-approve sandboxed bash for guardians.
|
|
232
270
|
// The sandbox provides the security boundary — prompting is unnecessary
|
|
233
271
|
// friction. host_bash is excluded because it runs unsandboxed on the
|
|
@@ -261,22 +299,17 @@ export class PermissionChecker {
|
|
|
261
299
|
// is the owner - prompting makes no sense when there is no client.
|
|
262
300
|
// Exception: requireFreshApproval tools cannot be auto-approved -
|
|
263
301
|
// without a human present, bundle installation must be denied.
|
|
264
|
-
//
|
|
265
|
-
//
|
|
266
|
-
//
|
|
267
|
-
// trust rule lowers the classified risk upstream (check() then
|
|
268
|
-
// returns "allow" before this branch), so any dynamic load that
|
|
269
|
-
// reaches this prompt path is uncovered and must stay prompted.
|
|
302
|
+
// Inline-command ("dynamic") skill loads are already denied above for
|
|
303
|
+
// non-interactive sessions (embedded shell with no human to review it),
|
|
304
|
+
// so they never reach this branch uncovered.
|
|
270
305
|
// Exception: tools above the configured background threshold are
|
|
271
306
|
// denied — unattended sessions must not auto-approve operations that
|
|
272
307
|
// could cause significant damage if triggered by prompt injection
|
|
273
308
|
// from untrusted content.
|
|
274
|
-
const isDynamicSkillLoad = isDynamicSkillLoadInvocation(name, input);
|
|
275
309
|
if (
|
|
276
310
|
context.isInteractive === false &&
|
|
277
311
|
resolveCapabilities(context.trustClass).canSelfApproveTools &&
|
|
278
|
-
!context.requireFreshApproval
|
|
279
|
-
!isDynamicSkillLoad
|
|
312
|
+
!context.requireFreshApproval
|
|
280
313
|
) {
|
|
281
314
|
// getAutoApproveThreshold returns from cache (populated by check() above).
|
|
282
315
|
// Deferred inside the non-interactive branch so interactive prompts
|
|
@@ -7,6 +7,7 @@ import { isToolAllowedInChannel } from "../channels/permission-profiles.js";
|
|
|
7
7
|
import type { ChannelId } from "../channels/types.js";
|
|
8
8
|
import { getConfig } from "../config/loader.js";
|
|
9
9
|
import type { AutoApproveThreshold } from "../permissions/approval-policy.js";
|
|
10
|
+
import { isDynamicSkillLoadInvocation } from "../permissions/checker.js";
|
|
10
11
|
import {
|
|
11
12
|
isUnparseableToolArgs,
|
|
12
13
|
unparseableToolArgsMessage,
|
|
@@ -238,13 +239,17 @@ const UI_SURFACE_TOOLS = new Set(["ui_show", "ui_update", "ui_dismiss"]);
|
|
|
238
239
|
|
|
239
240
|
/**
|
|
240
241
|
* Tool-sensitivity predicate: does invoking this tool require an approval
|
|
241
|
-
* decision at all? This is
|
|
242
|
-
*
|
|
243
|
-
* the
|
|
242
|
+
* decision at all? This is about the tool, where it executes, and — for
|
|
243
|
+
* `skill_load` — whether the invocation will execute embedded shell at load
|
|
244
|
+
* time (inline command expansions run outside the tool pipeline, so they must
|
|
245
|
+
* be gated like other code execution). Actor identity never feeds in here; it
|
|
246
|
+
* enters the decision only through the `CapabilitySet` floor, see
|
|
247
|
+
* {@link resolveSensitiveToolDecision}.
|
|
244
248
|
*/
|
|
245
249
|
export function isSensitiveTool(
|
|
246
250
|
toolName: string,
|
|
247
251
|
executionTarget: ExecutionTarget,
|
|
252
|
+
input?: Record<string, unknown>,
|
|
248
253
|
): boolean {
|
|
249
254
|
// UI surface tools are passive, user-visible operations (cards, forms,
|
|
250
255
|
// tables). User input is voluntary and user-controlled — they are not
|
|
@@ -254,6 +259,21 @@ export function isSensitiveTool(
|
|
|
254
259
|
return false;
|
|
255
260
|
}
|
|
256
261
|
|
|
262
|
+
// An inline-command ("dynamic") skill_load executes embedded shell at load
|
|
263
|
+
// time. skill_load is not a side-effect tool, so without this it would skip
|
|
264
|
+
// the capability floor entirely. Routing it through the gate makes a
|
|
265
|
+
// non-guardian's dynamic load escalate to the guardian like any other code
|
|
266
|
+
// execution — the floor is deterministic, so neither Full access nor a
|
|
267
|
+
// covering trust rule lifts it. (The guardian self-approves; the trust-rule
|
|
268
|
+
// escape hatch still applies to the guardian's own load in the risk lane.)
|
|
269
|
+
if (
|
|
270
|
+
toolName === "skill_load" &&
|
|
271
|
+
input &&
|
|
272
|
+
isDynamicSkillLoadInvocation(toolName, input)
|
|
273
|
+
) {
|
|
274
|
+
return true;
|
|
275
|
+
}
|
|
276
|
+
|
|
257
277
|
// Side-effect tools are sensitive. Read-only host execution is too,
|
|
258
278
|
// because it can leak sensitive local information (e.g. shell/file reads).
|
|
259
279
|
return isSideEffectTool(toolName) || executionTarget === "host";
|
|
@@ -486,7 +506,7 @@ export class ToolApprovalHandler {
|
|
|
486
506
|
| Parameters<typeof consumeGrantForInvocation>[0]
|
|
487
507
|
| null = null;
|
|
488
508
|
|
|
489
|
-
const sensitive = isSensitiveTool(name, executionTarget);
|
|
509
|
+
const sensitive = isSensitiveTool(name, executionTarget, input);
|
|
490
510
|
const { sensitiveToolApproval } = resolveCapabilities(context.trustClass);
|
|
491
511
|
// cellThreshold stays unresolved: the decision does not consult it
|
|
492
512
|
// (the floor is deterministic), and resolving a live threshold here
|