@agent-beam/beam 0.2.40 → 0.2.41

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.
@@ -2,7 +2,7 @@
2
2
  // the same catalog backs agent hooks (core.ts) and the in-app SDK (sdk.ts), which can run in
3
3
  // edge runtimes.
4
4
  import { promptAttack } from "./prompt-attacks.js";
5
- import { isScopedTemporaryCleanup } from "./destructive-risk.js";
5
+ import { isScopedTemporaryCleanup, isLowRiskCleanup, isProjectScopedCleanup, isSymlinkOnlyDelete } from "./destructive-risk.js";
6
6
  import { patternMatch, anyMatch, allMatch, functionalMatch } from "./rule-matches.js";
7
7
  import { credentialExposureSpans, possibleCredentialExposure } from "./credential-egress.js";
8
8
  const secret = /(?:\.env(?:\b|[./])|\.ssh[\\/]|id_rsa|id_ed25519|\.aws[\\/]credentials|\.pgpass\b|\.docker[\\/]config\.json|\.gnupg[\\/]|credentials\.json|(?:api[_-]?key|access[_-]?token|password|secret)\b)/i;
@@ -11,14 +11,104 @@ const secret = /(?:\.env(?:\b|[./])|\.ssh[\\/]|id_rsa|id_ed25519|\.aws[\\/]crede
11
11
  // rules also run on attacker-written text inside customer apps (App monitoring). Each line's
12
12
  // pipes are split once and scanned in order.
13
13
  const EXEC_AFTER_PIPE = /^\s*(?:sudo\s+)?(?:(?:ba|z|fi)?sh|python3?|node|ruby|perl|pwsh|powershell)\b/i;
14
+ // "curl ... | python3 -c '...'" or "| node script.js" feeds the download to a program you already
15
+ // have as plain input; only an interpreter that reads its PROGRAM from stdin (bash, sh -s,
16
+ // python3 -, node -) runs what was downloaded.
17
+ const wordsOf = (s) => s.match(/"[^"]*"|'[^']*'|\S+/g) ?? [];
18
+ const scriptArg = (t) => /^[A-Za-z0-9_.\/~$][\w.\/~${}@:+-]*$/.test(t);
19
+ function execAfterPipe(segment) {
20
+ const m = EXEC_AFTER_PIPE.exec(segment);
21
+ if (!m)
22
+ return null;
23
+ const name = m[0].trim().split(/\s+/).pop().toLowerCase();
24
+ const rest = wordsOf(segment.slice(m[0].length));
25
+ if (/^(?:pwsh|powershell)$/.test(name))
26
+ return m;
27
+ for (const t of rest) {
28
+ if (/^(?:ba|z|fi)?sh$/.test(name)) {
29
+ if (t === "-s")
30
+ return m;
31
+ if (/^-[a-z]*c[a-z]*$/i.test(t))
32
+ return null;
33
+ if (scriptArg(t) && !t.startsWith("-"))
34
+ return null;
35
+ if (!t.startsWith("-"))
36
+ return m;
37
+ }
38
+ else if (/^python/.test(name)) {
39
+ if (t === "-")
40
+ return m;
41
+ if (/^-[a-z]*[cm][a-z]*$/i.test(t) || (scriptArg(t) && !t.startsWith("-")))
42
+ return null;
43
+ if (!t.startsWith("-"))
44
+ return m;
45
+ }
46
+ else if (name === "node") {
47
+ if (t === "-")
48
+ return m;
49
+ if (/^(?:-e|-p|-pe|--eval|--print)$/.test(t) || (scriptArg(t) && !t.startsWith("-")))
50
+ return null;
51
+ if (!t.startsWith("-"))
52
+ return m;
53
+ }
54
+ else {
55
+ if (/^-[a-z]*[eEr][a-z]*$/.test(t) || (scriptArg(t) && !t.startsWith("-")))
56
+ return null;
57
+ if (!t.startsWith("-"))
58
+ return m;
59
+ }
60
+ }
61
+ return m;
62
+ }
63
+ // Split a line at single pipes (not `||`). A `|` inside quotes still counts -- it is a real pipe
64
+ // when the quoted text is shell code (subprocess.run("curl ... | bash"), bash -c "...", ssh host
65
+ // "...") -- except where the quote holds a regex for grep/sed/awk/etc., where `|` is alternation.
66
+ const REGEX_CONTEXT = /(?:\b(?:e?grep|rg|ag|ack|sed|awk|gawk|pgrep|pkill|jq|rename)\b|\s-[eE]\s*|--regexp(?:=|\s+)|--include=|--exclude=|--glob[= ]|\s-g\s*)[^|]*$/;
67
+ function splitPipes(line) {
68
+ const parts = [];
69
+ let quote = "";
70
+ let from = 0;
71
+ let regexQuote = false;
72
+ for (let i = 0; i < line.length; i++) {
73
+ const c = line[i];
74
+ if (c === "\\" && quote !== "'") {
75
+ i++;
76
+ continue;
77
+ }
78
+ if (quote) {
79
+ if (c === quote) {
80
+ quote = "";
81
+ regexQuote = false;
82
+ continue;
83
+ }
84
+ if (!(c === "|" && !regexQuote))
85
+ continue;
86
+ }
87
+ else if (c === "'" || c === '"') {
88
+ quote = c;
89
+ regexQuote = REGEX_CONTEXT.test(line.slice(from, i));
90
+ continue;
91
+ }
92
+ if (c !== "|")
93
+ continue;
94
+ if (line[i + 1] === "|") {
95
+ i++;
96
+ continue;
97
+ }
98
+ parts.push(line.slice(from, i));
99
+ from = i + 1;
100
+ }
101
+ parts.push(line.slice(from));
102
+ return parts;
103
+ }
14
104
  function pipesIntoShell(s, newArmer) {
15
105
  for (const line of s.split("\n")) {
16
106
  if (!line.includes("|"))
17
107
  continue;
18
108
  const arms = newArmer();
19
109
  let armed = false;
20
- for (const [i, segment] of line.split("|").entries()) {
21
- if (i > 0 && armed && EXEC_AFTER_PIPE.test(segment))
110
+ for (const [i, segment] of splitPipes(line).entries()) {
111
+ if (i > 0 && armed && execAfterPipe(segment))
22
112
  return true;
23
113
  armed = arms(segment) || armed;
24
114
  }
@@ -33,8 +123,8 @@ function pipelineMatcher(newArmer) {
33
123
  const arms = newArmer();
34
124
  let armedAt;
35
125
  let cursor = 0;
36
- for (const segment of line.split("|")) {
37
- const executed = EXEC_AFTER_PIPE.exec(segment);
126
+ for (const segment of splitPipes(line)) {
127
+ const executed = execAfterPipe(segment);
38
128
  if (armedAt !== undefined && executed) {
39
129
  spans.push({ start: offset + armedAt, end: offset + cursor + executed[0].length, label: "Pipeline into an interpreter" });
40
130
  break;
@@ -88,12 +178,105 @@ function recursiveDeleteSpans(s) {
88
178
  function rmRecursiveForce(s) { return recursiveDeleteSpans(s).length > 0; }
89
179
  // Download-then-execute split across a command chain instead of a pipe: `curl -o x.sh ... && chmod
90
180
  // +x x.sh && ./x.sh`. One segment fetches, a later segment (joined by && or ;) runs what it fetched.
91
- const DOWNLOAD_THEN_EXEC = /\b(?:curl|wget)\b[^\n]{0,300}?(?:\s-[oO]\s|--output\b)[^\n]{0,300}?(?:&&|;)[^\n]{0,300}?(?:chmod\s+\+x|\.\/\S|(?:ba|z)?sh\b|python3?\b|node\b)/i;
181
+ // "curl -o f URL && bash f": the file that was downloaded is the file that runs. A -o that belongs
182
+ // to another program (grep -o), a download to /dev/null, or an unrelated later python3/node is not.
183
+ function splitCommands(line) {
184
+ const out = [];
185
+ let from = 0;
186
+ for (let i = 0; i < line.length; i++) {
187
+ const c = line[i];
188
+ if (c === "\\") {
189
+ i++;
190
+ continue;
191
+ }
192
+ const sep = c === ";" ? 1 : c === "&" && line[i + 1] === "&" ? 2 : 0;
193
+ if (!sep)
194
+ continue;
195
+ out.push({ text: line.slice(from, i), start: from });
196
+ i += sep - 1;
197
+ from = i + 1;
198
+ }
199
+ out.push({ text: line.slice(from), start: from });
200
+ return out;
201
+ }
202
+ // `sh -c "curl ... && bash f"` / `ssh host "..."`: look inside the quoted command.
203
+ const unwrap = (segment) => segment.trim()
204
+ .replace(/^(?:sudo\s+)?(?:(?:ba|z|da)?sh\s+-[a-z]*c|ssh\s+(?:-\S+\s+)*\S+)\s+["']/, "")
205
+ .replace(/["')\s]+$/, "");
206
+ const unquote = (t) => t.replace(/^(["'])(.*)\1$/, "$2");
207
+ const baseName = (p) => p.replace(/[?#].*$/, "").split("/").filter(Boolean).pop() ?? "";
208
+ function downloadedFile(segment) {
209
+ if (splitPipes(segment).length > 1)
210
+ return undefined;
211
+ const w = wordsOf(unwrap(segment)).map(unquote);
212
+ let at = 0;
213
+ while (/^\w+=/.test(w[at] ?? "") || w[at] === "sudo")
214
+ at++;
215
+ const tool = w[at]?.split("/").pop();
216
+ if (tool !== "curl" && tool !== "wget")
217
+ return undefined;
218
+ const url = w.find(t => /^https?:\/\//i.test(t));
219
+ for (let i = at + 1; i < w.length; i++) {
220
+ const t = w[i];
221
+ let file;
222
+ if (t === "-o" || t === "--output" || (tool === "curl" && /^-[a-zA-Z]+o$/.test(t)) || (tool === "wget" && /^-[a-zA-Z]*O$/.test(t)))
223
+ file = w[i + 1];
224
+ else if (/^--output=/.test(t))
225
+ file = t.slice(9);
226
+ else if (tool === "curl" && (/^-[a-zA-Z]*O$/.test(t) || t === "--remote-name"))
227
+ file = url ? baseName(url) : undefined;
228
+ if (file !== undefined)
229
+ return file === "-" || file === "/dev/null" ? undefined : file;
230
+ }
231
+ return tool === "wget" && url ? baseName(url) || undefined : undefined;
232
+ }
233
+ function runsFile(segment, files) {
234
+ const w = wordsOf(unwrap(segment)).map(unquote);
235
+ let at = 0;
236
+ while (/^\w+=/.test(w[at] ?? "") || w[at] === "sudo")
237
+ at++;
238
+ const head = w[at];
239
+ if (!head)
240
+ return false;
241
+ const isIt = (t) => !!t && files.some(f => t === f || t.endsWith("/" + f.replace(/^\.?\//, "")) || t === "./" + f);
242
+ if (head === "chmod")
243
+ return w.slice(at + 1).some(isIt);
244
+ if (/^(?:(?:ba|z|fi|da)?sh|python[\d.]*|node|ruby|perl|php|source|\.)$/.test(head.split("/").pop()))
245
+ return isIt(w.slice(at + 1).find(t => !t.startsWith("-")));
246
+ return (head.includes("/") || head.startsWith("./")) && isIt(head);
247
+ }
248
+ function downloadThenExecSpans(text) {
249
+ const spans = [];
250
+ let offset = 0;
251
+ for (const line of text.split("\n")) {
252
+ const files = [];
253
+ let from = -1;
254
+ for (const seg of splitCommands(line)) {
255
+ const file = downloadedFile(seg.text);
256
+ if (file) {
257
+ files.push(file);
258
+ if (from < 0)
259
+ from = seg.start;
260
+ continue;
261
+ }
262
+ if (files.length && runsFile(seg.text, files)) {
263
+ spans.push({ start: offset + from, end: offset + seg.start + seg.text.length, label: "Downloaded file is run" });
264
+ break;
265
+ }
266
+ }
267
+ offset += line.length + 1;
268
+ }
269
+ return spans;
270
+ }
271
+ const DOWNLOAD_THEN_EXEC = functionalMatch(text => downloadThenExecSpans(text).length > 0, downloadThenExecSpans);
92
272
  // PowerShell's `IEX (New-Object Net.WebClient).DownloadString(...)` / `iwr ... | iex`, the
93
273
  // single most common Windows download-and-run one-liner; and a Python process that fetches and
94
274
  // executes in the same call instead of piping to a shell.
95
275
  const POWERSHELL_DOWNLOAD_EXEC = /\bdownloadstring\s*\(|\b(?:iex|invoke-expression)\b[^\n]{0,300}?(?:iwr|invoke-webrequest|downloadstring)\b|\b(?:iwr|invoke-webrequest)\b[^\n]{0,300}?\|\s*(?:iex|invoke-expression)\b/i;
96
- const PYTHON_FETCH_EXEC = /\b(?:exec|eval)\s*\(\s*(?:compile\s*\(\s*)?(?:urllib\.request\.urlopen|urlopen|requests\.get|urlretrieve)\b/i;
276
+ const PYTHON_FETCH_EXEC = /\b(?:exec|eval)\s*\(\s*(?:compile\s*\(\s*)?(?:[\w.]*\.)?(?:urlopen|urlretrieve)\b|\b(?:exec|eval)\s*\(\s*(?:compile\s*\(\s*)?(?:requests|httpx)\.(?:get|post)\b/i;
277
+ // bash <(curl ...), sh -c "$(curl ...)", eval "$(curl ...)", source <(curl ...), . <(curl ...);
278
+ // node fetch(...).then(r => r.text()).then(eval); deno run https://...
279
+ const FETCH_AND_RUN = /(?:\b(?:(?:ba|z|fi|da|k)?sh|source|eval|python[\d.]*|node|ruby|perl|php)\b(?:\s+-[a-z]*c)?|(?:^|[;&|\s])\.)\s+["']?(?:<\(|\$\(|`)\s*(?:sudo\s+)?(?:curl|wget)\b|\bfetch\s*\([^\n]{0,400}?\)\s*\.then\s*\([^\n]{0,200}?text\(\)\s*\)\s*\.then\s*\(\s*(?:eval|new\s+Function)\b|\beval\s*\(\s*await\s+[^\n]{0,80}?fetch\b|\bdeno\s+(?:run|eval)\b[^\n]{0,200}?\bhttps?:\/\//i;
97
280
  // Disk, partition and filesystem-level wipes: destroy an entire volume rather than files inside
98
281
  // it, and are unrecoverable even with the deleted file still referenced elsewhere.
99
282
  const DISK_WIPE = /\bdd\b[^\n]{0,300}?\bof=\/dev\/(?:[sh]d|nvme|disk)\w*|\bmkfs\b|\bmke2fs\b|\bwipefs\b|\bblkdiscard\b|\b(?:fdisk|gdisk|sgdisk|parted)\b|\bdiskutil\s+(?:eraseDisk|eraseVolume|reformat)\b|\bdiskpart\b[\s\S]{0,200}?\bclean\b|\bClear-Disk\b[^\n]{0,300}?-RemoveData|\bRemove-Partition\b|\bcipher\s+\/w:|\bformat\s+[a-z]:\s*\/y\b/i;
@@ -101,7 +284,7 @@ const DISK_WIPE = /\bdd\b[^\n]{0,300}?\bof=\/dev\/(?:[sh]d|nvme|disk)\w*|\bmkfs\
101
284
  const FORK_BOMB = /:\s*\(\s*\)\s*\{\s*:\s*\|\s*:\s*&\s*\}\s*;\s*:/;
102
285
  // Dropping an entire datastore instead of rows in it: Redis/Mongo have no SQL DROP/TRUNCATE syntax.
103
286
  const DATASTORE_WIPE = /\bFLUSHALL\b|\bFLUSHDB\b|db\.dropDatabase\s*\(\)/i;
104
- const otherDestructiveMatcher = anyMatch(patternMatch(/\bfind\b[^\n]{0,300}?-delete\b|\brsync\b[^\n]{0,300}?--delete\b|\bshred\b[^\n]{0,100}?-\w*u|\bshutil\.rmtree\s*\(|(?:\bfs\.)?\brm(?:dir)?Sync\s*\([^\n]{0,200}?recursive\s*:\s*true|\brd\s+\/s\s+\/q\b|\bRemove-Item\b[^\n]{0,1000}?(?:-Recurse|-Force)|\b(?:drop\s+(?:table|database)|truncate\s+(?:table\s+)?\w+)|\bgit\s+(?:reset\s+--hard|clean\s+-[^\n]{0,1000}?f)/i), patternMatch(DATASTORE_WIPE));
287
+ const otherDestructiveMatcher = anyMatch(patternMatch(/\bfind\b[^\n]{0,300}?-delete\b|\brsync\b[^\n]{0,300}?--delete\b|\bshred\b[^\n]{0,100}?-\w*u|\bshutil\.rmtree\s*\(|(?:\bfs\.)?\brm(?:dir)?Sync\s*\([^\n]{0,200}?recursive\s*:\s*true|\brd\s+\/s\s+\/q\b|\bRemove-Item\b[^\n]{0,1000}?(?:-Recurse|-Force)|\b(?:drop\s+(?:table|database)|truncate\s+table\s+\w+)|(?:^|[;&|\n]\s*)(?:sudo\s+)?truncate\s+-s\s*0\b|(?:^|[;\n("'])\s*truncate\s+(?:only\s+)?\w+(?:\.\w+)?\s*(?:;|\bcascade\b|\brestart\b)|\bgit\s+(?:reset\s+--hard|clean\s+-[^\n]{0,1000}?f)/i), patternMatch(DATASTORE_WIPE));
105
288
  function otherDestructiveOperation(s) { return otherDestructiveMatcher(s); }
106
289
  // A vault/secret-manager reference (op://, Azure Key Vault, HashiCorp Vault, Infisical, Doppler,
107
290
  // a GitHub Actions secrets expression, or a generic broker placeholder) typed literally into a
@@ -113,8 +296,12 @@ function otherDestructiveOperation(s) { return otherDestructiveMatcher(s); }
113
296
  // real service (with its own resolver already wired up) is what should happen next, not the agent
114
297
  // improvising. Mirrors the CREDENTIAL_REFERENCE check in data-detectors.ts.
115
298
  const UNRESOLVED_REFERENCE = /\bop:\/\/|@Microsoft\.KeyVault\(|\bvault:[\w/-]|\binfisical:\/\/|\bdoppler:\/\/|\$\{\{\s*secrets\.|__[A-Z][A-Z0-9_]*_REF_[\w-]+__/i;
299
+ // Shared by destructive.production below: split out so the heading-aware matcher can reuse the
300
+ // same two patterns the old allMatch(...) used.
301
+ const PROD_TARGET = /\b(?:production|prod|prd)\b/i;
302
+ const PROD_VERB = /\b(?:deploy|delete|drop|truncate|migrate|apply|destroy|restart|rollback|scale)\b/i;
116
303
  export const builtinRules = [
117
- { id: "destructive.delete", title: "Destructive operation", severity: "high", category: "impact", explanation: "Recursive deletion or a destructive data operation. Scoped temporary test cleanup is MEDIUM; broad or uncertain targets remain HIGH. Review the target before allowing it.", match: anyMatch(functionalMatch(rmRecursiveForce, recursiveDeleteSpans), otherDestructiveMatcher), severityFor: s => !otherDestructiveOperation(s) && isScopedTemporaryCleanup(s) ? "medium" : "high" },
304
+ { id: "destructive.delete", title: "Destructive operation", severity: "high", category: "impact", explanation: "Recursive deletion or a destructive data operation. Scoped temporary test cleanup is MEDIUM; broad or uncertain targets remain HIGH. Review the target before allowing it.", match: anyMatch(functionalMatch(rmRecursiveForce, recursiveDeleteSpans), otherDestructiveMatcher), severityFor: s => isSymlinkOnlyDelete(s) ? "low" : otherDestructiveOperation(s) ? "high" : isLowRiskCleanup(s) ? "low" : isScopedTemporaryCleanup(s) || isProjectScopedCleanup(s) ? "medium" : "high" },
118
305
  { id: "destructive.disk_wipe", title: "Disk or partition wipe", severity: "critical", category: "impact", explanation: "This targets an entire disk, partition or filesystem rather than individual files, and is unrecoverable. Confirm this is an authorized, intentional wipe.", match: patternMatch(DISK_WIPE) },
119
306
  { id: "destructive.fork_bomb", title: "Fork bomb", severity: "critical", category: "impact", explanation: "This pattern spawns processes exponentially and can make the machine unresponsive.", match: patternMatch(FORK_BOMB) },
120
307
  { id: "destructive.audit_trail", title: "Audit trail or recovery point erased", severity: "critical", category: "integrity", explanation: "This clears shadow copies, event logs or shell history. It is also the standard precursor to covering up a destructive or malicious action; confirm the reason before allowing it.", match: patternMatch(/\bvssadmin\b[^\n]{0,100}?delete\s+shadows|\bwevtutil\b[^\n]{0,50}?\bcl\b|\bClear-EventLog\b|\bhistory\s+-c\b|\bunset\s+HISTFILE\b|\bHISTSIZE\s*=\s*0\b|\bbcdedit\b[^\n]{0,50}?\/deletevalue/i) },
@@ -123,7 +310,11 @@ export const builtinRules = [
123
310
  { id: "destructive.account", title: "Deletes a system account", severity: "high", category: "impact", explanation: "This removes a user or group account, which can include its home directory and files. Confirm the account is no longer needed.", match: patternMatch(/\buserdel\s+-r\b|\bgroupdel\b|\bRemove-LocalUser\b|\bnet\s+user\s+\S+\s+\/delete\b|\bdscl\s+\.\s+-delete\s+\/Users\//i) },
124
311
  { id: "integrity.protection_disabled", title: "OS security control disabled", severity: "critical", category: "integrity", explanation: "This turns off a platform security control (System Integrity Protection, Gatekeeper, execution policy, or System Restore), which weakens the machine's security posture beyond this one action.", match: patternMatch(/\bcsrutil\s+disable\b|\bspctl\s+--master-disable\b|\bsecurity\s+delete-keychain\b|\bSet-ExecutionPolicy\s+Unrestricted\b|\bDisable-WindowsOptionalFeature\b|\bDisable-ComputerRestore\b/i) },
125
312
  { id: "network.firewall_disabled", title: "Firewall rules flushed or disabled", severity: "high", category: "integrity", explanation: "This removes or disables firewall protection on the host. Confirm the host doesn't need it, or that replacement rules are applied immediately.", match: patternMatch(/\biptables\s+-F\b|\bufw\s+(?:--force\s+reset|disable)\b|\bnetsh\s+advfirewall\s+set\s+allprofiles\s+state\s+off\b/i) },
126
- { id: "destructive.production", title: "Production change", severity: "high", category: "impact", explanation: "This action targets a production environment. Confirm the scope and rollback plan before proceeding.", match: allMatch(patternMatch(/\b(?:production|prod|prd)\b/i), patternMatch(/\b(?:deploy|delete|drop|truncate|migrate|apply|destroy|restart|rollback|scale)\b/i)) },
313
+ { id: "destructive.production", title: "Production change", severity: "high", category: "impact", explanation: "This action targets a production environment. Confirm the scope and rollback plan before proceeding.",
314
+ // Both words can co-occur in a markdown heading or doc title ("# Deploy production") that is
315
+ // not itself a command. Require the co-occurrence on one line that isn't a heading, so prose
316
+ // describing production deploys doesn't read the same as a command that performs one.
317
+ match: functionalMatch(s => s.split(/\r?\n/).some(line => { const t = line.trim(); return !/^#{1,6}\s/.test(t) && PROD_TARGET.test(t) && PROD_VERB.test(t); }), text => allMatch(patternMatch(PROD_TARGET), patternMatch(PROD_VERB)).spans?.(text) ?? []) },
127
318
  // Dumping the *whole* environment (every var, name and value) is the risky shape: that's what
128
319
  // can hand over credentials the agent was never told about. Referencing one named variable
129
320
  // ($PORT, $NODE_ENV, ${DATABASE_URL}) is how every normal dev workflow reads its own config and
@@ -131,20 +322,51 @@ export const builtinRules = [
131
322
  // called out as noisy. That case now only shows up (at "info", logged but not an approval gate)
132
323
  // in credentials.environment_ref below, and only for the few var-name shapes anyone would
133
324
  // actually call a credential; everyday vars like $PORT or $NODE_ENV don't get flagged anywhere.
134
- { id: "credentials.environment", title: "Environment variable access", severity: "high", category: "secrets", explanation: "The action reads every exported environment variable at once (not one named variable), which can expose credentials the agent was never told about.", match: patternMatch(/\b(?:printenv|env|export\s+-p|process\.env|os\.environ|System\.getenv|declare\s+-x|Get-ChildItem\s+env:)\b|\/proc\/self\/environ\b|(?:^|[;&|]\s*)set(?:\s*$|\s+-o\b)/i) },
325
+ { id: "credentials.environment", title: "Environment variable access", severity: "high", category: "secrets", explanation: "The action reads every exported environment variable at once (not one named variable), which can expose credentials the agent was never told about.",
326
+ // Bare "env" used to be a plain \b...\b alternative, so it matched the standalone token inside
327
+ // "env.FLAGS", "this.env.AI.run(...)", or a TypeScript "Env" binding/generic -- none of which
328
+ // dump the environment. It now needs its own boundaries: not preceded by "." or a word char
329
+ // (so it isn't someone's property/namespace access), and not immediately followed by ".", "(",
330
+ // or "<" (a method call, property access, or generic type argument), so only the bare shell
331
+ // command or standalone identifier still matches.
332
+ // Cloudflare Workers code conventionally declares "interface Env { ... }" and takes a
333
+ // lowercase "env" binding parameter ("fetch(request, env, ctx)", "(req, env) =>",
334
+ // "import { env } from ..."). That is every Workers-based skill's docs, and a boundary-only
335
+ // exclusion list can't keep up with every syntactic shape "env" shows up adjacent to as an
336
+ // identifier (":" for a type, "," in a param list, "}" closing a destructure, "=>", ...).
337
+ // The real "env" command is only ever meaningful as the first word of a shell command, so
338
+ // this now requires exactly that shape -- optionally after a command separator -- instead of
339
+ // trying to list every JS/TS context where "env" is just a parameter name.
340
+ match: anyMatch(
341
+ // process.env.CF_ACCOUNT_ID / os.environ["R2_WAREHOUSE"] read one named property, same as
342
+ // $PORT or ${DATABASE_URL} below -- not the bulk dump this rule means to catch. Only the
343
+ // bare object (passed, spread, or iterated whole) still counts.
344
+ patternMatch(/\b(?:printenv|export\s+-p|process\.env(?![.[])|os\.environ(?![.[])|System\.getenv|declare\s+-x|Get-ChildItem\s+env:)\b|\/proc\/self\/environ\b|(?:^|[;&|]\s*)set(?:\s*$|\s+-o\b)/i), patternMatch(/(?:^|\n|[;&|]\s*)env\b(?![.\w(<])/)) },
135
345
  { id: "credentials.environment_ref", title: "Named credential variable referenced", severity: "info", category: "secrets", explanation: "A single environment variable whose name looks like a credential (KEY/SECRET/TOKEN/PASSWORD/CREDENTIAL) is referenced by name. Logged for visibility; this alone isn't a reason to block the ordinary case of an app reading its own configured secret.", match: patternMatch(/\$\{?[A-Z][A-Z0-9]*(?:_[A-Z0-9]+)*_(?:KEY|SECRET|TOKEN|PASSWORD|CREDENTIAL)S?\}?\b/) },
136
346
  { id: "credentials.access", title: "Sensitive credential reference", severity: "medium", category: "secrets", explanation: "This action or instruction references a credential location. Confirm the agent needs access.", match: patternMatch(secret) },
137
- { id: "source.private_files", title: "Private source or configuration access", severity: "high", category: "secrets", explanation: "This action accesses a private credential or configuration file. Confirm that the agent needs the contents.", match: patternMatch(/(?:\.env(?:\.[\w.-]+)?|\.ssh[\\/]|\.aws[\\/]credentials|id_(?:rsa|ed25519)|\.npmrc|\.netrc|kubeconfig|private.?key|\.pgpass\b|\.docker[\\/]config\.json|\.gnupg[\\/]|credentials\.json)/i) },
347
+ { id: "source.private_files", title: "Private source or configuration access", severity: "high", category: "secrets", explanation: "This action accesses a private credential or configuration file. Confirm that the agent needs the contents.",
348
+ // \.env(?:\.[\w.-]+)? had no boundaries, so it matched the literal substring ".env" inside
349
+ // "this.env.AI.run(...)" (a property access, not a dotenv file) and inside ".environment" (a
350
+ // different word entirely, since nothing required the match to end at "env"). It now needs
351
+ // "not preceded by a word character" (so a leading property-access dot like "this.env" is
352
+ // excluded) and "not followed by a word character unless it's another dotted extension" (so
353
+ // ".environment" doesn't partially match as ".env").
354
+ match: patternMatch(/(?:(?<!\w)\.env(?:\.[\w-]+)?(?!\w)|\.ssh[\\/]|\.aws[\\/]credentials|id_(?:rsa|ed25519)|\.npmrc|\.netrc|kubeconfig|private.?key|\.pgpass\b|\.docker[\\/]config\.json|\.gnupg[\\/]|credentials\.json)/i) },
138
355
  { id: "mcp.write", title: "MCP write operation", severity: "high", category: "impact", explanation: "The MCP tool appears to modify data or send an external side effect. Require approval before allowing it.", match: patternMatch(/\bmcp(?:__|:)[^\s]*(?:create|update|delete|write|send|post|put|patch|execute|run|publish|deploy|remove|save|insert|add|grant|revoke|assign)\b/i) },
139
356
  { id: "credentials.egress", title: "Possible credential exposure", severity: "critical", category: "exfil", explanation: "A transfer command carries a sensitive payload, or sensitive output feeds an outbound command. This is a possible exposure, not proof of delivery; check the destination and authorization.", match: functionalMatch(possibleCredentialExposure, credentialExposureSpans) },
140
357
  { id: "secrets.unresolved_reference_launch", title: "Vault reference used directly instead of resolved", severity: "medium", category: "secrets", explanation: "This command includes a secret-manager reference (op://, Azure Key Vault, Vault, Infisical, Doppler, a GitHub Actions secrets expression, or a broker placeholder) typed in literally rather than resolved by its own CLI or platform. The agent cannot resolve it into the real value -- have a human or CI process start the real service instead, with its existing resolver already wired up.", match: patternMatch(UNRESOLVED_REFERENCE) },
141
- { id: "execution.remote", title: "Remote code execution pattern", severity: "high", category: "exec", explanation: "Downloaded content is fetched and run without review: piped into a shell or interpreter, fetched and executed in one step, or downloaded and run as separate chained commands.", match: anyMatch(anyMatch(anyMatch(pipelineMatcher(downloads), patternMatch(DOWNLOAD_THEN_EXEC)), patternMatch(POWERSHELL_DOWNLOAD_EXEC)), patternMatch(PYTHON_FETCH_EXEC)) },
358
+ { id: "execution.remote", title: "Remote code execution pattern", severity: "high", category: "exec", explanation: "Downloaded content is fetched and run without review: piped into a shell or interpreter, fetched and executed in one step, or downloaded and run as separate chained commands.", match: anyMatch(anyMatch(anyMatch(anyMatch(pipelineMatcher(downloads), DOWNLOAD_THEN_EXEC), patternMatch(POWERSHELL_DOWNLOAD_EXEC)), patternMatch(PYTHON_FETCH_EXEC)), patternMatch(FETCH_AND_RUN)) },
142
359
  { id: "execution.obfuscated", title: "Encoded execution", severity: "high", category: "exec", explanation: "Encoded content is decoded for execution. Review the decoded payload separately; Beam never executes it.", match: anyMatch(pipelineMatcher(decodes), patternMatch(/\b(?:powershell|pwsh)\b[^\n]{0,500}?\s-(?:enc|encodedcommand)\b/i)) },
143
360
  { id: "recon.network_sweep", title: "Network sweep", severity: "medium", category: "recon", explanation: "A scanner targets a network range. Verify scope and authorization before the agent probes other systems (ATT&CK T1046).", match: allMatch(patternMatch(/\b(?:nmap|masscan|rustscan)\b/i), patternMatch(/(?:\d{1,3}\.){3}\d{1,3}\/\d{1,2}|(?:\d{1,3}\.){3}\d{1,3}-\d{1,3}/)) },
144
361
  { id: "privilege.elevation", title: "Elevated privileges", severity: "medium", category: "privilege", explanation: "The action requests elevated privileges or broad write permissions.", match: patternMatch(/\bsudo\s|\bdoas\s|(?:^|[\s;&|`(])su\s+(?:-\s*\w*|root)\b|\bpkexec\b|\brunas\s+\/user:|\bchmod\s+(?:-R\s+)?(?:777\b|[ugoa]*\+s\b|[2467][0-7]{3}\b)/i) },
145
362
  { id: "network.metadata", title: "Cloud metadata access", severity: "high", category: "secrets", explanation: "Cloud metadata endpoints can expose temporary instance credentials.", match: patternMatch(/169\.254\.169\.254|metadata\.google\.internal|100\.100\.100\.200/i) },
146
- { id: "persistence.config", title: "Security-sensitive configuration", severity: "high", category: "persistence", explanation: "A persistence or agent configuration target is referenced. Check the intended change and trust boundary.", match: patternMatch(/authorized_keys|\bcrontab\b|LaunchAgents[\\/]|ANTHROPIC_BASE_URL/i) },
147
- { id: "network.reverse-shell", title: "Reverse shell pattern", severity: "critical", category: "exec", explanation: "This pattern can connect a command shell to another machine.", match: patternMatch(/\/dev\/tcp\/|\bnc\b[^\n]{0,300}?\s-e\s|socket[\s\S]{0,200}?subprocess|\bNew-Object\s+(?:System\.)?Net\.Sockets\.TCPClient\b|\bsocat\b[^\n]{0,300}?\bexec[:=]|\bsocket\([^\n]{0,150}?getprotobyname\(["']tcp["']\)[\s\S]{0,200}?\bconnect\(/i) },
363
+ { id: "persistence.config", title: "Security-sensitive configuration", severity: "high", category: "persistence", explanation: "A persistence or agent configuration target is referenced. Check the intended change and trust boundary.",
364
+ // \bcrontab\b matched the "crontab" in crontab.guru (a validator website, not the command), so
365
+ // the bare word needs a guard against being immediately followed by a domain-style ".word".
366
+ // "[Crontab Guru](https://crontab.guru/)" -- a markdown link to the validator site -- still
367
+ // matched via its link *text* ("Crontab Guru"), not just the URL the first guard covers.
368
+ match: patternMatch(/authorized_keys|\bcrontab\b(?!\.\w)(?!\s+Guru\b)|LaunchAgents[\\/]|ANTHROPIC_BASE_URL/i) },
369
+ { id: "network.reverse-shell", title: "Reverse shell pattern", severity: "critical", category: "exec", explanation: "This pattern can connect a command shell to another machine.", match: patternMatch(/\/dev\/tcp\/|\bnc\b[^\n]{0,300}?\s-e\s|\bsocket\b(?=[\s\S]{0,400}?\.connect\s*\()[\s\S]{0,400}?(?:subprocess|pty\.spawn|dup2|\/bin\/(?:ba)?sh)|\bNew-Object\s+(?:System\.)?Net\.Sockets\.TCPClient\b|\bsocat\b[^\n]{0,300}?\bexec[:=]|\bsocket\([^\n]{0,150}?getprotobyname\(["']tcp["']\)[\s\S]{0,200}?\bconnect\(/i) },
148
370
  { id: "instructions.override", title: "Instruction override attempt", severity: "high", category: "integrity", explanation: "Instructions attempt to override existing safeguards or conceal activity from the user. Checked against the same folded view used for prompt-injection monitoring (Unicode/width normalization and base64 decoding), not a literal-text match, so stylized or encoded phrasing is caught too.", match: functionalMatch(promptAttack.override) },
149
371
  { id: "source_control.history_rewrite", title: "Git history rewrite", severity: "medium", category: "source_control", explanation: "Force-pushing or rewriting shared history can silently discard other people's commits. Confirm the branch isn't shared before proceeding.", match: patternMatch(/\bgit\s+push\s+[^\n]{0,1000}?(?:--force(?:-with-lease)?|-f\b)|\bgit\s+filter-(?:branch|repo)\b/i) },
150
372
  { id: "integrity.tls_bypass", title: "Certificate or signature verification disabled", severity: "medium", category: "integrity", explanation: "Disabling TLS/certificate verification removes protection against a tampered or impersonated destination.", match: patternMatch(/\bcurl\b[^\n]{0,1000}?(?:-k\b|--insecure)|\bwget\b[^\n]{0,1000}?--no-check-certificate|NODE_TLS_REJECT_UNAUTHORIZED\s*=\s*['"]?0|\bgit\b[^\n]{0,1000}?-c\s+http\.sslVerify=false|\bverify\s*=\s*False\b|\brejectUnauthorized\s*:\s*false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AC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAa,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;AACjG,CAAC"}
@@ -0,0 +1,23 @@
1
+ import type { ActionContext } from "./action-context.js";
2
+ /** The text that is actually executed: heredoc bodies that are only data (written to a file with
3
+ * cat/tee, or a git/gh message body) are removed; code fed to an interpreter stays. */
4
+ export declare function executedText(text: string): string;
5
+ export declare const PRIVATE_PATH: RegExp;
6
+ export declare const isTemplateEnvPath: (path: string) => boolean;
7
+ export declare const isPrivatePath: (path: string) => boolean;
8
+ /** True when the command opens, loads, copies or feeds a secret file's contents to something. */
9
+ export declare function touchesSecretContent(text: string, context: ActionContext): boolean;
10
+ /** For an apply_patch-style edit ("*** Begin Patch ... *** Update File: path"), the files it
11
+ * touches, one per line. The patch body is code being written, not something that runs, so the
12
+ * secret-access rules should judge the edit by its targets. Undefined for any other text. */
13
+ export declare function patchTargetText(text: string): string | undefined;
14
+ /** True for a lone path to an ordinary source/doc file ("lib/account-password.ts"). The name of
15
+ * such a file says nothing about credentials, so word matches like "password" don't count; only
16
+ * actual secret-file paths do (see `credentials.access`). */
17
+ export declare const isSourceFilePath: (text: string) => boolean;
18
+ export declare function withoutEditorScripts(text: string): string;
19
+ export declare const isStartupOrScriptPath: (path: string) => boolean;
20
+ /** Heredoc bodies that are only data written to a file (cat/tee > f <<EOF) or a message body.
21
+ * Nothing in them runs. Kept: bodies fed to an interpreter or piped into one, and bodies written to
22
+ * a startup or script file. */
23
+ export declare function withoutDataHeredocs(text: string): string;
@@ -0,0 +1,142 @@
1
+ import { basename } from "node:path";
2
+ import { heredocBlocks, shellActionCommands } from "./credential-egress.js";
3
+ // "Does this command USE a secret, or just mention one?" Agents constantly edit, grep and list
4
+ // files whose text contains ".env", "credentials" or "process.env" -- writing code that reads
5
+ // config, checking .gitignore, searching for a variable name. None of that opens a secret file.
6
+ // The shapes that do are loading a dotenv file, reading/copying/printing a private path, or
7
+ // handing one to a program that can read it.
8
+ const PIPES_TO_INTERPRETER = /\|\s*(?:sudo\s+)?(?:(?:ba|z|fi|da)?sh|python[\d.]*|node|bun|ruby|perl|php)\b/;
9
+ const INTERPRETER_HEREDOC = /\b(?:python[23]?|node|bun|deno|ruby|perl|php|bash|sh|zsh|psql|mysql|sqlite3)\b[^<\n]*$/;
10
+ /** The text that is actually executed: heredoc bodies that are only data (written to a file with
11
+ * cat/tee, or a git/gh message body) are removed; code fed to an interpreter stays. */
12
+ export function executedText(text) {
13
+ const blocks = heredocBlocks(text);
14
+ if (!blocks.length)
15
+ return text;
16
+ let out = "";
17
+ let at = 0;
18
+ for (const b of blocks) {
19
+ const opener = b.header.slice(0, b.header.search(/<</)); // what the heredoc is fed to
20
+ if ((INTERPRETER_HEREDOC.test(opener) && !/(?:^|[;&|]\s*)(?:cat|tee)\b[^;&|]*$/.test(opener)) || PIPES_TO_INTERPRETER.test(b.header.slice(b.header.search(/<</))))
21
+ continue;
22
+ out += text.slice(at, b.start);
23
+ at = b.end;
24
+ }
25
+ return out + text.slice(at);
26
+ }
27
+ export const PRIVATE_PATH = /(?:^|[/\\])\.env(?:[.\\/][\w.-]*)?$|(?:^|[/\\])\.env(?:\.[\w-]+)?(?![\w.])|\.ssh[/\\]|\.aws[/\\]credentials\b|id_(?:rsa|ed25519)|\.npmrc\b|\.netrc\b|kubeconfig|\.pgpass\b|credentials\.json|\.docker[/\\]config\.json|\.gnupg[/\\]/i;
28
+ /** Committed templates (.env.example, .env.sample, ...) hold placeholders, not secrets. */
29
+ const TEMPLATE_ENV = /\.env(?:\.[\w-]+)*\.(?:example|sample|template|dist|defaults?)$/i;
30
+ export const isTemplateEnvPath = (path) => TEMPLATE_ENV.test(path.trim());
31
+ export const isPrivatePath = (path) => PRIVATE_PATH.test(path) && !isTemplateEnvPath(path);
32
+ // Code that loads or reads a secret file's contents.
33
+ const CONTENT_LOAD = new RegExp([
34
+ String.raw `\bload_dotenv\s*\(`, String.raw `\bdotenv_values\s*\(`, String.raw `\bdotenv\.config\s*\(`,
35
+ String.raw `\b(?:from|import)\s+dotenv\b`, String.raw `require\(\s*['"]dotenv`,
36
+ String.raw `\b(?:open|readFileSync|readFile|read_text|read_bytes|Path)\s*\([^)\n]{0,160}(?:\.env\b(?!\.(?:example|sample|template|dist|defaults?)\b)|\.aws[/\\]credentials|\.ssh[/\\]|id_(?:rsa|ed25519)|credentials\.json|\.netrc|\.pgpass)`,
37
+ String.raw `(?:^|[;&|\s])(?:source|\.)\s+[^\s;&|]*\.env\b(?!\.(?:example|sample|template|dist|defaults?)\b)`, String.raw `\$\(\s*cat\s+[^)]*\.env\b(?!\.(?:example|sample|template|dist|defaults?)\b)`,
38
+ String.raw `--env-file[=\s]+\S*\.env\b(?!\.(?:example|sample|template|dist|defaults?)\b)`,
39
+ ].join("|"), "i");
40
+ // Commands that take a path but never open its contents.
41
+ const METADATA_ONLY = new Set(["ls", "ll", "la", "stat", "file", "test", "[", "[[", "find", "pgrep", "pkill", "which", "type", "command", "mkdir", "touch", "chmod", "chown", "wc", "echo", "printf", "true", "false", "pwd", "dirname", "basename", "realpath", "readlink", "cd", "git-check-ignore"]);
42
+ const GIT_METADATA = new Set(["ls-files", "check-ignore", "status", "rev-parse", "ls-tree", "add", "rm", "reset", "restore", "clean", "log", "branch", "remote", "config", "stash", "blame-ignore"]);
43
+ function metadataOnly(cmd, args) {
44
+ if (METADATA_ONLY.has(cmd))
45
+ return true;
46
+ if (cmd === "git")
47
+ return GIT_METADATA.has(args.find(a => !a.startsWith("-")) ?? "");
48
+ if (cmd === "grep" || cmd === "rg")
49
+ return args.some(a => /^-[a-zA-Z]*[lLcq][a-zA-Z]*$/.test(a) || a === "--files-with-matches" || a === "--count" || a === "--quiet");
50
+ return false;
51
+ }
52
+ /** True when the command opens, loads, copies or feeds a secret file's contents to something. */
53
+ export function touchesSecretContent(text, context) {
54
+ if (context.actions.some(a => ["file-read", "file-search", "file-write"].includes(a.operation) && isPrivatePath(a.resolvedPath ?? a.target ?? "")))
55
+ return true;
56
+ if (CONTENT_LOAD.test(executedText(text)))
57
+ return true;
58
+ for (const c of shellActionCommands(text)) {
59
+ const tokens = c.tokens;
60
+ let at = 0;
61
+ while (/^[A-Za-z_]\w*=/.test(tokens[at]?.value ?? ""))
62
+ at++;
63
+ if (tokens[at]?.value === "sudo")
64
+ at++;
65
+ const cmd = basename(tokens[at]?.value ?? "").toLowerCase();
66
+ const args = tokens.slice(at + 1).map(t => t.value);
67
+ if (!cmd || !args.some(a => isPrivatePath(a)))
68
+ continue;
69
+ if (!metadataOnly(cmd, args))
70
+ return true;
71
+ }
72
+ return false;
73
+ }
74
+ /** For an apply_patch-style edit ("*** Begin Patch ... *** Update File: path"), the files it
75
+ * touches, one per line. The patch body is code being written, not something that runs, so the
76
+ * secret-access rules should judge the edit by its targets. Undefined for any other text. */
77
+ export function patchTargetText(text) {
78
+ if (!/^\s*\*\*\* Begin Patch\b/.test(text))
79
+ return undefined;
80
+ return [...text.matchAll(/^\*\*\* (?:Add|Update|Delete) File:\s*(.+?)\s*$|^\*\*\* Move to:\s*(.+?)\s*$/gm)].map(m => m[1] ?? m[2]).filter(path => !isTemplateEnvPath(path)).join("\n");
81
+ }
82
+ const SOURCE_PATH = /^[^\s'"]+\.(?:tsx?|jsx?|mjs|cjs|py|go|rs|rb|java|kt|swift|php|cs|cpp|c|h|vue|svelte|css|scss|html|md|mdx|json|ya?ml|toml|sql|sh)$/i;
83
+ /** True for a lone path to an ordinary source/doc file ("lib/account-password.ts"). The name of
84
+ * such a file says nothing about credentials, so word matches like "password" don't count; only
85
+ * actual secret-file paths do (see `credentials.access`). */
86
+ export const isSourceFilePath = (text) => SOURCE_PATH.test(text.trim()) && !PRIVATE_PATH.test(text.trim());
87
+ // A python/node heredoc that only reads a file, rewrites it and writes it back cannot run the
88
+ // command-looking strings it contains ("curl | bash", "rm -rf", "truncate text"): they are text
89
+ // being edited. A body that spawns processes, deletes, fetches, evals or opens a secret file is
90
+ // not treated that way.
91
+ const EDITS_FILE = /\.write_text\(|\.write\(|\bwriteFile(?:Sync)?\(|\bopen\([^)]*['"][wa]b?['"]/;
92
+ const DOES_THINGS = /\bsubprocess\b|\bPopen\b|\bos\.(?:system|popen|remove|unlink|rmdir|removedirs|exec\w*|spawn\w*)\b|\bshutil\b|\brmtree\b|\bunlink\b|\bexec\s*\(|\beval\s*\(|child_process|\bspawn(?:Sync)?\s*\(|\bexec(?:Sync|File)?\s*\(|\bfs\.(?:rm|rmdir|unlink)|\brmSync\b|\brequests\.|\burllib\b|\burlopen\b|\bfetch\s*\(|\bsocket\b|\bsystem\s*\(/;
93
+ // String literals removed, so words inside the file content being written ("subprocess",
94
+ // "requests.", "exec(") don't make a plain editing script look like it does things.
95
+ const STRINGS = /"""[\s\S]*?"""|'''[\s\S]*?'''|"(?:\\.|[^"\\\n])*"|'(?:\\.|[^'\\\n])*'|`(?:\\.|[^`\\])*`/g;
96
+ export function withoutEditorScripts(text) {
97
+ const blocks = heredocBlocks(text);
98
+ if (!blocks.length)
99
+ return text;
100
+ let out = "";
101
+ let at = 0;
102
+ for (const b of blocks) {
103
+ const opener = b.header.slice(0, b.header.search(/<</));
104
+ const body = text.slice(b.start, b.end);
105
+ if (!INTERPRETER_HEREDOC.test(opener) || /(?:^|[;&|]\s*)(?:cat|tee)\b[^;&|]*$/.test(opener))
106
+ continue;
107
+ if (!EDITS_FILE.test(body) || DOES_THINGS.test(body.replace(STRINGS, '""')) || CONTENT_LOAD.test(body))
108
+ continue;
109
+ out += text.slice(at, b.start);
110
+ at = b.end;
111
+ }
112
+ return out + text.slice(at);
113
+ }
114
+ /** Files an agent writes that run later WITHOUT any further action it takes: shell startup files,
115
+ * cron, systemd/launchd units, authorized_keys -- plus shell scripts, which we stay careful with. */
116
+ const STARTUP_OR_SCRIPT = /(?:^|\/)(?:\.(?:bash|zsh|z)?(?:rc|profile|env|login|logout)|\.bash_aliases|crontab|authorized_keys|[^/]*\.(?:sh|bash|zsh|command|ps1|bat|cmd|service|plist|timer))$|^\/etc\/|\/cron[^/]*\/|\/LaunchAgents\/|\/systemd\//i;
117
+ export const isStartupOrScriptPath = (path) => STARTUP_OR_SCRIPT.test(path.trim());
118
+ /** Heredoc bodies that are only data written to a file (cat/tee > f <<EOF) or a message body.
119
+ * Nothing in them runs. Kept: bodies fed to an interpreter or piped into one, and bodies written to
120
+ * a startup or script file. */
121
+ export function withoutDataHeredocs(text) {
122
+ const blocks = heredocBlocks(text);
123
+ if (!blocks.length)
124
+ return text;
125
+ let out = "";
126
+ let at = 0;
127
+ for (const b of blocks) {
128
+ const marker = b.header.search(/<</);
129
+ const opener = b.header.slice(0, marker), rest = b.header.slice(marker);
130
+ if (INTERPRETER_HEREDOC.test(opener) && !/(?:^|[;&|]\s*)(?:cat|tee)\b[^;&|]*$/.test(opener))
131
+ continue;
132
+ if (PIPES_TO_INTERPRETER.test(rest))
133
+ continue;
134
+ const target = /(?:>>?|\btee\s+(?:-a\s+)?)\s*["']?([^\s"'<>|;&]+)/.exec(b.header)?.[1];
135
+ if (target && isStartupOrScriptPath(target))
136
+ continue;
137
+ out += text.slice(at, b.start);
138
+ at = b.end;
139
+ }
140
+ return out + text.slice(at);
141
+ }
142
+ //# sourceMappingURL=secret-use.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"secret-use.js","sourceRoot":"","sources":["../src/secret-use.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACrC,OAAO,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAG5E,+FAA+F;AAC/F,8FAA8F;AAC9F,gGAAgG;AAChG,4FAA4F;AAC5F,6CAA6C;AAE7C,MAAM,oBAAoB,GAAG,8EAA8E,CAAC;AAC5G,MAAM,mBAAmB,GAAG,wFAAwF,CAAC;AAErH;uFACuF;AACvF,MAAM,UAAU,YAAY,CAAC,IAAY;IACvC,MAAM,MAAM,GAAG,aAAa,CAAC,IAAI,CAAC,CAAC;IACnC,IAAI,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C9B,CAAC"}
@@ -41,8 +41,11 @@ export function isMention(line, start, length, kind, near = {}) {
41
41
  const before = `${near.prev ? `${near.prev} ` : ""}${line.slice(0, start)}`.slice(-160);
42
42
  if (NEGATION.test(before.slice(-40)))
43
43
  return true;
44
- if (kind === "command")
45
- return EXAMPLE_FRAMING.test(before) || DETECTION_FRAMING.test(before);
44
+ if (kind === "command") {
45
+ // A blockquote line, or a command aimed at a placeholder host (example.com), is documentation.
46
+ return EXAMPLE_FRAMING.test(before) || DETECTION_FRAMING.test(before) || /^\s*>/.test(line)
47
+ || /\b(?:example\.(?:com|org|net|invalid)|your-?(?:domain|site|host))\b/i.test(line.slice(start, end));
48
+ }
46
49
  // Injection phrases. A bare quote is not enough (`Always start with "ignore previous
47
50
  // instructions"` is still an order); it has to be framed as an example or reviewed, or refused
48
51
  // or explained in the same sentence.