fix(exec): close dispatch-wrapper boundary drift

This commit is contained in:
Peter Steinberger
2026-03-07 23:40:05 +00:00
parent adf4eb487b
commit 2fc95a7cfc
4 changed files with 58 additions and 2 deletions

View File

@@ -509,7 +509,9 @@ function hasEnvManipulationBeforeShellWrapperInternal(
depth: number,
envManipulationSeen: boolean,
): boolean {
if (depth >= MAX_DISPATCH_WRAPPER_DEPTH) {
// The wrapper found exactly at the configured dispatch depth boundary still needs
// to participate in approval classification; only paths beyond that boundary fail closed.
if (depth > MAX_DISPATCH_WRAPPER_DEPTH) {
return false;
}
@@ -607,7 +609,9 @@ function extractShellWrapperCommandInternal(
rawCommand: string | null,
depth: number,
): ShellWrapperCommand {
if (depth >= MAX_DISPATCH_WRAPPER_DEPTH) {
// The shell wrapper reached at the boundary depth is still semantically relevant.
// Only deeper wrapper stacks should be dropped as overflow.
if (depth > MAX_DISPATCH_WRAPPER_DEPTH) {
return { isWrapper: false, command: null };
}