You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
cache: streaming-path captured-error partial import is never logically evicted — wrong-hash bytes serveable until next GC sweep #835
kind:bugSomething does not behave as documentedkind:securitySecurity impact; report a vulnerability to [email protected], not herekind:testTest coverage, flakes, fixtures or the e2e harnessprio:highNext uprustDependabot: a Cargo update; use area: labels for Rust code otherwise
Surfaced by a full-repository review (2026-06-09).
Finding
When count_and_cap_stream captures a mid-stream error (a BlobTooLargeMarker cap breach or a transient I/O error), iroh-blobs::add_stream still commits the partial bytes under their own BLAKE3 hash. The captured-error branch in pull_through_attempt (crates/cache/src/engine.rs:1676-1697) only drops the temp tag and returns the error — unlike the clean-stream HashMismatch branch (engine.rs:1716-1746) and the drain branch (engine.rs:1807-1820), it never calls self.evict(actual).
Impact
The partial content is a deterministic prefix of attacker-controlled bytes, so an adversarial origin knows the partial-content hash and can request it: engine.has(partial_hash) / engine.get(partial_hash) will serve those bytes until the iroh-blobs GC sweep runs (default gc_interval_sec = 300), and indefinitely if an operator sets gc_interval_sec = 0 (a supported config). This is a cache-poisoning window, not just a disk leak.
The existing test gc_reclaims_cap_breach_partial_bytes (crates/cache/tests/pull_through.rs:315) only asserts GC reclaims the disk; it never asserts !engine.has(partial_hash), so the serving window is untested.
Fix
In the captured-error arm, compute the committed partial hash from the temp tag before dropping it and call self.evict(partial_hash), exactly as the HashMismatch arm does — blocking serving immediately regardless of GC cadence. Add a !engine.has(partial_hash) assertion to the existing test.
Broader cleanup: the three wrong-hash commit/cleanup paths (streaming-mismatch, streaming-captured-error, drain-mismatch) have drifted; unifying them behind one "reject + logical-evict + make-GC-eligible" helper would close this and the drain-path leak (filed separately) together.
Security bug in crates/cache/src/engine.rs: the captured-error arm of pull_through_attempt (lines 1676–1697) drops the temp tag without calling self.evict(partial_hash), so iroh-blobs retains the partial bytes as serveable. Because partial bytes are a deterministic prefix of origin-controlled data, an adversarial origin can precompute the BLAKE3 prefix hash and fetch it directly — bypassing content-addressing integrity until the next GC sweep, or indefinitely if gc_interval_sec = 0. This is a cache-poisoning gap distinct from the disk-leak closed by #518.
📊 Assessment
Dimension
Value
Reasoning
Type
Bug
Incorrect program behaviour with a security impact; not a missing feature
Active cache-poisoning surface in the CDN serving path; must be closed before PoC network deployment
Coding agent
Suitable
Fix is precisely specified: one code path, exact file/line references, a model arm (HashMismatch, 1716–1746) to follow, and a concrete test assertion to add
In the captured-error arm (engine.rs:1676–1697): read the committed partial hash from the TempTagbefore dropping it, then call self.evict(partial_hash) — identical pattern to the HashMismatch arm at 1716–1746.
In crates/cache/tests/pull_through.rs:315 (gc_reclaims_cap_breach_partial_bytes): add assert!(!engine.has(partial_hash)) immediately after the cap-breach error, before the GC assertion — this tests the logical eviction, not just disk reclaim.
Optional but high-value: unify the three wrong-hash cleanup paths (streaming-mismatch, streaming-captured-error, drain-mismatch) behind a single reject_partial(hash) helper that calls evict + makes GC-eligible. This would also close the drain-path leak filed separately.
Key notes for the coding agent:
The partial hash must be extracted from TempTagbefore the tag is dropped; dropping it first makes the hash unavailable.
The HashMismatch arm (engine.rs:1716–1746) is the canonical pattern — the captured-error arm should mirror it exactly for this step.
Transient I/O errors and BlobTooLargeMarker cap breaches both flow through the captured-error arm; both need the eviction.
When gc_interval_sec = 0 (a supported config), the serving window is permanent without this fix — no GC rescue is possible.
kind:bugSomething does not behave as documentedkind:securitySecurity impact; report a vulnerability to [email protected], not herekind:testTest coverage, flakes, fixtures or the e2e harnessprio:highNext uprustDependabot: a Cargo update; use area: labels for Rust code otherwise
Activity
github-actions commentedon Jun 9, 2026
🎯 Triage report
Security bug in
crates/cache/src/engine.rs: the captured-error arm ofpull_through_attempt(lines 1676–1697) drops the temp tag without callingself.evict(partial_hash), so iroh-blobs retains the partial bytes as serveable. Because partial bytes are a deterministic prefix of origin-controlled data, an adversarial origin can precompute the BLAKE3 prefix hash and fetch it directly — bypassing content-addressing integrity until the next GC sweep, or indefinitely ifgc_interval_sec = 0. This is a cache-poisoning gap distinct from the disk-leak closed by #518.📊 Assessment
bug,security,high,rust,testing,poc-blockingaddedHashMismatch, 1716–1746) to follow, and a concrete test assertion to add🔗 Similar issues
💡 Notes and suggestions
Fix checklist:
engine.rs:1676–1697): read the committed partial hash from theTempTagbefore dropping it, then callself.evict(partial_hash)— identical pattern to theHashMismatcharm at 1716–1746.crates/cache/tests/pull_through.rs:315(gc_reclaims_cap_breach_partial_bytes): addassert!(!engine.has(partial_hash))immediately after the cap-breach error, before the GC assertion — this tests the logical eviction, not just disk reclaim.reject_partial(hash)helper that callsevict+ makes GC-eligible. This would also close the drain-path leak filed separately.Key notes for the coding agent:
TempTagbefore the tag is dropped; dropping it first makes the hash unavailable.HashMismatcharm (engine.rs:1716–1746) is the canonical pattern — the captured-error arm should mirror it exactly for this step.BlobTooLargeMarkercap breaches both flow through the captured-error arm; both need the eviction.gc_interval_sec = 0(a supported config), the serving window is permanent without this fix — no GC rescue is possible.Add this agentic workflows to your repo
To install this agentic workflow, run
fix: batch of six quick-win review follow-ups (#845 #864) (#868)
fix(cache): separate DMCA eviction from wrong-hash rejection; reclaim…