fix sandbox HOME resolution — capture at module load before user-instance overrides it

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-08 07:50:33 +00:00
co-authored by Claude Opus 4.6
parent 11d95a25ab
commit 84d5cf5048
+2 -1
View File
@@ -10,6 +10,7 @@ const BUN_DIR = (() => {
const PROJECT_ROOT = resolve(import.meta.dir, '../../..');
const DATA_PATH = process.env.DATA_PATH ?? join(process.cwd(), 'data');
const HOST_HOME = process.env.HOME!;
// Resolve the OS username for runuser to drop privileges inside the sandbox
const OS_USERNAME = (() => {
@@ -72,7 +73,7 @@ export function buildSandboxPrefix(email: string): string[] {
// Ensure intermediate dirs under HOME are traversable after runuser drops privileges
// (bwrap auto-creates them as root-owned drwx------)
const homeDir = process.env.HOME!;
const homeDir = HOST_HOME;
args.push('--perms', '0755', '--dir', homeDir);
// Bun runtime (e.g. /home/pastilhas/.bun)