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
pkgs/id/src/foreign_libsql.rs:864-875 parses the entire chunk-size line as hexadecimal. A valid HTTP/1.1 chunked body `4;foo=bar
Wiki
0
therefore returnsbad chunk sizerather thanWiki. Production HttpTransport::round_trippasses responses throughparse_http_responseat lines 759-765, which invokesdechunk` at 851-856. A compliant server or proxy using chunk extensions can thus break foreign libSQL requests.
The same parser treats the CRLF after chunk data as optional (:885) and returns immediately for a zero chunk (:876-877), accepting incomplete framing such as 4 Wiki0 or 0 . Existing unit cases at :1256-1282 do not cover these inputs. This is based on source inspection; no runtime test was run.
Related: #8504 fixed UTF-8 decoding across chunk boundaries and called for malformed-frame errors, but its byte-based replacement still leaves these framing cases.
Acceptance criteria
Accept valid chunk extensions and decode chunk data correctly, including a valid terminal chunk and trailers.
Reject missing chunk-data delimiters and incomplete terminal/trailer framing with a transport error rather than accepting a truncated response or panicking.
Add focused parser regression tests for valid extensions, malformed and truncated frames, and ordinary responses; use expected decoded bytes or explicit errors as the oracle. Consider a transport-level test exercising a response from a local server.
Agent: repo-worker-code (lane any-a)
State: done — fixed and merged via PR #8746 (squash 8e17b33, 2026-11-14T20:39:10Z); closing this issue with that evidence (the PR referenced #8539 in its title but carried no closing keyword).
Addressed both CodeRabbit findings before landing (commit 90b4e44): folded header lines are now rejected before field interpretation (a folded , gzip continuation could previously ride past the Transfer-Encoding check; RFC 9112 §5.2), and transfer codings are trimmed of HTTP optional whitespace (SP/HTAB) only, so a VT-prefixed chunked is rejected instead of trimmed into acceptance. Both threads replied to and resolved.
Verification (laptop): cargo test -p id --lib foreign_libsql — 26 passed, 0 failed, including the two new regression tests (test_folded_header_fields_are_rejected, test_transfer_coding_whitespace_is_ows_only); cargo fmt --check clean for the touched file.
Activity
developing-today commentedon Nov 11, 2026
CODE-2548
fix(id/libsql): validate chunked HTTP framing (#8539)
fix(id/libsql): validate chunked HTTP framing (#8539) (#8746)
dezren39 commentedon Nov 14, 2026
Agent: repo-worker-code (lane any-a)
State: done — fixed and merged via PR #8746 (squash 8e17b33, 2026-11-14T20:39:10Z); closing this issue with that evidence (the PR referenced #8539 in its title but carried no closing keyword).
Shepherd pass (queue task 17213):
, gzipcontinuation could previously ride past the Transfer-Encoding check; RFC 9112 §5.2), and transfer codings are trimmed of HTTP optional whitespace (SP/HTAB) only, so a VT-prefixedchunkedis rejected instead of trimmed into acceptance. Both threads replied to and resolved.cargo test -p id --lib foreign_libsql— 26 passed, 0 failed, including the two new regression tests (test_folded_header_fields_are_rejected,test_transfer_coding_whitespace_is_ows_only);cargo fmt --checkclean for the touched file.