@lobu/runtime-device 21.2.1 → 22.0.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/component.json +1 -1
- package/dist/dependencies.bun.lock +91 -83
- package/npm-shrinkwrap.json +492 -438
- package/package.json +12 -2
- package/vendor/cli/dist/commands/_lib/apply/apply-cmd.js +5 -6
- package/vendor/cli/dist/commands/_lib/apply/client.d.ts +1 -0
- package/vendor/cli/dist/commands/_lib/apply/client.js +26 -7
- package/vendor/cli/dist/commands/_lib/apply/desired-state.d.ts +9 -1
- package/vendor/cli/dist/commands/_lib/apply/diff.d.ts +1 -0
- package/vendor/cli/dist/commands/_lib/apply/diff.js +46 -4
- package/vendor/cli/dist/commands/_lib/apply/map-config.js +18 -38
- package/vendor/cli/dist/commands/_lib/init-from-org/bootstrap.js +5 -17
- package/vendor/cli/dist/commands/init.d.ts +0 -2
- package/vendor/cli/dist/commands/init.js +0 -27
- package/vendor/cli/dist/commands/login.d.ts +17 -0
- package/vendor/cli/dist/commands/login.js +43 -17
- package/vendor/cli/dist/commands/memory/_lib/errors.d.ts +0 -8
- package/vendor/cli/dist/commands/memory/_lib/errors.js +0 -12
- package/vendor/cli/dist/commands/memory/_lib/mcp.js +6 -6
- package/vendor/cli/dist/commands/memory/_lib/seed-cmd.js +4 -10
- package/vendor/cli/dist/config/define.d.ts +21 -15
- package/vendor/cli/dist/config/define.js +2 -2
- package/vendor/cli/dist/connectors/README.md +7 -5
- package/vendor/cli/dist/connectors/_google/actions.ts +270 -0
- package/vendor/cli/dist/connectors/_google/discovery/calendar_v3.json +1 -0
- package/vendor/cli/dist/connectors/_google/discovery/chat_v1.json +1 -0
- package/vendor/cli/dist/connectors/_google/discovery/docs_v1.json +1 -0
- package/vendor/cli/dist/connectors/_google/discovery/drive_v3.json +1 -0
- package/vendor/cli/dist/connectors/_google/discovery/gmail_v1.json +1 -0
- package/vendor/cli/dist/connectors/_google/discovery/people_v1.json +1 -0
- package/vendor/cli/dist/connectors/_google/discovery/sheets_v4.json +1 -0
- package/vendor/cli/dist/connectors/_google/discovery/tasks_v1.json +1 -0
- package/vendor/cli/dist/connectors/_google/discovery/youtube_v3.json +1 -0
- package/vendor/cli/dist/connectors/_google/discovery.ts +442 -0
- package/vendor/cli/dist/connectors/_google/errors.ts +91 -0
- package/vendor/cli/dist/connectors/_google/list-feed.ts +223 -0
- package/vendor/cli/dist/connectors/_google/policies.ts +127 -0
- package/vendor/cli/dist/connectors/agentid.ts +43 -0
- package/vendor/cli/dist/connectors/chat-user-identity.ts +2 -1
- package/vendor/cli/dist/connectors/github-automation-events.ts +9 -0
- package/vendor/cli/dist/connectors/github-identity.ts +28 -3
- package/vendor/cli/dist/connectors/github.ts +101 -59
- package/vendor/cli/dist/connectors/google_calendar.ts +207 -719
- package/vendor/cli/dist/connectors/google_drive.ts +16 -2
- package/vendor/cli/dist/connectors/google_gmail.ts +51 -33
- package/vendor/cli/dist/connectors/herdr.ts +406 -0
- package/vendor/cli/dist/connectors/jira.ts +6 -6
- package/vendor/cli/dist/connectors/linear.ts +7 -4
- package/vendor/cli/dist/connectors/postgres.ts +27 -2
- package/vendor/cli/dist/connectors/tiktok-inbox-page.js +230 -0
- package/vendor/cli/dist/connectors/tiktok-web-page.js +211 -0
- package/vendor/cli/dist/connectors/tiktok_web.ts +286 -0
- package/vendor/cli/dist/connectors/whatsapp-web-adapter.js +228 -10
- package/vendor/cli/dist/connectors/whatsapp-web-helpers.ts +47 -14
- package/vendor/cli/dist/connectors/whatsapp-web-identity.ts +121 -0
- package/vendor/cli/dist/connectors/whatsapp_web.ts +170 -29
- package/vendor/cli/dist/connectors/x.ts +276 -136
- package/vendor/cli/dist/index.js +1 -37
- package/vendor/cli/dist/internal/context.d.ts +10 -0
- package/vendor/cli/dist/internal/context.js +26 -16
- package/vendor/cli/dist/internal/node-version.d.ts +1 -1
- package/vendor/cli/dist/internal/node-version.js +1 -1
- package/vendor/cli/dist/internal/oauth.d.ts +3 -1
- package/vendor/cli/dist/internal/oauth.js +4 -3
- package/vendor/cli/dist/internal/runtime-components.d.ts +9 -0
- package/vendor/cli/dist/internal/runtime-components.js +67 -2
- package/vendor/cli/dist/mac-auth.js +17 -1
- package/vendor/cli/dist/providers.json +1 -1
- package/vendor/cli/dist/runtime-components.json +4 -4
- package/vendor/cli/dist/templates/AGENTS.md.tmpl +11 -4
- package/vendor/cli/dist/templates/README.md.tmpl +1 -1
- package/vendor/cli/dist/vendor/ora/.bun-tag-fde20e9a6df212fa +0 -0
- package/vendor/cli/dist/vendor/ora/index.d.ts +332 -0
- package/vendor/cli/dist/vendor/ora/index.js +424 -0
- package/vendor/cli/dist/vendor/ora/license +9 -0
- package/vendor/cli/dist/vendor/ora/package.json +64 -0
- package/vendor/cli/dist/vendor/ora/readme.md +329 -0
- package/vendor/cli/package.json +2 -2
- package/vendor/connector-sdk/dist/browser-requirement.d.ts +36 -0
- package/vendor/connector-sdk/dist/browser-requirement.js +60 -0
- package/vendor/connector-sdk/dist/connector-runtime.d.ts +3 -1
- package/vendor/connector-sdk/dist/connector-runtime.js +10 -0
- package/vendor/connector-sdk/dist/connector-types.d.ts +159 -45
- package/vendor/connector-sdk/dist/define-connector.d.ts +4 -2
- package/vendor/connector-sdk/dist/define-connector.js +3 -0
- package/vendor/connector-sdk/dist/index.d.ts +5 -2
- package/vendor/connector-sdk/dist/index.js +1 -0
- package/vendor/connector-sdk/dist/reaction-client-types.d.ts +16 -21
- package/vendor/connector-sdk/dist/reaction-client-types.typecheck.d.ts +5 -0
- package/vendor/connector-sdk/package.json +5 -1
- package/vendor/connector-worker/dist/agent-turn/guest-entry.js +31 -27
- package/vendor/connector-worker/dist/agent-turn/guest.bundle.js +131 -185
- package/vendor/connector-worker/dist/agent-turn/memory.d.ts +3 -2
- package/vendor/connector-worker/dist/agent-turn/memory.js +3 -20
- package/vendor/connector-worker/dist/agent-turn/types.d.ts +3 -15
- package/vendor/connector-worker/dist/agent-turn/workspace.d.ts +2 -2
- package/vendor/connector-worker/dist/agent-turn/workspace.js +2 -4
- package/vendor/connector-worker/dist/daemon/action-monitor.d.ts +12 -0
- package/vendor/connector-worker/dist/daemon/action-monitor.js +25 -0
- package/vendor/connector-worker/dist/daemon/agent-turn.js +0 -9
- package/vendor/connector-worker/dist/daemon/builtins/index.d.ts +12 -0
- package/vendor/connector-worker/dist/daemon/builtins/index.js +61 -1
- package/vendor/connector-worker/dist/daemon/builtins/os-shell.d.ts +2 -1
- package/vendor/connector-worker/dist/daemon/builtins/os-shell.js +40 -27
- package/vendor/connector-worker/dist/daemon/client.d.ts +5 -1
- package/vendor/connector-worker/dist/daemon/client.js +3 -0
- package/vendor/connector-worker/dist/daemon/device-concurrency.d.ts +8 -0
- package/vendor/connector-worker/dist/daemon/device-concurrency.js +13 -0
- package/vendor/connector-worker/dist/daemon/executor.d.ts +1 -1
- package/vendor/connector-worker/dist/daemon/executor.js +48 -117
- package/vendor/connector-worker/dist/daemon/log.d.ts +2 -0
- package/vendor/connector-worker/dist/daemon/log.js +23 -2
- package/vendor/connector-worker/dist/daemon/mac-device-daemon.d.ts +20 -4
- package/vendor/connector-worker/dist/daemon/mac-device-daemon.js +53 -13
- package/vendor/connector-worker/dist/daemon/native-bridge/client.d.ts +6 -0
- package/vendor/connector-worker/dist/daemon/native-bridge/client.js +15 -0
- package/vendor/connector-worker/dist/daemon/native-bridge/executor.js +2 -0
- package/vendor/connector-worker/dist/daemon/native-bridge/protocol.d.ts +1 -1
- package/vendor/connector-worker/dist/daemon/native-bridge/protocol.js +1 -0
- package/vendor/connector-worker/dist/daemon/poll-loop.d.ts +3 -0
- package/vendor/connector-worker/dist/daemon/poll-loop.js +5 -1
- package/vendor/connector-worker/dist/daemon/start.d.ts +1 -0
- package/vendor/connector-worker/dist/daemon/start.js +12 -5
- package/vendor/connector-worker/dist/executor/interface.d.ts +34 -2
- package/vendor/connector-worker/dist/executor/isolate.js +66 -15
- package/vendor/connector-worker/dist/executor/redact.d.ts +1 -0
- package/vendor/connector-worker/dist/executor/redact.js +97 -26
- package/vendor/connector-worker/dist/executor/runtime.d.ts +7 -0
- package/vendor/connector-worker/dist/executor/runtime.js +26 -0
- package/vendor/connector-worker/dist/isolate/bridge.js +3 -1
- package/vendor/connector-worker/dist/mac-device-daemon.js +10 -3
- package/vendor/connector-worker/package.json +2 -2
- package/vendor/core/dist/agent-policy.js +1 -1
- package/vendor/core/dist/agent-store.d.ts +2 -0
- package/vendor/core/dist/agent-tooling.d.ts +1 -1
- package/vendor/core/dist/agent-tooling.js +1 -1
- package/vendor/core/dist/capabilities.js +2 -0
- package/vendor/core/dist/contracts/agent-settings.d.ts +0 -11
- package/vendor/core/dist/contracts/agent-settings.js +1 -7
- package/vendor/core/dist/contracts/tools/collection-presentation.d.ts +93 -0
- package/vendor/core/dist/contracts/tools/collection-presentation.js +88 -0
- package/vendor/core/dist/contracts/tools/collection-selection.d.ts +47 -0
- package/vendor/core/dist/contracts/tools/collection-selection.js +74 -0
- package/vendor/core/dist/contracts/tools/manage-agents.d.ts +10 -4
- package/vendor/core/dist/contracts/tools/manage-auth-profiles.d.ts +1 -1
- package/vendor/core/dist/contracts/tools/manage-auth-profiles.js +5 -1
- package/vendor/core/dist/contracts/tools/manage-automations.d.ts +19 -4
- package/vendor/core/dist/contracts/tools/manage-automations.js +25 -8
- package/vendor/core/dist/contracts/tools/manage-connections.d.ts +1 -0
- package/vendor/core/dist/contracts/tools/manage-connections.js +3 -0
- package/vendor/core/dist/contracts/tools/manage-entity-schema.d.ts +11 -0
- package/vendor/core/dist/contracts/tools/manage-entity-schema.js +42 -3
- package/vendor/core/dist/contracts/tools/manage-entity.d.ts +181 -152
- package/vendor/core/dist/contracts/tools/manage-entity.js +118 -162
- package/vendor/core/dist/contracts/tools/manage-operations.d.ts +41 -3
- package/vendor/core/dist/contracts/tools/manage-operations.js +40 -2
- package/vendor/core/dist/contracts/tools/manage-views.d.ts +182 -7
- package/vendor/core/dist/contracts/tools/manage-views.js +49 -13
- package/vendor/core/dist/contracts/tools/read-knowledge.d.ts +11 -2
- package/vendor/core/dist/contracts/tools/read-knowledge.js +23 -3
- package/vendor/core/dist/contracts/tools/save-memory.d.ts +3 -6
- package/vendor/core/dist/contracts/tools/save-memory.js +2 -6
- package/vendor/core/dist/contracts/tools/view-attach.d.ts +2 -1
- package/vendor/core/dist/contracts/tools/view-attach.js +7 -2
- package/vendor/core/dist/contracts/worker/protocol.d.ts +122 -28
- package/vendor/core/dist/contracts/worker/protocol.js +81 -17
- package/vendor/core/dist/index.d.ts +3 -4
- package/vendor/core/dist/index.js +3 -6
- package/vendor/core/dist/json-template.d.ts +6 -10
- package/vendor/core/dist/json-template.js +5 -9
- package/vendor/core/dist/logger.js +11 -5
- package/vendor/core/dist/shell-safety.d.ts +9 -0
- package/vendor/core/dist/shell-safety.js +154 -0
- package/vendor/core/dist/suggestions.d.ts +1 -1
- package/vendor/core/dist/suggestions.js +1 -1
- package/vendor/core/dist/tool-trace-summary.d.ts +1 -1
- package/vendor/core/dist/tool-trace-summary.js +1 -1
- package/vendor/core/dist/types.d.ts +1 -3
- package/vendor/core/dist/utils/diagnostic-scrubber.d.ts +7 -0
- package/vendor/core/dist/utils/{sentry-scrubber.js → diagnostic-scrubber.js} +25 -53
- package/vendor/core/dist/worker/auth.d.ts +44 -6
- package/vendor/core/dist/worker/auth.js +44 -11
- package/vendor/core/package.json +15 -6
- package/vendor/ora/.bun-tag-fde20e9a6df212fa +0 -0
- package/vendor/ora/index.d.ts +332 -0
- package/vendor/ora/index.js +424 -0
- package/vendor/ora/license +9 -0
- package/vendor/ora/package.json +53 -0
- package/vendor/ora/readme.md +329 -0
- package/vendor/cli/dist/commands/telemetry.d.ts +0 -10
- package/vendor/cli/dist/commands/telemetry.js +0 -66
- package/vendor/core/dist/sentry.d.ts +0 -26
- package/vendor/core/dist/sentry.js +0 -133
- package/vendor/core/dist/tool-policy.d.ts +0 -74
- package/vendor/core/dist/tool-policy.js +0 -305
- package/vendor/core/dist/utils/sentry-scrubber.d.ts +0 -29
|
@@ -1,305 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Per-agent tool policy: which tools an agent may use, and the bash
|
|
4
|
-
* prefix allow/deny lists derived from the same patterns.
|
|
5
|
-
*
|
|
6
|
-
* Shared by every lane that assembles an agent's tool list or runs its shell —
|
|
7
|
-
* the agent worker, the gateway producer that hands an isolate turn its tools,
|
|
8
|
-
* and the isolate guest that runs the turn's bash — so one agent gets one
|
|
9
|
-
* answer whichever lane runs the turn. Everything here is pure: the isolate
|
|
10
|
-
* guest imports this module by its own subpath (`@lobu/core/tool-policy`),
|
|
11
|
-
* so it must never grow a Node import or a root `@lobu/core` import.
|
|
12
|
-
*/
|
|
13
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
-
exports.DEFAULT_PACKAGE_MANAGER_DENY_PREFIXES = void 0;
|
|
15
|
-
exports.normalizeToolList = normalizeToolList;
|
|
16
|
-
exports.buildToolPolicy = buildToolPolicy;
|
|
17
|
-
exports.isToolAllowedByPolicy = isToolAllowedByPolicy;
|
|
18
|
-
exports.isDirectPackageInstallCommand = isDirectPackageInstallCommand;
|
|
19
|
-
exports.enforceBashCommandPolicy = enforceBashCommandPolicy;
|
|
20
|
-
const bash_command_parser_1 = require("./bash-command-parser");
|
|
21
|
-
exports.DEFAULT_PACKAGE_MANAGER_DENY_PREFIXES = [
|
|
22
|
-
"apt ",
|
|
23
|
-
"apt-get ",
|
|
24
|
-
"yum ",
|
|
25
|
-
"dnf ",
|
|
26
|
-
"apk ",
|
|
27
|
-
"pacman ",
|
|
28
|
-
"zypper ",
|
|
29
|
-
"brew ",
|
|
30
|
-
"nix-shell ",
|
|
31
|
-
"nix-env ",
|
|
32
|
-
// New-style nix CLI. `nix shell`/`run`/`develop` put arbitrary packages on
|
|
33
|
-
// PATH or fetch-and-execute them and `nix build`/`nix-store` realise arbitrary
|
|
34
|
-
// derivations — the same capability the old-style commands above already
|
|
35
|
-
// denied. A bare `nix ` prefix covers every subcommand (conservative, like
|
|
36
|
-
// `brew `); `nixfmt` and friends keep working because the prefix needs the
|
|
37
|
-
// trailing space. This matcher only recognizes the honestly-typed leading
|
|
38
|
-
// command; what actually contains a package manager differs per backend —
|
|
39
|
-
// see the header on isDirectPackageInstallCommand.
|
|
40
|
-
"nix ",
|
|
41
|
-
"nix-build ",
|
|
42
|
-
"nix-store ",
|
|
43
|
-
"nix-channel ",
|
|
44
|
-
"nix-instantiate ",
|
|
45
|
-
"nix-prefetch-url ",
|
|
46
|
-
"nix-collect-garbage ",
|
|
47
|
-
"nix-copy-closure ",
|
|
48
|
-
// Ad-hoc package runners: fetch-and-run a tool that is not installed.
|
|
49
|
-
// `npx`/`bunx` are absent — they prefer already-installed local binaries.
|
|
50
|
-
"uvx ",
|
|
51
|
-
"uv tool install ",
|
|
52
|
-
"uv tool run ",
|
|
53
|
-
"uv tool upgrade ",
|
|
54
|
-
"uv add ",
|
|
55
|
-
"pipx install ",
|
|
56
|
-
"pipx run ",
|
|
57
|
-
"pipx upgrade ",
|
|
58
|
-
"pipx upgrade-all ",
|
|
59
|
-
"pipx inject ",
|
|
60
|
-
"pipx reinstall ",
|
|
61
|
-
"pipx reinstall-all ",
|
|
62
|
-
"pipx runpip ",
|
|
63
|
-
"pnpm dlx ",
|
|
64
|
-
"yarn dlx ",
|
|
65
|
-
"sudo apt ",
|
|
66
|
-
"sudo apt-get ",
|
|
67
|
-
"sudo yum ",
|
|
68
|
-
"sudo dnf ",
|
|
69
|
-
"sudo apk ",
|
|
70
|
-
"sudo pacman ",
|
|
71
|
-
"sudo zypper ",
|
|
72
|
-
"sudo brew ",
|
|
73
|
-
"sudo nix-shell ",
|
|
74
|
-
"sudo nix-env ",
|
|
75
|
-
"sudo nix ",
|
|
76
|
-
"sudo nix-build ",
|
|
77
|
-
"sudo nix-store ",
|
|
78
|
-
"sudo nix-channel ",
|
|
79
|
-
"sudo nix-instantiate ",
|
|
80
|
-
"sudo nix-prefetch-url ",
|
|
81
|
-
"sudo nix-collect-garbage ",
|
|
82
|
-
"sudo nix-copy-closure ",
|
|
83
|
-
"pip install ",
|
|
84
|
-
"pip3 install ",
|
|
85
|
-
"uv pip install ",
|
|
86
|
-
"npm install ",
|
|
87
|
-
"npm i ",
|
|
88
|
-
"pnpm install ",
|
|
89
|
-
"pnpm add ",
|
|
90
|
-
"yarn install ",
|
|
91
|
-
"yarn add ",
|
|
92
|
-
"bun install ",
|
|
93
|
-
"bun add ",
|
|
94
|
-
"cargo install ",
|
|
95
|
-
"go install ",
|
|
96
|
-
"gem install ",
|
|
97
|
-
"poetry add ",
|
|
98
|
-
"composer require ",
|
|
99
|
-
];
|
|
100
|
-
function normalizeToolName(name) {
|
|
101
|
-
return name.trim().toLowerCase();
|
|
102
|
-
}
|
|
103
|
-
function normalizeToolList(value) {
|
|
104
|
-
if (!value) {
|
|
105
|
-
return [];
|
|
106
|
-
}
|
|
107
|
-
const rawList = Array.isArray(value) ? value : value.split(/[,\n]/);
|
|
108
|
-
return rawList
|
|
109
|
-
.map((entry) => typeof entry === "string" ? entry.trim() : String(entry).trim())
|
|
110
|
-
.filter((entry) => entry.length > 0);
|
|
111
|
-
}
|
|
112
|
-
function parseBashFilter(pattern) {
|
|
113
|
-
const match = pattern.match(/^Bash\(([^:]+):\*\)$/i);
|
|
114
|
-
const prefix = match?.[1]?.trim();
|
|
115
|
-
return prefix || null;
|
|
116
|
-
}
|
|
117
|
-
function matchesToolPattern(toolName, pattern) {
|
|
118
|
-
const normalizedTool = normalizeToolName(toolName);
|
|
119
|
-
const normalizedPattern = pattern.trim();
|
|
120
|
-
const normalizedPatternLower = normalizedPattern.toLowerCase();
|
|
121
|
-
if (normalizedPattern === "*") {
|
|
122
|
-
return true;
|
|
123
|
-
}
|
|
124
|
-
if (normalizedPatternLower.endsWith("*")) {
|
|
125
|
-
const prefix = normalizedPatternLower.slice(0, -1);
|
|
126
|
-
return normalizedTool.startsWith(prefix);
|
|
127
|
-
}
|
|
128
|
-
return normalizedTool === normalizedPatternLower;
|
|
129
|
-
}
|
|
130
|
-
function buildToolPolicy(params) {
|
|
131
|
-
const allowedPatterns = normalizeToolList(params.allowedTools);
|
|
132
|
-
const deniedPatterns = normalizeToolList(params.disallowedTools);
|
|
133
|
-
const toolsConfig = params.toolsConfig;
|
|
134
|
-
const strictMode = toolsConfig?.strictMode === true;
|
|
135
|
-
const mergedAllowed = [
|
|
136
|
-
...(toolsConfig?.allowedTools ?? []),
|
|
137
|
-
...allowedPatterns,
|
|
138
|
-
].map((p) => p.trim());
|
|
139
|
-
const mergedDenied = [
|
|
140
|
-
...(toolsConfig?.deniedTools ?? []),
|
|
141
|
-
...deniedPatterns,
|
|
142
|
-
].map((p) => p.trim());
|
|
143
|
-
const bashAllowPrefixes = mergedAllowed
|
|
144
|
-
.map((pattern) => parseBashFilter(pattern))
|
|
145
|
-
.filter((prefix) => Boolean(prefix));
|
|
146
|
-
const bashDenyPrefixes = mergedDenied
|
|
147
|
-
.map((pattern) => parseBashFilter(pattern))
|
|
148
|
-
.filter((prefix) => Boolean(prefix));
|
|
149
|
-
const bashAllowAll = mergedAllowed.some((pattern) => matchesToolPattern("bash", pattern));
|
|
150
|
-
return {
|
|
151
|
-
toolsConfig,
|
|
152
|
-
allowedPatterns: mergedAllowed,
|
|
153
|
-
deniedPatterns: mergedDenied,
|
|
154
|
-
strictMode,
|
|
155
|
-
bashPolicy: {
|
|
156
|
-
allowAll: bashAllowAll,
|
|
157
|
-
allowPrefixes: bashAllowPrefixes,
|
|
158
|
-
denyPrefixes: [
|
|
159
|
-
...exports.DEFAULT_PACKAGE_MANAGER_DENY_PREFIXES,
|
|
160
|
-
...bashDenyPrefixes,
|
|
161
|
-
],
|
|
162
|
-
},
|
|
163
|
-
};
|
|
164
|
-
}
|
|
165
|
-
function isToolAllowedByPolicy(toolName, policy) {
|
|
166
|
-
const normalizedName = normalizeToolName(toolName);
|
|
167
|
-
const { allowedPatterns, deniedPatterns, strictMode } = policy;
|
|
168
|
-
const explicitDenied = deniedPatterns.some((pattern) => !parseBashFilter(pattern) && matchesToolPattern(normalizedName, pattern));
|
|
169
|
-
if (explicitDenied) {
|
|
170
|
-
return false;
|
|
171
|
-
}
|
|
172
|
-
if (normalizedName === "bash") {
|
|
173
|
-
if (strictMode) {
|
|
174
|
-
const explicitlyAllowed = allowedPatterns.some((pattern) => matchesToolPattern(normalizedName, pattern));
|
|
175
|
-
const hasCommandAllowlist = policy.bashPolicy.allowPrefixes.length > 0;
|
|
176
|
-
return explicitlyAllowed || hasCommandAllowlist;
|
|
177
|
-
}
|
|
178
|
-
return true;
|
|
179
|
-
}
|
|
180
|
-
if (!strictMode) {
|
|
181
|
-
return true;
|
|
182
|
-
}
|
|
183
|
-
return allowedPatterns.some((pattern) => matchesToolPattern(normalizedName, pattern));
|
|
184
|
-
}
|
|
185
|
-
const DIRECT_PACKAGE_INSTALL_PATTERNS = [
|
|
186
|
-
/(^|[\s;|&()])(?:sudo\s+)?(?:apt|apt-get|yum|dnf|apk|pacman|zypper|brew)\s+(?:install|upgrade|add)\b/i,
|
|
187
|
-
/(^|[\s;|&()])(?:sudo\s+)?(?:nix-shell|nix-env)\b/i,
|
|
188
|
-
// New-style nix subcommands and the nix-* helpers, recognized after a shell
|
|
189
|
-
// operator or `sudo` (leading forms are already covered by the prefix list).
|
|
190
|
-
/(^|[\s;|&()])(?:sudo\s+)?nix\s+(?:profile|shell|run|develop|build|eval|flake|store|copy|bundle|repl|search|edit|print-dev-env|why-depends|derivation|realisation|registry|upgrade-nix)\b/i,
|
|
191
|
-
/(^|[\s;|&()])(?:sudo\s+)?nix-(?:build|store|channel|instantiate|prefetch-url|collect-garbage|copy-closure)\b/i,
|
|
192
|
-
/(^|[\s;|&()])(?:pip|pip3)\s+install\b/i,
|
|
193
|
-
/(^|[\s;|&()])uv\s+pip\s+install\b/i,
|
|
194
|
-
/(^|[\s;|&()])uv\s+(?:tool\s+(?:install|run|upgrade)|add)\b/i,
|
|
195
|
-
/(^|[\s;|&()])uvx\b/i,
|
|
196
|
-
/(^|[\s;|&()])pipx\s+(?:install|run|upgrade|upgrade-all|inject|reinstall|reinstall-all|runpip)\b/i,
|
|
197
|
-
/(^|[\s;|&()])npm\s+(?:install|i)\b/i,
|
|
198
|
-
/(^|[\s;|&()])pnpm\s+(?:install|add|dlx)\b/i,
|
|
199
|
-
/(^|[\s;|&()])yarn\s+(?:install|add|global\s+add|dlx)\b/i,
|
|
200
|
-
/(^|[\s;|&()])bun\s+(?:install|add)\b/i,
|
|
201
|
-
/(^|[\s;|&()])cargo\s+install\b/i,
|
|
202
|
-
/(^|[\s;|&()])go\s+install\b/i,
|
|
203
|
-
/(^|[\s;|&()])gem\s+install\b/i,
|
|
204
|
-
/(^|[\s;|&()])poetry\s+add\b/i,
|
|
205
|
-
/(^|[\s;|&()])composer\s+require\b/i,
|
|
206
|
-
];
|
|
207
|
-
/**
|
|
208
|
-
* Longest command this matcher will scan. Past it the command is treated as an
|
|
209
|
-
* install attempt rather than parsed: the scan is superlinear in the command
|
|
210
|
-
* length and the caller does not control the input.
|
|
211
|
-
*/
|
|
212
|
-
const MAX_SCANNED_COMMAND_LENGTH = 8192;
|
|
213
|
-
/**
|
|
214
|
-
* Advisory detector for an honestly-typed package-manager install/acquire
|
|
215
|
-
* command, used to return a helpful "declare it in nixPackages instead" message
|
|
216
|
-
* instead of a bare "command not found". Callers: the agent worker's bash
|
|
217
|
-
* preflight (`runtime/tools.ts`) and the isolate guest's workspace `bash`.
|
|
218
|
-
*
|
|
219
|
-
* This is a conservative TEXT hint, NOT the security boundary. It does not try
|
|
220
|
-
* to out-parse the shell, so it misses a quoted, escaped, or path-qualified
|
|
221
|
-
* name (`"nix" run`, `n\ix run`, `/usr/bin/nix run`), a manager behind an exec
|
|
222
|
-
* wrapper (`env nix run`, `xargs npm install`), a name built at runtime, and
|
|
223
|
-
* the body of an interpreter reached by path or long option (`/bin/bash -c`,
|
|
224
|
-
* `bash --login -c`). It also over-denies a manager named as an argument in a
|
|
225
|
-
* position the argument-data words do not cover (`for f in npm install`,
|
|
226
|
-
* `sudo grep nix run x`).
|
|
227
|
-
*
|
|
228
|
-
* That direction is chosen, not tolerated: over-denial is a confusing error on
|
|
229
|
-
* a harmless command, under-detection is a missing guard rail. So every
|
|
230
|
-
* uncertain case falls back to the base detector and flags, and only a word
|
|
231
|
-
* whose operand provably cannot be a command narrows it.
|
|
232
|
-
*
|
|
233
|
-
* Those misses are not holes on either shell that runs today. On the agent
|
|
234
|
-
* worker's default local backend the manager is not a runnable command:
|
|
235
|
-
* `UNSANDBOXED_INTERPRETERS` in the worker's `embedded/just-bash-bootstrap.ts`
|
|
236
|
-
* keeps it out of the just-bash registry, and that lookup is on the RESOLVED
|
|
237
|
-
* binary name, which quoting and paths cannot change. The isolate guest's
|
|
238
|
-
* workspace has no package manager registered at all. Either way the
|
|
239
|
-
* spellings above end in "command not found"; declared `nixPackages` is the
|
|
240
|
-
* sanctioned way to get tooling.
|
|
241
|
-
*
|
|
242
|
-
* Remote runtime providers (opt-in, e.g. `vercel`) have no discovery filter,
|
|
243
|
-
* but the worker's preflight runs before dispatch, so these deny prefixes
|
|
244
|
-
* apply there too and are what keeps a manager from reaching the provider at
|
|
245
|
-
* all. Loosening that for the sandbox tier would be a deliberate, separate
|
|
246
|
-
* change.
|
|
247
|
-
*
|
|
248
|
-
* Making this matcher airtight means reimplementing bash's lexer; attempts to
|
|
249
|
-
* do so produced false positives on honest commands and no gain in
|
|
250
|
-
* enforcement. Prefer widening the discovery filter over widening this regex.
|
|
251
|
-
*/
|
|
252
|
-
function isDirectPackageInstallCommand(command) {
|
|
253
|
-
const trimmed = command.trim().toLowerCase();
|
|
254
|
-
if (!trimmed) {
|
|
255
|
-
return false;
|
|
256
|
-
}
|
|
257
|
-
// The interpreter-body regex backtracks quadratically on adversarial option
|
|
258
|
-
// clusters (`sh -` repeated), and on the isolate lane the model writes this
|
|
259
|
-
// string, so an unbounded scan would block the guest's only thread for
|
|
260
|
-
// seconds. No honest install command is anywhere near this long, and the
|
|
261
|
-
// matcher's documented bias is to fail toward flagging.
|
|
262
|
-
if (trimmed.length > MAX_SCANNED_COMMAND_LENGTH) {
|
|
263
|
-
return true;
|
|
264
|
-
}
|
|
265
|
-
const matches = (text) => exports.DEFAULT_PACKAGE_MANAGER_DENY_PREFIXES.some((prefix) => text.startsWith(prefix.toLowerCase())) || DIRECT_PACKAGE_INSTALL_PATTERNS.some((pattern) => pattern.test(text));
|
|
266
|
-
// Scan the command with quoted DATA blanked out and each data word's operands
|
|
267
|
-
// dropped, so a manager merely NAMED cannot match. Both scrubs are advisory
|
|
268
|
-
// and fail toward flagging: whatever they cannot prove to be data is matched.
|
|
269
|
-
if ((0, bash_command_parser_1.matchesBeforeArgumentData)((0, bash_command_parser_1.blankQuotedSpans)(trimmed), matches)) {
|
|
270
|
-
return true;
|
|
271
|
-
}
|
|
272
|
-
// Then scan `sh -c '…'` bodies, where the quoted text IS a command.
|
|
273
|
-
bash_command_parser_1.INTERPRETER_DASH_C.lastIndex = 0;
|
|
274
|
-
for (const m of trimmed.matchAll(bash_command_parser_1.INTERPRETER_DASH_C)) {
|
|
275
|
-
const body = m[2]?.trim();
|
|
276
|
-
if (body && (0, bash_command_parser_1.matchesBeforeArgumentData)((0, bash_command_parser_1.blankQuotedSpans)(body), matches)) {
|
|
277
|
-
return true;
|
|
278
|
-
}
|
|
279
|
-
}
|
|
280
|
-
return false;
|
|
281
|
-
}
|
|
282
|
-
function enforceBashCommandPolicy(command, policy) {
|
|
283
|
-
if (!command.trim()) {
|
|
284
|
-
return;
|
|
285
|
-
}
|
|
286
|
-
const segments = (0, bash_command_parser_1.splitShellCommands)(command);
|
|
287
|
-
if (segments.length === 0) {
|
|
288
|
-
return;
|
|
289
|
-
}
|
|
290
|
-
const hasAllowlist = !policy.allowAll && policy.allowPrefixes.length > 0;
|
|
291
|
-
for (const segment of segments) {
|
|
292
|
-
const normalizedSegment = segment.toLowerCase();
|
|
293
|
-
const denied = policy.denyPrefixes.some((prefix) => normalizedSegment.startsWith(prefix.toLowerCase()));
|
|
294
|
-
if (denied) {
|
|
295
|
-
throw new Error("Bash command denied by policy");
|
|
296
|
-
}
|
|
297
|
-
if (hasAllowlist) {
|
|
298
|
-
const allowed = policy.allowPrefixes.some((prefix) => normalizedSegment.startsWith(prefix.toLowerCase()));
|
|
299
|
-
if (!allowed) {
|
|
300
|
-
throw new Error("Bash command not allowed by policy");
|
|
301
|
-
}
|
|
302
|
-
}
|
|
303
|
-
}
|
|
304
|
-
}
|
|
305
|
-
//# sourceMappingURL=tool-policy.js.map
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Structural stand-in for the SDK's event shape. Declared here rather than
|
|
3
|
-
* imported so one scrubber serves BOTH Sentry majors in this repo -- this
|
|
4
|
-
* package is on @sentry/node ^10 and @lobu/server on ^9 -- without coupling
|
|
5
|
-
* the shared module to either one's type graph. `sdkProcessingMetadata` is the
|
|
6
|
-
* only field the walk treats specially; everything else is structural.
|
|
7
|
-
*/
|
|
8
|
-
interface SentryEventLike {
|
|
9
|
-
sdkProcessingMetadata?: Record<string, unknown> | undefined;
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* Recursively remove credential material from values headed for Sentry.
|
|
13
|
-
* This is deliberately defensive: telemetry must never make an unusual
|
|
14
|
-
* application value or a circular error object throw another error.
|
|
15
|
-
*/
|
|
16
|
-
export declare function scrubSentryValue(value: unknown): unknown;
|
|
17
|
-
export declare function scrubSentryErrorEvent<T extends SentryEventLike>(event: T): T;
|
|
18
|
-
/**
|
|
19
|
-
* Sampled wherever tracing is on -- but sampled is not exempt: a span's
|
|
20
|
-
* attributes carry the request URL, which is the very `?token=` vector the
|
|
21
|
-
* error path scrubs. Without this they reach Sentry unscrubbed. Rates are the
|
|
22
|
-
* consumer's business, not this module's (the gateway traces, the worker sets
|
|
23
|
-
* tracesSampleRate 0, so there it is installed and inert).
|
|
24
|
-
*/
|
|
25
|
-
export declare function scrubSentryTransactionEvent<T extends SentryEventLike>(event: T): T;
|
|
26
|
-
/** Never drops a breadcrumb; it only rewrites credential material in place. */
|
|
27
|
-
export declare function scrubSentryBreadcrumb<T extends object>(breadcrumb: T): T;
|
|
28
|
-
export {};
|
|
29
|
-
//# sourceMappingURL=sentry-scrubber.d.ts.map
|