anthropics / anthropics/sandbox-runtime

Bug: Shell config files and other mandatory deny paths are not always protected

Open
#175 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
5.2k
Forks
441
Avg merge
1d 19h
Merged PRs (30d)
12

Description

## Description

`srt` wants to protect shell config / startup files from being changed:

> "Certain sensitive files and directories are always blocked from writes, even if they fall within an allowed write path. This provides defense-in-depth against sandbox escapes and configuration tampering." see [README](https://github.com/anthropic-experimental/sandbox-runtime?tab=readme-ov-file#mandatory-deny-paths-auto-protected-files)

Thus for example `~/.bashrc` should never be writable. However – when I understand the current implementation correctly – `srt` tries to remove access to a `.bashrc` file in the local directory and subdirectories and not in the home directory. Thus `~/.bashrc` is not protected when `srt` is executed in a sub directory of `$HOME` (which should most often be the case).

## Example

At https://github.com/kulla/2026-03-18-testing-srt/tree/main/04-bug-shell-config-files I have created a minimal example. File `settings.json`:

```json
{
"network": {
"allowedDomains": [],
"deniedDomains": [],
"allowUnixSockets": [],
"allowLocalBinding": false
},
"filesystem": {
"denyRead": [],
"allowRead": [],
"allowWrite": ["/home"],
"denyWrite": []
}
}
```

Command:

```bash
srt --settings settings.json 'touch ~/.bashrc && echo Dangerous: ~/.bashrc was changed'
```

The `touch` command was successful and there is the output `Dangerous: ~/.bashrc was changed`. In the DEBUG output there is also a line like:

```
[SandboxDebug] [Sandbox Linux] Skipping non-existent deny path not within allowed paths: /home/kulla/workspace/kulla/2026-03-18-testing-srt/04-bug-shell-config-files/.bashrc
```

Expected behavior is that shell config files are protected even if "$HOME" is writable.

### Workaround

Add `~/.bashrc` and similar files to `denyRead`.

### Notes

* Version: 0.0.42
* OS: Linux (Ubuntu 24.04)

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing the issue with the linked settings.json and the `srt --settings settings.json 'touch ~/.bashrc'` command on Linux. Trace how mandatory deny paths are selected when `/home` is writable, then verify that `~/.bashrc` and similar shell startup files remain protected and the command cannot modify them.

Written by the indexing model from the issue text.

Assessment

Tech stack
linux, typescript
Domain
operating-systems, security
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.