mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-09 09:27:39 +00:00
fix: harden allow-always shell multiplexer wrapper handling
This commit is contained in:
@@ -21,6 +21,7 @@ import {
|
||||
extractShellWrapperInlineCommand,
|
||||
isDispatchWrapperExecutable,
|
||||
isShellWrapperExecutable,
|
||||
unwrapKnownShellMultiplexerInvocation,
|
||||
unwrapKnownDispatchWrapperInvocation,
|
||||
} from "./exec-wrapper-resolution.js";
|
||||
|
||||
@@ -299,6 +300,30 @@ function collectAllowAlwaysPatterns(params: {
|
||||
return;
|
||||
}
|
||||
|
||||
const shellMultiplexerUnwrap = unwrapKnownShellMultiplexerInvocation(params.segment.argv);
|
||||
if (shellMultiplexerUnwrap.kind === "blocked") {
|
||||
return;
|
||||
}
|
||||
if (shellMultiplexerUnwrap.kind === "unwrapped") {
|
||||
collectAllowAlwaysPatterns({
|
||||
segment: {
|
||||
raw: shellMultiplexerUnwrap.argv.join(" "),
|
||||
argv: shellMultiplexerUnwrap.argv,
|
||||
resolution: resolveCommandResolutionFromArgv(
|
||||
shellMultiplexerUnwrap.argv,
|
||||
params.cwd,
|
||||
params.env,
|
||||
),
|
||||
},
|
||||
cwd: params.cwd,
|
||||
env: params.env,
|
||||
platform: params.platform,
|
||||
depth: params.depth + 1,
|
||||
out: params.out,
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
const candidatePath = resolveAllowlistCandidatePath(params.segment.resolution, params.cwd);
|
||||
if (!candidatePath) {
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user