fix: restore docker binds and PATH in sandbox exec (#873)

Thanks @akonyer.

Co-authored-by: Aaron Konyer <aaronk@gomodular.ca>
This commit is contained in:
Peter Steinberger
2026-01-15 02:58:20 +00:00
parent 7a839e7eb6
commit eaace34233
6 changed files with 144 additions and 1 deletions

View File

@@ -60,7 +60,12 @@ export function buildDockerExecArgs(params: {
for (const [key, value] of Object.entries(params.env)) {
args.push("-e", `${key}=${value}`);
}
args.push(params.containerName, "sh", "-lc", params.command);
// Login shell (-l) sources /etc/profile which resets PATH to a minimal set,
// overriding both Docker ENV and -e PATH=... environment variables.
// Prepend custom PATH after profile sourcing to ensure custom tools are accessible
// while preserving system paths that /etc/profile may have added.
const pathExport = params.env.PATH ? `export PATH="${params.env.PATH}:$PATH"; ` : "";
args.push(params.containerName, "sh", "-lc", `${pathExport}${params.command}`);
return args;
}