fix(snapshot): enforce fs limits before expanding v2 snapshot chunks - #2282
Merged
chaliy merged 1 commit intoAug 7, 2026
Merged
Conversation
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
bashkit | 07f7b8c | Commit Preview URL | Aug 07 2026, 09:39 AM |
chaliy
force-pushed
the
2026-08-07-fix-resource-exhaustion-vulnerability-in-v2-snapshot
branch
from
August 7, 2026 09:26
7804e4f to
aa20e93
Compare
chaliy
force-pushed
the
2026-08-07-fix-resource-exhaustion-vulnerability-in-v2-snapshot
branch
from
August 7, 2026 09:39
aa20e93 to
07f7b8c
Compare
chaliy
deleted the
2026-08-07-fix-resource-exhaustion-vulnerability-in-v2-snapshot
branch
August 7, 2026 09:48
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
SnapshotGraph::materializebefore the target filesystem'sFsLimitswere applied, allowing small containers to expand to gigabytes and cause OOM/CPU exhaustion (TM-SNAP-004).Description
FsLimitsintoSnapshotGraph::materializeand intodecode_sealedso decoding uses the live filesystem limits rather than always materializing up to the old 4GiB backstop. (crates/bashkit/src/snapshot/mod.rs,crates/bashkit/src/snapshot/graph.rs).CheckoutBudgetderived fromFsLimitsand enforce per-file (max_file_size) and aggregate (max_total_bytes) checks before allocating or expanding chunked files; retain the 4GiB absolute ceiling only as a final backstop for unlimited backends. (SnapshotGraph::materialize,resolve_file).configured_file_limit_is_refused_before_materializing_chunksvalidating that configured per-file limits reject repeated-chunk manifests before expansion, and update existing snapshot graph tests to use the new budget API. (crates/bashkit/src/snapshot/graph.rstests).knowledge/security/threat-model.md,crates/bashkit/docs/threat-model.md).Testing
cargo test -p bashkit snapshot::graph::tests --no-default-featuresand all tests passed (7/7).cargo fmt --all -- --checkandjust check-okf, both succeeded.cargo testinvocation for the crate test profile used above and the focused integration/security checks in CI slices; the modified snapshot tests passed in that run.Codex Task