@codyswann/lisa 4.101.3 → 4.101.5
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/all/copy-overwrite/scripts/lib/usage-ledger-integrity.mjs +18 -1
- package/all/copy-overwrite/scripts/lib/usage-ledger.d.mts +1 -0
- package/all/copy-overwrite/scripts/lib/usage-ledger.mjs +2 -2
- package/all/copy-overwrite/scripts/npm-updater-helper-graph.json +2 -2
- package/dist/core/lisa-owned-hash-ledger.d.ts.map +1 -1
- package/dist/core/lisa-owned-hash-ledger.js +8 -0
- package/dist/core/lisa-owned-hash-ledger.js.map +1 -1
- package/dist/core/nightly-e2e-guard-behavior-certificate.js +2 -2
- package/dist/core/upstream-evidence-manifest.d.ts.map +1 -1
- package/dist/core/upstream-evidence-manifest.js +17 -8
- package/dist/core/upstream-evidence-manifest.js.map +1 -1
- package/dist/opencode/hooks-installer.d.ts.map +1 -1
- package/dist/opencode/hooks-installer.js +8 -0
- package/dist/opencode/hooks-installer.js.map +1 -1
- package/dist/opencode/plugin-catalog.d.ts.map +1 -1
- package/dist/opencode/plugin-catalog.js +5 -0
- package/dist/opencode/plugin-catalog.js.map +1 -1
- package/dist/opencode/plugin-templates/block-host-name-leak.mjs +511 -0
- package/dist/opencode/plugin-templates/block-host-name-leak.sh +69 -0
- package/dist/opencode/plugin-templates/host-name-command-context.mjs +455 -0
- package/dist/opencode/plugin-templates/lisa-block-host-name-leak.ts +62 -0
- package/dist/utils/usage-accounting.d.ts.map +1 -1
- package/dist/utils/usage-accounting.js +12 -2
- package/dist/utils/usage-accounting.js.map +1 -1
- package/package.json +4 -4
- package/plugins/lisa/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa/hooks/block-host-name-leak.mjs +11 -5
- package/plugins/lisa/hooks/host-name-command-context.mjs +45 -2
- package/plugins/lisa-agy/hooks/block-host-name-leak.mjs +11 -5
- package/plugins/lisa-agy/hooks/host-name-command-context.mjs +45 -2
- package/plugins/lisa-agy/plugin.json +1 -1
- package/plugins/lisa-cdk/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-cdk/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-cdk-agy/plugin.json +1 -1
- package/plugins/lisa-cdk-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-cdk-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-cdk-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-cdk-devin/.devin-plugin/plugin.json +1 -1
- package/plugins/lisa-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-copilot/hooks/block-host-name-leak.mjs +11 -5
- package/plugins/lisa-copilot/hooks/host-name-command-context.mjs +45 -2
- package/plugins/lisa-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-cursor/hooks/block-host-name-leak.mjs +11 -5
- package/plugins/lisa-cursor/hooks/host-name-command-context.mjs +45 -2
- package/plugins/lisa-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-devin/.devin-plugin/plugin.json +1 -1
- package/plugins/lisa-devin/hooks/block-host-name-leak.mjs +11 -5
- package/plugins/lisa-devin/hooks/host-name-command-context.mjs +45 -2
- package/plugins/lisa-expo/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-expo/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-expo-agy/plugin.json +1 -1
- package/plugins/lisa-expo-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-expo-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-expo-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-expo-devin/.devin-plugin/plugin.json +1 -1
- package/plugins/lisa-harper-fabric/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-harper-fabric/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-harper-fabric-agy/plugin.json +1 -1
- package/plugins/lisa-harper-fabric-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-harper-fabric-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-harper-fabric-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-harper-fabric-devin/.devin-plugin/plugin.json +1 -1
- package/plugins/lisa-nestjs/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-nestjs/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-nestjs-agy/plugin.json +1 -1
- package/plugins/lisa-nestjs-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-nestjs-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-nestjs-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-nestjs-devin/.devin-plugin/plugin.json +1 -1
- package/plugins/lisa-openclaw/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-openclaw/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-openclaw-agy/plugin.json +1 -1
- package/plugins/lisa-openclaw-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-openclaw-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-openclaw-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-openclaw-devin/.devin-plugin/plugin.json +1 -1
- package/plugins/lisa-phaser/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-phaser/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-phaser-agy/plugin.json +1 -1
- package/plugins/lisa-phaser-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-phaser-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-phaser-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-phaser-devin/.devin-plugin/plugin.json +1 -1
- package/plugins/lisa-rails/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-rails/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-rails-agy/plugin.json +1 -1
- package/plugins/lisa-rails-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-rails-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-rails-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-rails-devin/.devin-plugin/plugin.json +1 -1
- package/plugins/lisa-typescript/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-typescript/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-typescript-agy/plugin.json +1 -1
- package/plugins/lisa-typescript-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-typescript-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-typescript-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-typescript-devin/.devin-plugin/plugin.json +1 -1
- package/plugins/lisa-wiki/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-wiki/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-wiki-agy/plugin.json +1 -1
- package/plugins/lisa-wiki-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-wiki-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-wiki-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-wiki-devin/.devin-plugin/plugin.json +1 -1
- package/plugins/src/base/hooks/block-host-name-leak.mjs +11 -5
- package/plugins/src/base/hooks/host-name-command-context.mjs +45 -2
- package/scripts/copy-opencode-plugin-templates.mjs +3 -0
- package/scripts/lib/host-name-launcher-cases.mjs +280 -0
- package/scripts/verify-host-name-target-scope.mjs +9 -0
package/package.json
CHANGED
|
@@ -196,7 +196,7 @@
|
|
|
196
196
|
"qs": "^6.16.0"
|
|
197
197
|
},
|
|
198
198
|
"name": "@codyswann/lisa",
|
|
199
|
-
"version": "4.101.
|
|
199
|
+
"version": "4.101.5",
|
|
200
200
|
"description": "Governance-as-code for AI coding agents: turns a repository into agent-operated software factories with guardrails, guidance and automated enforcement for Claude Code, Codex, Cursor, OpenCode, Antigravity, Copilot and Devin",
|
|
201
201
|
"main": "dist/index.js",
|
|
202
202
|
"exports": {
|
|
@@ -359,7 +359,7 @@
|
|
|
359
359
|
"test": "tests"
|
|
360
360
|
},
|
|
361
361
|
"types": "./dist/index.d.ts",
|
|
362
|
-
"lisaReleaseCommit": "
|
|
363
|
-
"gitHead": "
|
|
364
|
-
"lisaReleaseTag": "v4.101.
|
|
362
|
+
"lisaReleaseCommit": "c8b9c2c341f94b26513f1e0609a95da50e19187b",
|
|
363
|
+
"gitHead": "c8b9c2c341f94b26513f1e0609a95da50e19187b",
|
|
364
|
+
"lisaReleaseTag": "v4.101.5"
|
|
365
365
|
}
|
|
@@ -47,11 +47,13 @@
|
|
|
47
47
|
* `dist/` ships to npm, so **this** repository may not name its hosts. A host
|
|
48
48
|
* naming itself carries none of that.
|
|
49
49
|
*
|
|
50
|
-
*
|
|
51
|
-
*
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
*
|
|
50
|
+
* Claude, Codex, Cursor, Antigravity, Copilot and Devin register the canonical
|
|
51
|
+
* plugin guard. OpenCode installs a native tool.execute.before adapter beside
|
|
52
|
+
* the same wrapper/classifier/helper; its package staging adds only the normal
|
|
53
|
+
* ownership banner. It preserves exit0 warnings and exit2 refusals. All seven
|
|
54
|
+
* surfaces therefore share target-scoped policy, rather than refusing a host
|
|
55
|
+
* project's own name. The generic dispatcher copy-overwrite roster remains
|
|
56
|
+
* separate; this guard is not added to that roster.
|
|
55
57
|
*
|
|
56
58
|
* WHERE IT APPLIES: THE TARGET, NOT THE CHECKOUT (#4462)
|
|
57
59
|
*
|
|
@@ -70,6 +72,10 @@
|
|
|
70
72
|
* routing. Unsupported shell syntax, unresolved expansions and ambiguous
|
|
71
73
|
* repositories earn no host exemption. This is bounded command inspection,
|
|
72
74
|
* not shell execution or a claim to close every shell/identity leak class.
|
|
75
|
+
* Literal one-level sh -c and bash -c executable-script operands reuse that
|
|
76
|
+
* inspection with the inherited directory/environment. No other quoted argv
|
|
77
|
+
* is interpreted as code. Dynamic scripts, deeper nesting, other interpreters
|
|
78
|
+
* and other launcher options remain outside this recognition contract.
|
|
73
79
|
*
|
|
74
80
|
* FAILING OPEN, LOUDLY
|
|
75
81
|
*
|
|
@@ -1,4 +1,9 @@
|
|
|
1
|
-
/**
|
|
1
|
+
/**
|
|
2
|
+
* Bounded command/target resolution; submitted scripts are never executed.
|
|
3
|
+
* One literal sh/bash -c script operand is parsed once. Dynamic scripts,
|
|
4
|
+
* deeper launchers, other interpreters and other launcher options are outside
|
|
5
|
+
* this recognition contract, not proof that an unrecognized command is safe.
|
|
6
|
+
*/
|
|
2
7
|
import { execFileSync } from "node:child_process";
|
|
3
8
|
import { statSync } from "node:fs";
|
|
4
9
|
import path from "node:path";
|
|
@@ -204,11 +209,30 @@ export function repositoryFromSpec(spec) {
|
|
|
204
209
|
* @returns {object[]} Active gh calls with their bounded command contexts.
|
|
205
210
|
*/
|
|
206
211
|
export function ghCommands(command, initialCwd, env = process.env) {
|
|
212
|
+
return commandContexts(command, initialCwd, env, true, false);
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
/**
|
|
216
|
+
* Parse a command list, permitting at most one literal executable script slot.
|
|
217
|
+
* @param {string} command Command text, never evaluated.
|
|
218
|
+
* @param {string|undefined} initialCwd Inherited literal directory, if known.
|
|
219
|
+
* @param {object} env Inherited environment.
|
|
220
|
+
* @param {boolean} launcherAllowed Whether one launcher remains in scope.
|
|
221
|
+
* @param {boolean} initialUncertain Whether the parent context is unresolved.
|
|
222
|
+
* @returns {object[]} Active gh calls and their isolated command contexts.
|
|
223
|
+
*/
|
|
224
|
+
function commandContexts(
|
|
225
|
+
command,
|
|
226
|
+
initialCwd,
|
|
227
|
+
env,
|
|
228
|
+
launcherAllowed,
|
|
229
|
+
initialUncertain
|
|
230
|
+
) {
|
|
207
231
|
const calls = [];
|
|
208
232
|
const inherited = { ...env };
|
|
209
233
|
let cwd = initialCwd,
|
|
210
234
|
segment = [],
|
|
211
|
-
uncertain =
|
|
235
|
+
uncertain = initialUncertain;
|
|
212
236
|
const consume = () => {
|
|
213
237
|
if (segment.length === 0) return;
|
|
214
238
|
const local = { ...inherited };
|
|
@@ -263,6 +287,25 @@ export function ghCommands(command, initialCwd, env = process.env) {
|
|
|
263
287
|
env: local,
|
|
264
288
|
certainContext: !uncertain,
|
|
265
289
|
});
|
|
290
|
+
} else if (
|
|
291
|
+
launcherAllowed &&
|
|
292
|
+
segment[index]?.literal &&
|
|
293
|
+
["sh", "bash"].includes(path.basename(executable ?? "")) &&
|
|
294
|
+
segment[index + 1]?.literal &&
|
|
295
|
+
segment[index + 1].value === "-c" &&
|
|
296
|
+
segment[index + 2]?.literal
|
|
297
|
+
) {
|
|
298
|
+
// Only this operand is executable text. Later argv words are $0/$1/etc,
|
|
299
|
+
// not scripts. Child cd/export changes cannot mutate the outer shell.
|
|
300
|
+
calls.push(
|
|
301
|
+
...commandContexts(
|
|
302
|
+
segment[index + 2].value,
|
|
303
|
+
cwd,
|
|
304
|
+
local,
|
|
305
|
+
false,
|
|
306
|
+
uncertain
|
|
307
|
+
)
|
|
308
|
+
);
|
|
266
309
|
} else {
|
|
267
310
|
// A function/source/pushd or unsupported launcher may change the shell
|
|
268
311
|
// context. Do not grant later writes an exemption based on the old cwd.
|
|
@@ -47,11 +47,13 @@
|
|
|
47
47
|
* `dist/` ships to npm, so **this** repository may not name its hosts. A host
|
|
48
48
|
* naming itself carries none of that.
|
|
49
49
|
*
|
|
50
|
-
*
|
|
51
|
-
*
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
*
|
|
50
|
+
* Claude, Codex, Cursor, Antigravity, Copilot and Devin register the canonical
|
|
51
|
+
* plugin guard. OpenCode installs a native tool.execute.before adapter beside
|
|
52
|
+
* the same wrapper/classifier/helper; its package staging adds only the normal
|
|
53
|
+
* ownership banner. It preserves exit0 warnings and exit2 refusals. All seven
|
|
54
|
+
* surfaces therefore share target-scoped policy, rather than refusing a host
|
|
55
|
+
* project's own name. The generic dispatcher copy-overwrite roster remains
|
|
56
|
+
* separate; this guard is not added to that roster.
|
|
55
57
|
*
|
|
56
58
|
* WHERE IT APPLIES: THE TARGET, NOT THE CHECKOUT (#4462)
|
|
57
59
|
*
|
|
@@ -70,6 +72,10 @@
|
|
|
70
72
|
* routing. Unsupported shell syntax, unresolved expansions and ambiguous
|
|
71
73
|
* repositories earn no host exemption. This is bounded command inspection,
|
|
72
74
|
* not shell execution or a claim to close every shell/identity leak class.
|
|
75
|
+
* Literal one-level sh -c and bash -c executable-script operands reuse that
|
|
76
|
+
* inspection with the inherited directory/environment. No other quoted argv
|
|
77
|
+
* is interpreted as code. Dynamic scripts, deeper nesting, other interpreters
|
|
78
|
+
* and other launcher options remain outside this recognition contract.
|
|
73
79
|
*
|
|
74
80
|
* FAILING OPEN, LOUDLY
|
|
75
81
|
*
|
|
@@ -1,4 +1,9 @@
|
|
|
1
|
-
/**
|
|
1
|
+
/**
|
|
2
|
+
* Bounded command/target resolution; submitted scripts are never executed.
|
|
3
|
+
* One literal sh/bash -c script operand is parsed once. Dynamic scripts,
|
|
4
|
+
* deeper launchers, other interpreters and other launcher options are outside
|
|
5
|
+
* this recognition contract, not proof that an unrecognized command is safe.
|
|
6
|
+
*/
|
|
2
7
|
import { execFileSync } from "node:child_process";
|
|
3
8
|
import { statSync } from "node:fs";
|
|
4
9
|
import path from "node:path";
|
|
@@ -204,11 +209,30 @@ export function repositoryFromSpec(spec) {
|
|
|
204
209
|
* @returns {object[]} Active gh calls with their bounded command contexts.
|
|
205
210
|
*/
|
|
206
211
|
export function ghCommands(command, initialCwd, env = process.env) {
|
|
212
|
+
return commandContexts(command, initialCwd, env, true, false);
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
/**
|
|
216
|
+
* Parse a command list, permitting at most one literal executable script slot.
|
|
217
|
+
* @param {string} command Command text, never evaluated.
|
|
218
|
+
* @param {string|undefined} initialCwd Inherited literal directory, if known.
|
|
219
|
+
* @param {object} env Inherited environment.
|
|
220
|
+
* @param {boolean} launcherAllowed Whether one launcher remains in scope.
|
|
221
|
+
* @param {boolean} initialUncertain Whether the parent context is unresolved.
|
|
222
|
+
* @returns {object[]} Active gh calls and their isolated command contexts.
|
|
223
|
+
*/
|
|
224
|
+
function commandContexts(
|
|
225
|
+
command,
|
|
226
|
+
initialCwd,
|
|
227
|
+
env,
|
|
228
|
+
launcherAllowed,
|
|
229
|
+
initialUncertain
|
|
230
|
+
) {
|
|
207
231
|
const calls = [];
|
|
208
232
|
const inherited = { ...env };
|
|
209
233
|
let cwd = initialCwd,
|
|
210
234
|
segment = [],
|
|
211
|
-
uncertain =
|
|
235
|
+
uncertain = initialUncertain;
|
|
212
236
|
const consume = () => {
|
|
213
237
|
if (segment.length === 0) return;
|
|
214
238
|
const local = { ...inherited };
|
|
@@ -263,6 +287,25 @@ export function ghCommands(command, initialCwd, env = process.env) {
|
|
|
263
287
|
env: local,
|
|
264
288
|
certainContext: !uncertain,
|
|
265
289
|
});
|
|
290
|
+
} else if (
|
|
291
|
+
launcherAllowed &&
|
|
292
|
+
segment[index]?.literal &&
|
|
293
|
+
["sh", "bash"].includes(path.basename(executable ?? "")) &&
|
|
294
|
+
segment[index + 1]?.literal &&
|
|
295
|
+
segment[index + 1].value === "-c" &&
|
|
296
|
+
segment[index + 2]?.literal
|
|
297
|
+
) {
|
|
298
|
+
// Only this operand is executable text. Later argv words are $0/$1/etc,
|
|
299
|
+
// not scripts. Child cd/export changes cannot mutate the outer shell.
|
|
300
|
+
calls.push(
|
|
301
|
+
...commandContexts(
|
|
302
|
+
segment[index + 2].value,
|
|
303
|
+
cwd,
|
|
304
|
+
local,
|
|
305
|
+
false,
|
|
306
|
+
uncertain
|
|
307
|
+
)
|
|
308
|
+
);
|
|
266
309
|
} else {
|
|
267
310
|
// A function/source/pushd or unsupported launcher may change the shell
|
|
268
311
|
// context. Do not grant later writes an exemption based on the old cwd.
|
|
@@ -47,11 +47,13 @@
|
|
|
47
47
|
* `dist/` ships to npm, so **this** repository may not name its hosts. A host
|
|
48
48
|
* naming itself carries none of that.
|
|
49
49
|
*
|
|
50
|
-
*
|
|
51
|
-
*
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
*
|
|
50
|
+
* Claude, Codex, Cursor, Antigravity, Copilot and Devin register the canonical
|
|
51
|
+
* plugin guard. OpenCode installs a native tool.execute.before adapter beside
|
|
52
|
+
* the same wrapper/classifier/helper; its package staging adds only the normal
|
|
53
|
+
* ownership banner. It preserves exit0 warnings and exit2 refusals. All seven
|
|
54
|
+
* surfaces therefore share target-scoped policy, rather than refusing a host
|
|
55
|
+
* project's own name. The generic dispatcher copy-overwrite roster remains
|
|
56
|
+
* separate; this guard is not added to that roster.
|
|
55
57
|
*
|
|
56
58
|
* WHERE IT APPLIES: THE TARGET, NOT THE CHECKOUT (#4462)
|
|
57
59
|
*
|
|
@@ -70,6 +72,10 @@
|
|
|
70
72
|
* routing. Unsupported shell syntax, unresolved expansions and ambiguous
|
|
71
73
|
* repositories earn no host exemption. This is bounded command inspection,
|
|
72
74
|
* not shell execution or a claim to close every shell/identity leak class.
|
|
75
|
+
* Literal one-level sh -c and bash -c executable-script operands reuse that
|
|
76
|
+
* inspection with the inherited directory/environment. No other quoted argv
|
|
77
|
+
* is interpreted as code. Dynamic scripts, deeper nesting, other interpreters
|
|
78
|
+
* and other launcher options remain outside this recognition contract.
|
|
73
79
|
*
|
|
74
80
|
* FAILING OPEN, LOUDLY
|
|
75
81
|
*
|
|
@@ -1,4 +1,9 @@
|
|
|
1
|
-
/**
|
|
1
|
+
/**
|
|
2
|
+
* Bounded command/target resolution; submitted scripts are never executed.
|
|
3
|
+
* One literal sh/bash -c script operand is parsed once. Dynamic scripts,
|
|
4
|
+
* deeper launchers, other interpreters and other launcher options are outside
|
|
5
|
+
* this recognition contract, not proof that an unrecognized command is safe.
|
|
6
|
+
*/
|
|
2
7
|
import { execFileSync } from "node:child_process";
|
|
3
8
|
import { statSync } from "node:fs";
|
|
4
9
|
import path from "node:path";
|
|
@@ -204,11 +209,30 @@ export function repositoryFromSpec(spec) {
|
|
|
204
209
|
* @returns {object[]} Active gh calls with their bounded command contexts.
|
|
205
210
|
*/
|
|
206
211
|
export function ghCommands(command, initialCwd, env = process.env) {
|
|
212
|
+
return commandContexts(command, initialCwd, env, true, false);
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
/**
|
|
216
|
+
* Parse a command list, permitting at most one literal executable script slot.
|
|
217
|
+
* @param {string} command Command text, never evaluated.
|
|
218
|
+
* @param {string|undefined} initialCwd Inherited literal directory, if known.
|
|
219
|
+
* @param {object} env Inherited environment.
|
|
220
|
+
* @param {boolean} launcherAllowed Whether one launcher remains in scope.
|
|
221
|
+
* @param {boolean} initialUncertain Whether the parent context is unresolved.
|
|
222
|
+
* @returns {object[]} Active gh calls and their isolated command contexts.
|
|
223
|
+
*/
|
|
224
|
+
function commandContexts(
|
|
225
|
+
command,
|
|
226
|
+
initialCwd,
|
|
227
|
+
env,
|
|
228
|
+
launcherAllowed,
|
|
229
|
+
initialUncertain
|
|
230
|
+
) {
|
|
207
231
|
const calls = [];
|
|
208
232
|
const inherited = { ...env };
|
|
209
233
|
let cwd = initialCwd,
|
|
210
234
|
segment = [],
|
|
211
|
-
uncertain =
|
|
235
|
+
uncertain = initialUncertain;
|
|
212
236
|
const consume = () => {
|
|
213
237
|
if (segment.length === 0) return;
|
|
214
238
|
const local = { ...inherited };
|
|
@@ -263,6 +287,25 @@ export function ghCommands(command, initialCwd, env = process.env) {
|
|
|
263
287
|
env: local,
|
|
264
288
|
certainContext: !uncertain,
|
|
265
289
|
});
|
|
290
|
+
} else if (
|
|
291
|
+
launcherAllowed &&
|
|
292
|
+
segment[index]?.literal &&
|
|
293
|
+
["sh", "bash"].includes(path.basename(executable ?? "")) &&
|
|
294
|
+
segment[index + 1]?.literal &&
|
|
295
|
+
segment[index + 1].value === "-c" &&
|
|
296
|
+
segment[index + 2]?.literal
|
|
297
|
+
) {
|
|
298
|
+
// Only this operand is executable text. Later argv words are $0/$1/etc,
|
|
299
|
+
// not scripts. Child cd/export changes cannot mutate the outer shell.
|
|
300
|
+
calls.push(
|
|
301
|
+
...commandContexts(
|
|
302
|
+
segment[index + 2].value,
|
|
303
|
+
cwd,
|
|
304
|
+
local,
|
|
305
|
+
false,
|
|
306
|
+
uncertain
|
|
307
|
+
)
|
|
308
|
+
);
|
|
266
309
|
} else {
|
|
267
310
|
// A function/source/pushd or unsupported launcher may change the shell
|
|
268
311
|
// context. Do not grant later writes an exemption based on the old cwd.
|
|
@@ -47,11 +47,13 @@
|
|
|
47
47
|
* `dist/` ships to npm, so **this** repository may not name its hosts. A host
|
|
48
48
|
* naming itself carries none of that.
|
|
49
49
|
*
|
|
50
|
-
*
|
|
51
|
-
*
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
*
|
|
50
|
+
* Claude, Codex, Cursor, Antigravity, Copilot and Devin register the canonical
|
|
51
|
+
* plugin guard. OpenCode installs a native tool.execute.before adapter beside
|
|
52
|
+
* the same wrapper/classifier/helper; its package staging adds only the normal
|
|
53
|
+
* ownership banner. It preserves exit0 warnings and exit2 refusals. All seven
|
|
54
|
+
* surfaces therefore share target-scoped policy, rather than refusing a host
|
|
55
|
+
* project's own name. The generic dispatcher copy-overwrite roster remains
|
|
56
|
+
* separate; this guard is not added to that roster.
|
|
55
57
|
*
|
|
56
58
|
* WHERE IT APPLIES: THE TARGET, NOT THE CHECKOUT (#4462)
|
|
57
59
|
*
|
|
@@ -70,6 +72,10 @@
|
|
|
70
72
|
* routing. Unsupported shell syntax, unresolved expansions and ambiguous
|
|
71
73
|
* repositories earn no host exemption. This is bounded command inspection,
|
|
72
74
|
* not shell execution or a claim to close every shell/identity leak class.
|
|
75
|
+
* Literal one-level sh -c and bash -c executable-script operands reuse that
|
|
76
|
+
* inspection with the inherited directory/environment. No other quoted argv
|
|
77
|
+
* is interpreted as code. Dynamic scripts, deeper nesting, other interpreters
|
|
78
|
+
* and other launcher options remain outside this recognition contract.
|
|
73
79
|
*
|
|
74
80
|
* FAILING OPEN, LOUDLY
|
|
75
81
|
*
|
|
@@ -1,4 +1,9 @@
|
|
|
1
|
-
/**
|
|
1
|
+
/**
|
|
2
|
+
* Bounded command/target resolution; submitted scripts are never executed.
|
|
3
|
+
* One literal sh/bash -c script operand is parsed once. Dynamic scripts,
|
|
4
|
+
* deeper launchers, other interpreters and other launcher options are outside
|
|
5
|
+
* this recognition contract, not proof that an unrecognized command is safe.
|
|
6
|
+
*/
|
|
2
7
|
import { execFileSync } from "node:child_process";
|
|
3
8
|
import { statSync } from "node:fs";
|
|
4
9
|
import path from "node:path";
|
|
@@ -204,11 +209,30 @@ export function repositoryFromSpec(spec) {
|
|
|
204
209
|
* @returns {object[]} Active gh calls with their bounded command contexts.
|
|
205
210
|
*/
|
|
206
211
|
export function ghCommands(command, initialCwd, env = process.env) {
|
|
212
|
+
return commandContexts(command, initialCwd, env, true, false);
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
/**
|
|
216
|
+
* Parse a command list, permitting at most one literal executable script slot.
|
|
217
|
+
* @param {string} command Command text, never evaluated.
|
|
218
|
+
* @param {string|undefined} initialCwd Inherited literal directory, if known.
|
|
219
|
+
* @param {object} env Inherited environment.
|
|
220
|
+
* @param {boolean} launcherAllowed Whether one launcher remains in scope.
|
|
221
|
+
* @param {boolean} initialUncertain Whether the parent context is unresolved.
|
|
222
|
+
* @returns {object[]} Active gh calls and their isolated command contexts.
|
|
223
|
+
*/
|
|
224
|
+
function commandContexts(
|
|
225
|
+
command,
|
|
226
|
+
initialCwd,
|
|
227
|
+
env,
|
|
228
|
+
launcherAllowed,
|
|
229
|
+
initialUncertain
|
|
230
|
+
) {
|
|
207
231
|
const calls = [];
|
|
208
232
|
const inherited = { ...env };
|
|
209
233
|
let cwd = initialCwd,
|
|
210
234
|
segment = [],
|
|
211
|
-
uncertain =
|
|
235
|
+
uncertain = initialUncertain;
|
|
212
236
|
const consume = () => {
|
|
213
237
|
if (segment.length === 0) return;
|
|
214
238
|
const local = { ...inherited };
|
|
@@ -263,6 +287,25 @@ export function ghCommands(command, initialCwd, env = process.env) {
|
|
|
263
287
|
env: local,
|
|
264
288
|
certainContext: !uncertain,
|
|
265
289
|
});
|
|
290
|
+
} else if (
|
|
291
|
+
launcherAllowed &&
|
|
292
|
+
segment[index]?.literal &&
|
|
293
|
+
["sh", "bash"].includes(path.basename(executable ?? "")) &&
|
|
294
|
+
segment[index + 1]?.literal &&
|
|
295
|
+
segment[index + 1].value === "-c" &&
|
|
296
|
+
segment[index + 2]?.literal
|
|
297
|
+
) {
|
|
298
|
+
// Only this operand is executable text. Later argv words are $0/$1/etc,
|
|
299
|
+
// not scripts. Child cd/export changes cannot mutate the outer shell.
|
|
300
|
+
calls.push(
|
|
301
|
+
...commandContexts(
|
|
302
|
+
segment[index + 2].value,
|
|
303
|
+
cwd,
|
|
304
|
+
local,
|
|
305
|
+
false,
|
|
306
|
+
uncertain
|
|
307
|
+
)
|
|
308
|
+
);
|
|
266
309
|
} else {
|
|
267
310
|
// A function/source/pushd or unsupported launcher may change the shell
|
|
268
311
|
// context. Do not grant later writes an exemption based on the old cwd.
|
|
@@ -47,11 +47,13 @@
|
|
|
47
47
|
* `dist/` ships to npm, so **this** repository may not name its hosts. A host
|
|
48
48
|
* naming itself carries none of that.
|
|
49
49
|
*
|
|
50
|
-
*
|
|
51
|
-
*
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
*
|
|
50
|
+
* Claude, Codex, Cursor, Antigravity, Copilot and Devin register the canonical
|
|
51
|
+
* plugin guard. OpenCode installs a native tool.execute.before adapter beside
|
|
52
|
+
* the same wrapper/classifier/helper; its package staging adds only the normal
|
|
53
|
+
* ownership banner. It preserves exit0 warnings and exit2 refusals. All seven
|
|
54
|
+
* surfaces therefore share target-scoped policy, rather than refusing a host
|
|
55
|
+
* project's own name. The generic dispatcher copy-overwrite roster remains
|
|
56
|
+
* separate; this guard is not added to that roster.
|
|
55
57
|
*
|
|
56
58
|
* WHERE IT APPLIES: THE TARGET, NOT THE CHECKOUT (#4462)
|
|
57
59
|
*
|
|
@@ -70,6 +72,10 @@
|
|
|
70
72
|
* routing. Unsupported shell syntax, unresolved expansions and ambiguous
|
|
71
73
|
* repositories earn no host exemption. This is bounded command inspection,
|
|
72
74
|
* not shell execution or a claim to close every shell/identity leak class.
|
|
75
|
+
* Literal one-level sh -c and bash -c executable-script operands reuse that
|
|
76
|
+
* inspection with the inherited directory/environment. No other quoted argv
|
|
77
|
+
* is interpreted as code. Dynamic scripts, deeper nesting, other interpreters
|
|
78
|
+
* and other launcher options remain outside this recognition contract.
|
|
73
79
|
*
|
|
74
80
|
* FAILING OPEN, LOUDLY
|
|
75
81
|
*
|
|
@@ -1,4 +1,9 @@
|
|
|
1
|
-
/**
|
|
1
|
+
/**
|
|
2
|
+
* Bounded command/target resolution; submitted scripts are never executed.
|
|
3
|
+
* One literal sh/bash -c script operand is parsed once. Dynamic scripts,
|
|
4
|
+
* deeper launchers, other interpreters and other launcher options are outside
|
|
5
|
+
* this recognition contract, not proof that an unrecognized command is safe.
|
|
6
|
+
*/
|
|
2
7
|
import { execFileSync } from "node:child_process";
|
|
3
8
|
import { statSync } from "node:fs";
|
|
4
9
|
import path from "node:path";
|
|
@@ -204,11 +209,30 @@ export function repositoryFromSpec(spec) {
|
|
|
204
209
|
* @returns {object[]} Active gh calls with their bounded command contexts.
|
|
205
210
|
*/
|
|
206
211
|
export function ghCommands(command, initialCwd, env = process.env) {
|
|
212
|
+
return commandContexts(command, initialCwd, env, true, false);
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
/**
|
|
216
|
+
* Parse a command list, permitting at most one literal executable script slot.
|
|
217
|
+
* @param {string} command Command text, never evaluated.
|
|
218
|
+
* @param {string|undefined} initialCwd Inherited literal directory, if known.
|
|
219
|
+
* @param {object} env Inherited environment.
|
|
220
|
+
* @param {boolean} launcherAllowed Whether one launcher remains in scope.
|
|
221
|
+
* @param {boolean} initialUncertain Whether the parent context is unresolved.
|
|
222
|
+
* @returns {object[]} Active gh calls and their isolated command contexts.
|
|
223
|
+
*/
|
|
224
|
+
function commandContexts(
|
|
225
|
+
command,
|
|
226
|
+
initialCwd,
|
|
227
|
+
env,
|
|
228
|
+
launcherAllowed,
|
|
229
|
+
initialUncertain
|
|
230
|
+
) {
|
|
207
231
|
const calls = [];
|
|
208
232
|
const inherited = { ...env };
|
|
209
233
|
let cwd = initialCwd,
|
|
210
234
|
segment = [],
|
|
211
|
-
uncertain =
|
|
235
|
+
uncertain = initialUncertain;
|
|
212
236
|
const consume = () => {
|
|
213
237
|
if (segment.length === 0) return;
|
|
214
238
|
const local = { ...inherited };
|
|
@@ -263,6 +287,25 @@ export function ghCommands(command, initialCwd, env = process.env) {
|
|
|
263
287
|
env: local,
|
|
264
288
|
certainContext: !uncertain,
|
|
265
289
|
});
|
|
290
|
+
} else if (
|
|
291
|
+
launcherAllowed &&
|
|
292
|
+
segment[index]?.literal &&
|
|
293
|
+
["sh", "bash"].includes(path.basename(executable ?? "")) &&
|
|
294
|
+
segment[index + 1]?.literal &&
|
|
295
|
+
segment[index + 1].value === "-c" &&
|
|
296
|
+
segment[index + 2]?.literal
|
|
297
|
+
) {
|
|
298
|
+
// Only this operand is executable text. Later argv words are $0/$1/etc,
|
|
299
|
+
// not scripts. Child cd/export changes cannot mutate the outer shell.
|
|
300
|
+
calls.push(
|
|
301
|
+
...commandContexts(
|
|
302
|
+
segment[index + 2].value,
|
|
303
|
+
cwd,
|
|
304
|
+
local,
|
|
305
|
+
false,
|
|
306
|
+
uncertain
|
|
307
|
+
)
|
|
308
|
+
);
|
|
266
309
|
} else {
|
|
267
310
|
// A function/source/pushd or unsupported launcher may change the shell
|
|
268
311
|
// context. Do not grant later writes an exemption based on the old cwd.
|