diff --git a/README.md b/README.md index 14d89686..1d91fc1d 100644 --- a/README.md +++ b/README.md @@ -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` diff --git a/src/sandbox/sandbox-utils.ts b/src/sandbox/sandbox-utils.ts index 93358517..6929d95d 100644 --- a/src/sandbox/sandbox-utils.ts +++ b/src/sandbox/sandbox-utils.ts @@ -13,6 +13,8 @@ export const DANGEROUS_FILES = [ '.gitmodules', '.bashrc', '.bash_profile', + '.bash_login', + '.bash_logout', '.zshrc', '.zprofile', '.profile', diff --git a/test/sandbox/mandatory-deny-paths.test.ts b/test/sandbox/mandatory-deny-paths.test.ts index e82ca64b..f6ea4701 100644 --- a/test/sandbox/mandatory-deny-paths.test.ts +++ b/test/sandbox/mandatory-deny-paths.test.ts @@ -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) @@ -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)