Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -658,7 +658,8 @@ Certain sensitive files and directories are **always blocked from writes**, even

**Always-blocked files:**

- Shell config files: `.bashrc`, `.bash_profile`, `.zshrc`, `.zprofile`, `.profile`
- Shell config files: `.bashrc`, `.bash_profile`, `.bash_login`, `.bash_logout`,
`.zshrc`, `.zprofile`, `.profile`
- Git config files: `.gitconfig`, `.gitmodules`
- Other sensitive files: `.ripgreprc`, `.mcp.json`

Expand Down
2 changes: 2 additions & 0 deletions src/sandbox/sandbox-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ export const DANGEROUS_FILES = [
'.gitmodules',
'.bashrc',
'.bash_profile',
'.bash_login',
'.bash_logout',
'.zshrc',
'.zprofile',
'.profile',
Expand Down
16 changes: 16 additions & 0 deletions test/sandbox/mandatory-deny-paths.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ describe.if(isSupportedPlatform)(
// Create ALL dangerous files from DANGEROUS_FILES
writeFileSync(join(TEST_DIR, '.bashrc'), ORIGINAL_CONTENT)
writeFileSync(join(TEST_DIR, '.bash_profile'), ORIGINAL_CONTENT)
writeFileSync(join(TEST_DIR, '.bash_login'), ORIGINAL_CONTENT)
writeFileSync(join(TEST_DIR, '.bash_logout'), ORIGINAL_CONTENT)
writeFileSync(join(TEST_DIR, '.gitconfig'), ORIGINAL_CONTENT)
writeFileSync(join(TEST_DIR, '.gitmodules'), ORIGINAL_CONTENT)
writeFileSync(join(TEST_DIR, '.zshrc'), ORIGINAL_CONTENT)
Expand Down Expand Up @@ -217,6 +219,20 @@ describe.if(isSupportedPlatform)(
expect(readFileSync('.bash_profile', 'utf8')).toBe(ORIGINAL_CONTENT)
})

it('blocks writes to .bash_login', async () => {
const result = await runSandboxedWrite('.bash_login', MODIFIED_CONTENT)

expect(result.success).toBe(false)
expect(readFileSync('.bash_login', 'utf8')).toBe(ORIGINAL_CONTENT)
})

it('blocks writes to .bash_logout', async () => {
const result = await runSandboxedWrite('.bash_logout', MODIFIED_CONTENT)

expect(result.success).toBe(false)
expect(readFileSync('.bash_logout', 'utf8')).toBe(ORIGINAL_CONTENT)
})

it('blocks writes to .zprofile', async () => {
const result = await runSandboxedWrite('.zprofile', MODIFIED_CONTENT)

Expand Down