user-local installs for claude and pi, fix sandbox mounts

Move claude and pi from sudo global installs to ~/.local. Claude
binary is copied to /usr/local/bin for sandbox visibility, pi runs
via node from ~/.local/lib (ro-mounted). Fix bwrap intermediate dir
traversal by setting 0755 perms on auto-created HOME dirs.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-08 01:08:45 +00:00
co-authored by Claude Opus 4.6
parent 2f15214cdb
commit ea31014d72
4 changed files with 32 additions and 37 deletions
+12
View File
@@ -65,9 +65,21 @@ export function buildSandboxPrefix(email: string): string[] {
if (existsSync('/lib64')) args.push('--ro-bind', '/lib64', '/lib64');
if (existsSync('/sbin')) args.push('--ro-bind', '/sbin', '/sbin');
// Ensure intermediate dirs under HOME are traversable after runuser drops privileges
// (bwrap auto-creates them as root-owned drwx------)
const homeDir = process.env.HOME!;
args.push('--perms', '0755', '--dir', homeDir);
// Bun runtime (e.g. /home/pastilhas/.bun)
args.push('--ro-bind', BUN_DIR, BUN_DIR);
// npm global packages (~/.local/lib) — pi and its dependencies
const localLib = join(homeDir, '.local', 'lib');
if (existsSync(localLib)) {
args.push('--perms', '0755', '--dir', join(homeDir, '.local'));
args.push('--ro-bind', localLib, localLib);
}
// Project source (for MCP server)
args.push('--ro-bind', PROJECT_ROOT, PROJECT_ROOT);