Skip to content

feat(fs): add filesystem limits and zip bomb protection - #102

Merged
chaliy merged 3 commits into
mainfrom
claude/investigate-memory-fs-limits-V1y9S
Feb 3, 2026
Merged

feat(fs): add filesystem limits and zip bomb protection#102
chaliy merged 3 commits into
mainfrom
claude/investigate-memory-fs-limits-V1y9S

Conversation

@chaliy

@chaliy chaliy commented Feb 3, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Add FsLimits struct with configurable limits (100MB total, 10MB per file, 10K files default)
  • Enforce limits in InMemoryFs and OverlayFs
  • Add usage() and limits() methods to FileSystem trait
  • Add du and df builtins for disk usage reporting
  • Add zip bomb protection to tar/gzip decompression (max 100:1 ratio)
  • Document filesystem exhaustion and path/name attack vectors in threat model

Test plan

  • Unit tests for FsLimits struct and checks
  • Tests for InMemoryFs limit enforcement (file size, total bytes, file count)
  • Tests for append respecting limits
  • Tests for du and df builtins
  • Tests for zip bomb protection (ratio check, size limits)
  • All 561 library tests passing
  • cargo fmt --check passing
  • cargo clippy -- -D warnings passing

https://claude.ai/code/session_01LFeocdydaMcL67hk9kuHr2

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

- Add FsLimits struct with max_total_bytes (100MB default),
  max_file_size (10MB default), max_file_count (10K default)
- Enforce limits in InMemoryFs write_file/append_file
- Add OverlayFs limit enforcement for combined view
- Add usage() and limits() methods to FileSystem trait
- Add du and df builtins for disk usage reporting
- Add zip bomb protection to tar/gzip decompression:
  - Check decompression ratio (max 100:1)
  - Check output size against limits
- Update threat model with filesystem exhaustion vector
- Add extensive test coverage for all limit scenarios

https://claude.ai/code/session_01LFeocdydaMcL67hk9kuHr2
Add section 1.6 covering:
- Symlink loops (mitigated - no symlink following)
- Deep directory nesting (vulnerable)
- Long filenames (vulnerable)
- Unicode path attacks (vulnerable)

Update vulnerability summary with V8-V10 for path attacks.
Add zip bomb protection and symlink loop mitigations to controls matrix.

https://claude.ai/code/session_01LFeocdydaMcL67hk9kuHr2
du is now a builtin, so it should not be in the list of commands
expected to return exit 127.

https://claude.ai/code/session_01LFeocdydaMcL67hk9kuHr2
@chaliy
chaliy force-pushed the claude/investigate-memory-fs-limits-V1y9S branch from dba6d69 to baa9aea Compare February 3, 2026 04:28
@chaliy
chaliy merged commit 5d1f207 into main Feb 3, 2026
7 checks passed
@chaliy
chaliy deleted the claude/investigate-memory-fs-limits-V1y9S branch February 3, 2026 04:36
chaliy added a commit that referenced this pull request May 30, 2026
## Summary

- Add `FsLimits` struct with configurable limits (100MB total, 10MB per
file, 10K files default)
- Enforce limits in `InMemoryFs` and `OverlayFs`
- Add `usage()` and `limits()` methods to `FileSystem` trait
- Add `du` and `df` builtins for disk usage reporting
- Add zip bomb protection to tar/gzip decompression (max 100:1 ratio)
- Document filesystem exhaustion and path/name attack vectors in threat
model

## Test plan

- [x] Unit tests for `FsLimits` struct and checks
- [x] Tests for `InMemoryFs` limit enforcement (file size, total bytes,
file count)
- [x] Tests for append respecting limits
- [x] Tests for `du` and `df` builtins
- [x] Tests for zip bomb protection (ratio check, size limits)
- [x] All 561 library tests passing
- [x] `cargo fmt --check` passing
- [x] `cargo clippy -- -D warnings` passing

https://claude.ai/code/session_01LFeocdydaMcL67hk9kuHr2

---------

Co-authored-by: Claude <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants