Repository navigation
fix(sbx): stop mounting the whole $HOME into the microVM (protect host secrets) #6336
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
1620b15
8a8d316
d07a927
ec08fd4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| /** | ||
| * Canonical whitelist of `$HOME` subdirectories that agents legitimately need | ||
| * (tool caches, language toolchains, agent state). | ||
| * | ||
| * This list is the single source of truth shared by **both** sandbox backends | ||
| * so their home-directory exposure stays in sync: | ||
| * | ||
| * - **Compose / chroot mode** (`home-strategy.ts`) mounts an empty home volume | ||
| * and then bind-mounts these subdirs on top, and additionally blanks known | ||
| * credential files with `/dev/null` overlays (`credential-hiding.ts`). | ||
| * - **sbx microVM mode** (`sbx-manager.ts`) mounts these subdirs individually | ||
| * instead of the whole `$HOME`. sbx uses positional (host path == guest path) | ||
| * mounts and cannot express per-file `/dev/null` overlays, so directory | ||
| * curation is its only mechanism — which makes this whitelist the primary | ||
| * protection there. | ||
| * | ||
| * SECURITY: never add a directory whose primary purpose is storing credentials | ||
| * (for example `.aws`, `.ssh`, `.docker`, `.kube`, `.azure`, `.gnupg`). Any such | ||
| * store must stay OUT of the sandbox. Directories listed here can still contain | ||
| * stray secret files; compose mode masks the known ones via | ||
| * `buildCredentialHidingOverlays()`, but sbx cannot, so keep this list to | ||
| * genuinely non-credential tooling paths. | ||
| * | ||
| * `.gemini` is intentionally NOT included: compose mode mounts it only when a | ||
| * Gemini/Google API key is configured, so each caller handles it separately. | ||
| */ | ||
| export const HOME_TOOL_SUBDIRS = [ | ||
| '.cache', | ||
| '.config', | ||
| '.local', | ||
| '.anthropic', | ||
| '.claude', | ||
| '.cargo', | ||
|
Comment on lines
+32
to
+33
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good catch — fixed in d07a927. |
||
| '.rustup', | ||
| '.npm', | ||
| '.nvm', | ||
| ] as const; | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in d07a927.
.copilotand.geminiare no longer appended wholesale — they are now credential-nesting parents, mounted child-by-child withconfig.json(Copilot) andoauth_creds.json/google_accounts.json(Gemini) excluded. Only their safe children (session-state, logs, tmp, settings, etc.) reach the VM. New sbx test asserts the token files never appear in the mount args.