open-standards/wai/http-conformance/falsify/key-log-uncapped.patch
Transaction Science 8f89b25ed4 http receipts round 4: falsify the bounded reads and the key-log cap
Patches bytes-read-whole and key-log-uncapped; bytes-unchecked,
fetch-budget-unchecked and fetch-unmemoised regenerated against the new fetcher.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-09 14:46:34 -04:00

26 lines
1.3 KiB
Diff

# must fail: key_log_anchor_too_large key_log_cached_too_large
# a key log past its cap read, anchored or cached (keys::anchor_retrieved, keys::hold_cached_revisions)
diff --git a/wai/wai-rs/src/http_binding/keys.rs b/wai/wai-rs/src/http_binding/keys.rs
index 68832c79..79700d2c 100644
--- a/wai/wai-rs/src/http_binding/keys.rs
+++ b/wai/wai-rs/src/http_binding/keys.rs
@@ -158,9 +158,6 @@ pub fn anchor_retrieved(
if retrieval.status != 200 {
return Err(KeysRefusal::NotFromOrigin("the answer is not a 200"));
}
- if body.len() > MAX_KEY_LOG_BYTES {
- return Err(KeysRefusal::TooLarge);
- }
let text = std::str::from_utf8(body).map_err(|_| KeysRefusal::Log(Reason::KeyLogMalformed))?;
match anchor_log(origin, text, AnchorPath::Fetched { acquired_at: acquired_at.into() }, current) {
Anchoring::Anchored(a) => Ok(a),
@@ -182,9 +179,6 @@ pub fn hold_cached_revisions(origin: &str, body: &[u8], anchor: &Anchor, held: &
if anchor.origin != origin {
return Err(KeysRefusal::Log(Reason::OriginNotAnchored));
}
- if body.len() > MAX_KEY_LOG_BYTES {
- return Err(KeysRefusal::TooLarge);
- }
let text = std::str::from_utf8(body).map_err(|_| KeysRefusal::Log(Reason::KeyLogMalformed))?;
let revs = read_log(origin, text).map_err(KeysRefusal::Log)?;
let by: BTreeMap<[u8; 32], &Revision> =