@getmarrow/mcp 3.9.103 → 3.9.107

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 (92) hide show
  1. package/README.md +43 -6
  2. package/dist/approval-reply.d.ts +2 -0
  3. package/dist/approval-reply.d.ts.map +1 -0
  4. package/dist/approval-reply.js +18 -0
  5. package/dist/approval-reply.js.map +1 -0
  6. package/dist/cli.js +1677 -1636
  7. package/dist/cli.js.map +1 -1
  8. package/dist/codex-plugin-pins.d.ts.map +1 -1
  9. package/dist/codex-plugin-pins.js +18 -0
  10. package/dist/codex-plugin-pins.js.map +1 -1
  11. package/dist/env.d.ts +8 -0
  12. package/dist/env.d.ts.map +1 -1
  13. package/dist/env.js +83 -4
  14. package/dist/env.js.map +1 -1
  15. package/dist/hook-context.d.ts.map +1 -1
  16. package/dist/hook-context.js +25 -0
  17. package/dist/hook-context.js.map +1 -1
  18. package/dist/hook-contract.d.ts +4 -3
  19. package/dist/hook-contract.d.ts.map +1 -1
  20. package/dist/hook-contract.js +43 -6
  21. package/dist/hook-contract.js.map +1 -1
  22. package/dist/hook-pre-action.d.ts +43 -7
  23. package/dist/hook-pre-action.d.ts.map +1 -1
  24. package/dist/hook-pre-action.js +518 -21
  25. package/dist/hook-pre-action.js.map +1 -1
  26. package/dist/hook-tool-policy.d.ts +86 -4
  27. package/dist/hook-tool-policy.d.ts.map +1 -1
  28. package/dist/hook-tool-policy.js +354 -21
  29. package/dist/hook-tool-policy.js.map +1 -1
  30. package/dist/hook.d.ts.map +1 -1
  31. package/dist/hook.js +5 -3
  32. package/dist/hook.js.map +1 -1
  33. package/dist/host-approval-state.d.ts +24 -0
  34. package/dist/host-approval-state.d.ts.map +1 -1
  35. package/dist/host-approval-state.js +68 -0
  36. package/dist/host-approval-state.js.map +1 -1
  37. package/dist/host-approval.d.ts +22 -1
  38. package/dist/host-approval.d.ts.map +1 -1
  39. package/dist/host-approval.js +65 -4
  40. package/dist/host-approval.js.map +1 -1
  41. package/dist/index.d.ts +5 -1
  42. package/dist/index.d.ts.map +1 -1
  43. package/dist/index.js +8 -1
  44. package/dist/index.js.map +1 -1
  45. package/dist/keyless-server.d.ts +53 -0
  46. package/dist/keyless-server.d.ts.map +1 -0
  47. package/dist/keyless-server.js +230 -0
  48. package/dist/keyless-server.js.map +1 -0
  49. package/dist/normalized-action.d.ts +11 -3
  50. package/dist/normalized-action.d.ts.map +1 -1
  51. package/dist/normalized-action.js +305 -49
  52. package/dist/normalized-action.js.map +1 -1
  53. package/dist/own-server-identity.d.ts +22 -3
  54. package/dist/own-server-identity.d.ts.map +1 -1
  55. package/dist/own-server-identity.js +108 -31
  56. package/dist/own-server-identity.js.map +1 -1
  57. package/dist/own-tool.d.ts +14 -6
  58. package/dist/own-tool.d.ts.map +1 -1
  59. package/dist/own-tool.js +18 -7
  60. package/dist/own-tool.js.map +1 -1
  61. package/dist/seatbelt/env-dump.d.ts +66 -0
  62. package/dist/seatbelt/env-dump.d.ts.map +1 -0
  63. package/dist/seatbelt/env-dump.js +333 -0
  64. package/dist/seatbelt/env-dump.js.map +1 -0
  65. package/dist/seatbelt/env-names.d.ts +22 -0
  66. package/dist/seatbelt/env-names.d.ts.map +1 -0
  67. package/dist/seatbelt/env-names.js +298 -0
  68. package/dist/seatbelt/env-names.js.map +1 -0
  69. package/dist/seatbelt/fallback-copy.d.ts +16 -0
  70. package/dist/seatbelt/fallback-copy.d.ts.map +1 -0
  71. package/dist/seatbelt/fallback-copy.js +68 -0
  72. package/dist/seatbelt/fallback-copy.js.map +1 -0
  73. package/dist/seatbelt/hook.d.ts +21 -2
  74. package/dist/seatbelt/hook.d.ts.map +1 -1
  75. package/dist/seatbelt/hook.js +45 -11
  76. package/dist/seatbelt/hook.js.map +1 -1
  77. package/dist/seatbelt/mapper.d.ts.map +1 -1
  78. package/dist/seatbelt/mapper.js +1592 -85
  79. package/dist/seatbelt/mapper.js.map +1 -1
  80. package/dist/seatbelt/tables.d.ts +1 -1
  81. package/dist/seatbelt/tables.d.ts.map +1 -1
  82. package/dist/seatbelt/tables.js +13 -17
  83. package/dist/seatbelt/tables.js.map +1 -1
  84. package/dist/secret-paths.d.ts +40 -0
  85. package/dist/secret-paths.d.ts.map +1 -0
  86. package/dist/secret-paths.js +59 -0
  87. package/dist/secret-paths.js.map +1 -0
  88. package/dist/session-loop-guard.d.ts.map +1 -1
  89. package/dist/session-loop-guard.js +25 -6
  90. package/dist/session-loop-guard.js.map +1 -1
  91. package/package.json +2 -2
  92. package/server.json +2 -2
@@ -0,0 +1,66 @@
1
+ /** S4 reasons that mean "prints the environment". The keyed hook keeps only these from a mapper run. */
2
+ export declare const ENV_DUMP_REASONS: ReadonlySet<string>;
3
+ /**
4
+ * Programs that run the command at the end of their argv with a grammar the mapper does not model. A bare `env` or
5
+ * `printenv` as their last word is that command, not a name (`python -m venv env` and `conda activate env` stay fine:
6
+ * those programs are not listed).
7
+ */
8
+ export declare const EXEC_WRAPPERS: ReadonlySet<string>;
9
+ /** `compgen -e`, `-v`, `-A export` and `-A variable` list the names of the environment's variables. */
10
+ export declare function compgenListsVariables(args: ReadonlyArray<string | null>): boolean;
11
+ /** `tmux [options] show-environment` (also `showenv`, a unique prefix, and a command after `\\;`) prints a session's variables. */
12
+ export declare function tmuxShowsEnvironment(args: ReadonlyArray<string | null>): boolean;
13
+ /** `systemctl [--user] show-environment` prints the manager's environment. */
14
+ export declare function systemctlShowsEnvironment(args: ReadonlyArray<string | null>): boolean;
15
+ /**
16
+ * BSD `ps e`, `ps auxe`, `ps eww` and `ps -E` print every process's environment. A word of letters that holds `e`, or a dash
17
+ * cluster that holds `E`, outside the value of an option (`ps -p 1 -o etime` asks for a column, not the environment).
18
+ */
19
+ export declare function psPrintsEnvironment(args: ReadonlyArray<string | null>): boolean;
20
+ /** The older, looser reading of `ps`: any word of letters that holds `e`, option values included. The keyless seatbelt keeps stopping it. */
21
+ export declare function psLooselyPrintsEnvironment(args: ReadonlyArray<string | null>): boolean;
22
+ /** The environment object in a jq filter: `env`, `$ENV` (not a `.env` field, a key, or text in a string). */
23
+ export declare function jqFilterReadsEnvironment(filter: string): boolean;
24
+ /** The filter of a jq command line: the first word that is not an option or an option's value. With -f the program is a file: none. */
25
+ export declare function jqFilters(args: ReadonlyArray<string | null>): string[];
26
+ /** `npm run env` (also pnpm, yarn and bun) runs npm's built-in `env` script, which prints the environment. */
27
+ export declare function packageRunsEnvScript(args: ReadonlyArray<string | null>): boolean;
28
+ export { PROC_ENVIRON, PROC_PROCESS_TREE } from '../secret-paths';
29
+ /** A glob that can name `environ`: `/proc/self/env*`, `/proc/1/*`, `/proc/self/task/1/e[n]viron`. */
30
+ export declare function procGlobMatchesEnviron(path: string): boolean;
31
+ /** `/proc`, `/proc/<pid>` and `/proc/<pid>/task[/<tid>]`: a folder whose recursive read reaches every `environ` under it. */
32
+ export declare const PROC_PROCESS_DIRECTORY: RegExp;
33
+ /** Programs that read or copy every file under a folder named to them. */
34
+ export declare const RECURSIVE_READERS: ReadonlySet<string>;
35
+ /**
36
+ * Inline interpreter code that can start a command (`system`, `exec*`, `popen`, `spawn*`, `passthru`, `proc_open`, `shell_exec`, Lua's `os.execute`,
37
+ * Perl `qx`, backticks, Node's `child_process`, Python's `subprocess`). Used only to decide that a bare `env` / `printenv` operand of the same command
38
+ * line is the command it starts (`perl -e 'system(shift)' env`); code that cannot start a command leaves the operand a plain name.
39
+ */
40
+ export declare const CODE_STARTS_COMMAND: RegExp;
41
+ /** awk code that can start a command: `system(` or a pipe to or from one (not `||`). A bare `getline` reads a file. */
42
+ export declare const AWK_STARTS_COMMAND: RegExp;
43
+ /**
44
+ * Shell code whose command word is an expansion (`"$@"`, `$1`, `$0`, `exec "$@"`, `eval "$1"`, `then $x`): the words after the script text are
45
+ * its positional parameters, and it runs one of them as a command. The captured character names the expansion (`@` or `*` all of them, a digit one
46
+ * of them, a letter a variable that may hold one).
47
+ */
48
+ export declare const SHELL_RUNS_EXPANSION: RegExp;
49
+ /** Interpreter code that reads its environment (`ENVIRON["X"]`, `$ENV{X}`, `os.environ`, `process.env`, `getenv`, `ENV["X"]`). */
50
+ export declare const CODE_READS_ENVIRONMENT: RegExp;
51
+ /**
52
+ * A word a command-running helper may run: the environment printer itself (`env`, `/usr/bin/printenv -0`) or a command line that holds one
53
+ * (`sh -c env`, `command printenv`). A one-word operand that only mentions `env` (`echo`'s argument) is not one unless it starts with it.
54
+ */
55
+ export declare function mayRunEnvPrinter(word: string): boolean;
56
+ /** Variables whose value runs as a command: a pager, editor, askpass or diff helper set to `env` prints the environment. */
57
+ export declare const HELPER_ENV_VARS: ReadonlySet<string>;
58
+ /** A command word that is the environment printer, alone or followed by arguments. */
59
+ export declare const ENV_PRINTER_COMMAND: RegExp;
60
+ /** `man -P env`, `man --pager=printenv`: the pager is the command. */
61
+ export declare function manPagerPrintsEnvironment(args: ReadonlyArray<string | null>): boolean;
62
+ /** strace shows the whole environment of an exec it traces unless its strings are abbreviated: `-v`, `--no-abbrev`, `-e abbrev=none`, `-e verbose=...`. */
63
+ export declare function straceShowsEnvironment(args: ReadonlyArray<string | null>): boolean;
64
+ /** `tmux send-keys env Enter`, `tmux new -d printenv`, `tmux run-shell env`: a command window or pane runs the environment printer. */
65
+ export declare function tmuxRunsEnvironmentPrinter(args: ReadonlyArray<string | null>): boolean;
66
+ //# sourceMappingURL=env-dump.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"env-dump.d.ts","sourceRoot":"","sources":["../../src/seatbelt/env-dump.ts"],"names":[],"mappings":"AAKA,wGAAwG;AACxG,eAAO,MAAM,gBAAgB,EAAE,WAAW,CAAC,MAAM,CAI/C,CAAC;AAEH;;;;GAIG;AACH,eAAO,MAAM,aAAa,EAAE,WAAW,CAAC,MAAM,CAI5C,CAAC;AAIH,uGAAuG;AACvG,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,aAAa,CAAC,MAAM,GAAG,IAAI,CAAC,GAAG,OAAO,CAWjF;AAOD,mIAAmI;AACnI,wBAAg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G;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAEtD;AAED,4HAA4H;AAC5H,eAAO,MAAM,eAAe,EAAE,WAAW,CAAC,MAAM,CAC4E,CAAC;AAE7H,sFAAsF;AACtF,eAAO,MAAM,mBAAmB,QAA2C,CAAC;AAE5E,sEAAsE;AACtE,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,aAAa,CAAC,MAAM,GAAG,IAAI,CAAC,GAAG,OAAO,CASrF;AAED,2JAA2J;AAC3J,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,aAAa,CAAC,MAAM,GAAG,IAAI,CAAC,GAAG,OAAO,CAkBlF;AAQD,uIAAuI;AACvI,wBAAgB,0BAA0B,CAAC,IAAI,EAAE,aAAa,CAAC,MAAM,GAAG,IAAI,CAAC,GAAG,OAAO,CAetF"}
@@ -0,0 +1,333 @@
1
+ "use strict";
2
+ // Env-dump forms: the command shapes this table knows that print many or all environment variables (a known list, not every command a shell can run).
3
+ // One table for both modes: the keyless seatbelt mapper stops them (S4) and the keyed hook policy
4
+ // holds them (hook-tool-policy.ts asks the mapper and keeps only the reasons named here). Pure
5
+ // word-level predicates over literal arguments; no file contents are read.
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.ENV_PRINTER_COMMAND = exports.HELPER_ENV_VARS = exports.CODE_READS_ENVIRONMENT = exports.SHELL_RUNS_EXPANSION = exports.AWK_STARTS_COMMAND = exports.CODE_STARTS_COMMAND = exports.RECURSIVE_READERS = exports.PROC_PROCESS_DIRECTORY = exports.PROC_PROCESS_TREE = exports.PROC_ENVIRON = exports.EXEC_WRAPPERS = exports.ENV_DUMP_REASONS = void 0;
8
+ exports.compgenListsVariables = compgenListsVariables;
9
+ exports.tmuxShowsEnvironment = tmuxShowsEnvironment;
10
+ exports.systemctlShowsEnvironment = systemctlShowsEnvironment;
11
+ exports.psPrintsEnvironment = psPrintsEnvironment;
12
+ exports.psLooselyPrintsEnvironment = psLooselyPrintsEnvironment;
13
+ exports.jqFilterReadsEnvironment = jqFilterReadsEnvironment;
14
+ exports.jqFilters = jqFilters;
15
+ exports.packageRunsEnvScript = packageRunsEnvScript;
16
+ exports.procGlobMatchesEnviron = procGlobMatchesEnviron;
17
+ exports.mayRunEnvPrinter = mayRunEnvPrinter;
18
+ exports.manPagerPrintsEnvironment = manPagerPrintsEnvironment;
19
+ exports.straceShowsEnvironment = straceShowsEnvironment;
20
+ exports.tmuxRunsEnvironmentPrinter = tmuxRunsEnvironmentPrinter;
21
+ /** S4 reasons that mean "prints the environment". The keyed hook keeps only these from a mapper run. */
22
+ exports.ENV_DUMP_REASONS = new Set([
23
+ 'env_dump_env', 'env_dump_set', 'env_dump_export', 'env_dump_declare', 'env_dump_declare_secret', 'env_dump_readonly', 'env_dump_printenv',
24
+ 'env_dump_printenv_secret', 'interpreter_env_dump', 'ps_environment', 'proc_environ', 'env_dump_compgen', 'env_dump_tmux', 'env_dump_systemctl',
25
+ 'env_dump_jq', 'env_dump_strace', 'env_dump_php_info', 'env_dump_npm_run_env', 'tripwire_secret_dumper', 'echo_secret_var',
26
+ ]);
27
+ /**
28
+ * Programs that run the command at the end of their argv with a grammar the mapper does not model. A bare `env` or
29
+ * `printenv` as their last word is that command, not a name (`python -m venv env` and `conda activate env` stay fine:
30
+ * those programs are not listed).
31
+ */
32
+ exports.EXEC_WRAPPERS = new Set([
33
+ 'setpriv', 'unshare', 'runuser', 'nsenter', 'chroot', 'fakeroot', 'fakeroot-sysv', 'fakechroot', 'systemd-run', 'firejail', 'bwrap', 'strace', 'ltrace',
34
+ 'sg', 'proot', 'torsocks', 'proxychains', 'proxychains4', 'tsocks', 'xvfb-run', 'dbus-run-session', 'cross-env', 'env-cmd', 'dotenv', 'dotenvx', 'direnv',
35
+ 'sandbox-exec', 'cgexec', 'sshpass', 'chronic', 'rlwrap',
36
+ ]);
37
+ const letters = (text) => /^[a-zA-Z]+$/.test(text);
38
+ /** `compgen -e`, `-v`, `-A export` and `-A variable` list the names of the environment's variables. */
39
+ function compgenListsVariables(args) {
40
+ for (let i = 0; i < args.length; i += 1) {
41
+ const a = args[i];
42
+ if (a === null)
43
+ continue;
44
+ if (a === '--')
45
+ return false;
46
+ if (/^-A./.test(a)) {
47
+ if (/^(?:export|variable)$/.test(a.slice(2)))
48
+ return true;
49
+ continue;
50
+ }
51
+ if (a === '-A') {
52
+ const v = args[i + 1];
53
+ if (v === 'export' || v === 'variable')
54
+ return true;
55
+ i += 1;
56
+ continue;
57
+ }
58
+ if (/^-[oGWFCXPS]$/.test(a)) {
59
+ i += 1;
60
+ continue;
61
+ }
62
+ if (/^-[a-zA-Z]+$/.test(a) && /[ev]/.test(a.slice(1).replace(/[oGWFCXPS].*$/, '')))
63
+ return true;
64
+ }
65
+ return false;
66
+ }
67
+ /** tmux accepts any unambiguous prefix of a command name or alias: `show-e` and `showe` are show-environment. */
68
+ function tmuxShowEnvironmentWord(word) {
69
+ return (word.length >= 6 && 'show-environment'.startsWith(word)) || (word.length >= 5 && 'showenv'.startsWith(word));
70
+ }
71
+ /** `tmux [options] show-environment` (also `showenv`, a unique prefix, and a command after `\\;`) prints a session's variables. */
72
+ function tmuxShowsEnvironment(args) {
73
+ let i = 0;
74
+ // Global options come before the first command: -S, -L, -f, -c and -T take a value.
75
+ while (i < args.length && args[i] !== null && args[i].startsWith('-') && args[i] !== '-')
76
+ i += /^-[SLfcT]$/.test(args[i]) ? 2 : 1;
77
+ let commandStart = true;
78
+ for (; i < args.length; i += 1) {
79
+ const a = args[i];
80
+ if (a === ';' || a === '\\;') {
81
+ commandStart = true;
82
+ continue;
83
+ }
84
+ if (a !== null && commandStart && tmuxShowEnvironmentWord(a))
85
+ return true;
86
+ commandStart = false;
87
+ }
88
+ return false;
89
+ }
90
+ /** `systemctl [--user] show-environment` prints the manager's environment. */
91
+ function systemctlShowsEnvironment(args) {
92
+ return args.some((a) => a === 'show-environment');
93
+ }
94
+ /**
95
+ * BSD `ps e`, `ps auxe`, `ps eww` and `ps -E` print every process's environment. A word of letters that holds `e`, or a dash
96
+ * cluster that holds `E`, outside the value of an option (`ps -p 1 -o etime` asks for a column, not the environment).
97
+ */
98
+ function psPrintsEnvironment(args) {
99
+ const longWithValue = /^--(?:sort|pid|ppid|user|User|group|Group|tty|sid|format|cols|columns|width|lines|rows|quick-pid)$/;
100
+ for (let i = 0; i < args.length; i += 1) {
101
+ const a = args[i];
102
+ if (a === null)
103
+ continue;
104
+ if (a.startsWith('--')) {
105
+ if (longWithValue.test(a))
106
+ i += 1;
107
+ continue;
108
+ }
109
+ if (/^-[a-zA-Z]+$/.test(a)) {
110
+ for (let k = 1; k < a.length; k += 1) {
111
+ if (a[k] === 'E')
112
+ return true;
113
+ if ('oOpquUgGstCnND'.includes(a[k])) {
114
+ if (k === a.length - 1)
115
+ i += 1;
116
+ break;
117
+ }
118
+ }
119
+ continue;
120
+ }
121
+ if (letters(a)) {
122
+ for (let k = 0; k < a.length; k += 1) {
123
+ if (a[k] === 'e')
124
+ return true;
125
+ if ('oOpqUgGstCnND'.includes(a[k])) {
126
+ if (k === a.length - 1)
127
+ i += 1;
128
+ break;
129
+ }
130
+ }
131
+ }
132
+ }
133
+ return false;
134
+ }
135
+ /** The older, looser reading of `ps`: any word of letters that holds `e`, option values included. The keyless seatbelt keeps stopping it. */
136
+ function psLooselyPrintsEnvironment(args) {
137
+ return args.some((a) => a !== null && letters(a) && a.includes('e'));
138
+ }
139
+ /** The environment object in a jq filter: `env`, `$ENV` (not a `.env` field, a key, or text in a string). */
140
+ function jqFilterReadsEnvironment(filter) {
141
+ const code = filter.replace(/"(?:[^"\\]|\\.)*"/g, '""');
142
+ return /\$ENV\b/.test(code) || /(?<![.$\w])env\b(?!\s*[:,}])/.test(code);
143
+ }
144
+ /** The filter of a jq command line: the first word that is not an option or an option's value. With -f the program is a file: none. */
145
+ function jqFilters(args) {
146
+ for (let i = 0; i < args.length; i += 1) {
147
+ const a = args[i];
148
+ if (a === null)
149
+ continue;
150
+ if (a === '--arg' || a === '--argjson' || a === '--slurpfile' || a === '--rawfile') {
151
+ i += 2;
152
+ continue;
153
+ }
154
+ if (a === '--indent') {
155
+ i += 1;
156
+ continue;
157
+ }
158
+ if (a === '--from-file' || /^-[a-zA-Z]*f$/.test(a))
159
+ return [];
160
+ if (a.startsWith('-') && a !== '-')
161
+ continue;
162
+ return [a];
163
+ }
164
+ return [];
165
+ }
166
+ const RUN_SCRIPT_WORDS = new Set(['run', 'run-script', 'rum', 'urn']);
167
+ /** `npm run env` (also pnpm, yarn and bun) runs npm's built-in `env` script, which prints the environment. */
168
+ function packageRunsEnvScript(args) {
169
+ const at = args.findIndex((a) => a !== null && RUN_SCRIPT_WORDS.has(a));
170
+ if (at < 0)
171
+ return false;
172
+ for (let i = at + 1; i < args.length; i += 1) {
173
+ const a = args[i];
174
+ if (a === null)
175
+ return false;
176
+ if (a.startsWith('-')) {
177
+ if (a === '--prefix' || a === '-C' || a === '--workspace' || a === '-w' || a === '--cwd')
178
+ i += 1;
179
+ continue;
180
+ }
181
+ return a === 'env';
182
+ }
183
+ return false;
184
+ }
185
+ var secret_paths_1 = require("../secret-paths");
186
+ Object.defineProperty(exports, "PROC_ENVIRON", { enumerable: true, get: function () { return secret_paths_1.PROC_ENVIRON; } });
187
+ Object.defineProperty(exports, "PROC_PROCESS_TREE", { enumerable: true, get: function () { return secret_paths_1.PROC_PROCESS_TREE; } });
188
+ /** A glob that can name `environ`: `/proc/self/env*`, `/proc/1/*`, `/proc/self/task/1/e[n]viron`. */
189
+ function procGlobMatchesEnviron(path) {
190
+ const m = /^\/proc\/[^/]+\/(?:task\/[^/]+\/)?([^/]*[*?[][^/]*)$/.exec(path);
191
+ if (!m)
192
+ return false;
193
+ let source = '';
194
+ for (let i = 0; i < m[1].length; i += 1) {
195
+ const ch = m[1][i];
196
+ if (ch === '*')
197
+ source += '.*';
198
+ else if (ch === '?')
199
+ source += '.';
200
+ else if (ch === '[') {
201
+ const end = m[1].indexOf(']', i + 2);
202
+ if (end < 0)
203
+ return true;
204
+ const body = m[1].slice(i + 1, end).replace(/^[!^]/, '');
205
+ source += `[${body.replace(/[\\\]^]/g, '\\$&')}]`;
206
+ i = end;
207
+ }
208
+ else
209
+ source += ch.replace(/[.+^${}()|\\]/g, '\\$&');
210
+ }
211
+ try {
212
+ return new RegExp(`^${source}$`).test('environ');
213
+ }
214
+ catch {
215
+ return true;
216
+ }
217
+ }
218
+ /** `/proc`, `/proc/<pid>` and `/proc/<pid>/task[/<tid>]`: a folder whose recursive read reaches every `environ` under it. */
219
+ exports.PROC_PROCESS_DIRECTORY = /^\/proc(?:\/[^/]+(?:\/task(?:\/[^/]+)?)?)?\/?$/;
220
+ /** Programs that read or copy every file under a folder named to them. */
221
+ exports.RECURSIVE_READERS = new Set(['grep', 'egrep', 'fgrep', 'rg', 'ag', 'ack', 'tar', 'gtar', 'bsdtar', 'cp', 'rsync', 'zip', 'scp']);
222
+ /**
223
+ * Inline interpreter code that can start a command (`system`, `exec*`, `popen`, `spawn*`, `passthru`, `proc_open`, `shell_exec`, Lua's `os.execute`,
224
+ * Perl `qx`, backticks, Node's `child_process`, Python's `subprocess`). Used only to decide that a bare `env` / `printenv` operand of the same command
225
+ * line is the command it starts (`perl -e 'system(shift)' env`); code that cannot start a command leaves the operand a plain name.
226
+ */
227
+ exports.CODE_STARTS_COMMAND = /\b(?:system|exec(?:l[pe]?|v[pe]{0,2}|ute|File(?:Sync)?|Sync)?|fork|qx|Open3|passthru|shell_exec)\b|spawn(?:Sync|[lv][pe]{0,2})?\b|popen|proc_open|child_process|subprocess|`/;
228
+ /** awk code that can start a command: `system(` or a pipe to or from one (not `||`). A bare `getline` reads a file. */
229
+ exports.AWK_STARTS_COMMAND = /\bsystem\s*\(|(?<!\|)\|&?\s*["'$a-zA-Z(]/;
230
+ /**
231
+ * Shell code whose command word is an expansion (`"$@"`, `$1`, `$0`, `exec "$@"`, `eval "$1"`, `then $x`): the words after the script text are
232
+ * its positional parameters, and it runs one of them as a command. The captured character names the expansion (`@` or `*` all of them, a digit one
233
+ * of them, a letter a variable that may hold one).
234
+ */
235
+ exports.SHELL_RUNS_EXPANSION = /(?:^|[;&|({\n]|\b(?:exec|eval|command|builtin|nohup|time|sudo|env|xargs|nice|timeout|setsid|then|else|do))\s*["']?\$\{?([@*0-9A-Za-z_#!])/;
236
+ /** Interpreter code that reads its environment (`ENVIRON["X"]`, `$ENV{X}`, `os.environ`, `process.env`, `getenv`, `ENV["X"]`). */
237
+ exports.CODE_READS_ENVIRONMENT = /\bENVIRON\b|\bENV\b|\benviron\b|getenv|process\.env|\$_ENV|\$_SERVER/;
238
+ /**
239
+ * A word a command-running helper may run: the environment printer itself (`env`, `/usr/bin/printenv -0`) or a command line that holds one
240
+ * (`sh -c env`, `command printenv`). A one-word operand that only mentions `env` (`echo`'s argument) is not one unless it starts with it.
241
+ */
242
+ function mayRunEnvPrinter(word) {
243
+ return exports.ENV_PRINTER_COMMAND.test(word) || (/\s/.test(word) && /\b(?:env|printenv)\b/.test(word));
244
+ }
245
+ /** Variables whose value runs as a command: a pager, editor, askpass or diff helper set to `env` prints the environment. */
246
+ exports.HELPER_ENV_VARS = new Set(['PAGER', 'GIT_PAGER', 'MANPAGER', 'EDITOR', 'VISUAL', 'GIT_EDITOR', 'GIT_SEQUENCE_EDITOR', 'GIT_EXTERNAL_DIFF',
247
+ 'GIT_SSH_COMMAND', 'GIT_SSH', 'GIT_ASKPASS', 'SSH_ASKPASS', 'BROWSER', 'LESSOPEN', 'GIT_PROXY_COMMAND', 'PROMPT_COMMAND']);
248
+ /** A command word that is the environment printer, alone or followed by arguments. */
249
+ exports.ENV_PRINTER_COMMAND = /^\s*(?:\S*\/)?(?:env|printenv)(?:\s|$)/;
250
+ /** `man -P env`, `man --pager=printenv`: the pager is the command. */
251
+ function manPagerPrintsEnvironment(args) {
252
+ for (let i = 0; i < args.length; i += 1) {
253
+ const a = args[i];
254
+ if (a === null)
255
+ continue;
256
+ if ((a === '-P' || a === '--pager') && args[i + 1] != null && exports.ENV_PRINTER_COMMAND.test(args[i + 1]))
257
+ return true;
258
+ const m = /^(?:--pager=|-P)([\s\S]+)$/.exec(a);
259
+ if (m && exports.ENV_PRINTER_COMMAND.test(m[1]))
260
+ return true;
261
+ }
262
+ return false;
263
+ }
264
+ /** strace shows the whole environment of an exec it traces unless its strings are abbreviated: `-v`, `--no-abbrev`, `-e abbrev=none`, `-e verbose=...`. */
265
+ function straceShowsEnvironment(args) {
266
+ for (let i = 0; i < args.length; i += 1) {
267
+ const a = args[i];
268
+ if (a === null)
269
+ continue;
270
+ if (a === '--')
271
+ return false;
272
+ if (a === '--no-abbrev')
273
+ return true;
274
+ if (a === '-e' || a === '--trace' || a === '--abbrev' || a === '--verbose') {
275
+ if (/(?:abbrev\s*=\s*none|verbose)/.test(String(args[i + 1] ?? '')))
276
+ return true;
277
+ i += a === '-e' || a === '--trace' ? 1 : 0;
278
+ continue;
279
+ }
280
+ if (/^-e./.test(a)) {
281
+ if (/(?:abbrev\s*=\s*none|verbose)/.test(a))
282
+ return true;
283
+ continue;
284
+ }
285
+ if (/^-[a-zA-Z]+$/.test(a)) {
286
+ for (let k = 1; k < a.length; k += 1) {
287
+ if (a[k] === 'v')
288
+ return true;
289
+ if ('eopsEuOSabPIUX'.includes(a[k])) {
290
+ if (k === a.length - 1)
291
+ i += 1;
292
+ break;
293
+ }
294
+ }
295
+ continue;
296
+ }
297
+ if (!a.startsWith('-'))
298
+ return false;
299
+ }
300
+ return false;
301
+ }
302
+ const TMUX_COMMAND_VALUE_FLAGS = {
303
+ 'send-keys': 'tNc', send: 'tNc', 'run-shell': 'cdt', run: 'cdt', 'new-session': 'cefFnstxy', new: 'cefFnstxy', 'new-window': 'cenFt', neww: 'cenFt',
304
+ 'split-window': 'ceFltp', splitw: 'ceFltp', 'respawn-pane': 'cet', respawnp: 'cet', 'respawn-window': 'cet', respawnw: 'cet', 'pipe-pane': 't', pipep: 't',
305
+ 'if-shell': 't', if: 't',
306
+ };
307
+ /** `tmux send-keys env Enter`, `tmux new -d printenv`, `tmux run-shell env`: a command window or pane runs the environment printer. */
308
+ function tmuxRunsEnvironmentPrinter(args) {
309
+ let i = 0;
310
+ while (i < args.length && args[i] !== null && args[i].startsWith('-') && args[i] !== '-')
311
+ i += /^-[SLfcT]$/.test(args[i]) ? 2 : 1;
312
+ const name = args[i];
313
+ if (name === null || name === undefined || !(name in TMUX_COMMAND_VALUE_FLAGS))
314
+ return false;
315
+ const valueFlags = TMUX_COMMAND_VALUE_FLAGS[name];
316
+ for (i += 1; i < args.length; i += 1) {
317
+ const a = args[i];
318
+ if (a === null)
319
+ continue;
320
+ if (a === ';' || a === '\\;')
321
+ return false;
322
+ if (/^-[a-zA-Z]$/.test(a) && valueFlags.includes(a[1])) {
323
+ i += 1;
324
+ continue;
325
+ }
326
+ if (a.startsWith('-') && a.length > 1)
327
+ continue;
328
+ if (/^(?:\S*\/)?(?:env|printenv)$/.test(a))
329
+ return true;
330
+ }
331
+ return false;
332
+ }
333
+ //# sourceMappingURL=env-dump.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"env-dump.js","sourceRoot":"","sources":["../../src/seatbelt/env-dump.ts"],"names":[],"mappings":";AAAA,sJAAsJ;AACtJ,kGAAkG;AAClG,+FAA+F;AAC/F,2EAA2E;;;AAuB3E,sDAWC;AAQD,oDAYC;AAGD,8DAEC;AAMD,kDAqBC;AAGD,gEAEC;AAGD,4DAGC;AAGD,8BAWC;AAKD,oDAUC;AAKD,wDAiBC;AAgCD,4CAEC;AAUD,8DASC;AAGD,wDAkBC;AASD,gEAeC;AApPD,wGAAwG;AAC3F,QAAA,gBAAgB,GAAwB,IAAI,GAAG,CAAC;IAC3D,cAAc,EAAE,cAAc,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,yBAAyB,EAAE,mBAAmB,EAAE,mBAAmB;IAC1I,0BAA0B,EAAE,sBAAsB,EAAE,gBAAgB,EAAE,cAAc,EAAE,kBAAkB,EAAE,eAAe,EAAE,oBAAoB;IAC/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CAAC;IAC7F,MAAM,UAAU,GAAG,wBAAwB,CAAC,IAAI,CAAC,CAAC;IAClD,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC;QACrC,MAAM,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,IAAI,CAAC,KAAK,IAAI;YAAE,SAAS;QACzB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,KAAK;YAAE,OAAO,KAAK,CAAC;QAC3C,IAAI,aAAa,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,UAAU,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;YAAC,CAAC,IAAI,CAAC,CAAC;YAAC,SAAS;QAAC,CAAC;QAC7E,IAAI,CAAC,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,MAAM,GAAG,CAAC;YAAE,SAAS;QAChD,IAAI,8BAA8B,CAAC,IAAI,CAAC,CAAC,CAAC;YAAE,OAAO,IAAI,CAAC;IAC1D,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
@@ -0,0 +1,22 @@
1
+ /** `secret`: read as a secret env file by its name alone; `present`: `<name>.env`, which the shared table reads only where the file is there. */
2
+ export type EnvNameKind = 'secret' | 'present' | null;
3
+ /** The basename of a path as written (the last segment, a trailing slash ignored). */
4
+ export declare function lastSegment(text: string): string;
5
+ /**
6
+ * A basename the shared secret table reads as an env file: `.env`, `.env.<word>` (a template such as `.env.example` is not) and `.dev.vars`, whatever the case
7
+ * (the same case-blind reading the keyed policy has); `<name>.env` is `present`. The table stays the one source (src/secret-paths.ts): this only repeats
8
+ * its name rules for a word that is not yet a path.
9
+ */
10
+ export declare function secretEnvBase(base: string): EnvNameKind;
11
+ /** Names a glob that cannot be listed is judged against, besides the mapper's own samples: common secret env names a project holds. */
12
+ export declare const ENV_NAME_CORPUS: readonly string[];
13
+ /** The host side of a `-v`/`--volume` value `host:container[:options]`: the text before the first colon; null with no colon (an anonymous volume) or an empty host. */
14
+ export declare function volumeHost(value: string): string | null;
15
+ /** The `source=` / `src=` values of a `--mount` value (comma-separated `key=value` fields): every one, a repeated key included, whatever the mount type. */
16
+ export declare function mountSources(value: string): string[];
17
+ /**
18
+ * Whether a find `-regex` pattern matches any of the candidate paths (the whole path, as find matches it), read as emacs and as extended syntax.
19
+ * `unsure`: neither reading could be completed (unreadable syntax, too large, out of steps) and none matched.
20
+ */
21
+ export declare function regexMatchesAny(pattern: string, candidates: readonly string[]): 'yes' | 'no' | 'unsure';
22
+ //# sourceMappingURL=env-names.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"env-names.d.ts","sourceRoot":"","sources":["../../src/seatbelt/env-names.ts"],"names":[],"mappings":"AAKA,iJAAiJ;AACjJ,MAAM,MAAM,WAAW,GAAG,QAAQ,GAAG,SAAS,GAAG,IAAI,CAAC;AAEtD,sFAAsF;AACtF,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAGhD;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,WAAW,CAMvD;AAED,uIAAuI;AACvI,eAAO,MAAM,eAAe,EAAE,SAAS,MAAM,EAI5C,CAAC;AAEF,uKAAuK;AACvK,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAGvD;AAED,4JAA4J;AAC5J,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,CAOpD;AAoKD;;;GAGG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,SAAS,MAAM,EAAE,GAAG,KAAK,GAAG,IAAI,GAAG,QAAQ,CAWvG"}