Repository navigation
Conversation
Signing setup fetched x.com without the session, and logged-out pages no longer embed the ondemand script, so ClientTransaction::new failed with "Couldn't find ondemand file" before any credential was checked. - Fetch the signing page with the session cookies, via a scoped cookie jar so they are only sent to x.com over HTTPS and never to the script CDN. - Pin x-client-transaction to its repository HEAD: the published 0.1.0 cannot parse X's current numeric ondemand chunk map. - Give the blocking signing client a timeout, and reword the auth wizard error that blamed cookies for what are signing or network failures.
jaypopat
force-pushed
the
fix/x-session-signing
branch
from
September 16, 2026 00:28
9f1dea7 to
5644d43
Compare
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.
Problem
twit authfails before it ever checks the cookies:The cookies are fine — request signing never got off the ground, and the wizard
blamed the wrong thing.
Cause
Two independent problems:
generate_transaction_idbuilt a fresh blocking client with no session, so itfetched
x.comlogged out. Logged-out pages no longer embed theondemand.sscript that
ClientTransaction::newlooks for.x-client-transaction0.1.0 can'tparse X's current numeric ondemand chunk map.
Fix
reqwestcookie jar shared by theasync and blocking clients, so the signing page is fetched authenticated.
https://x.com(Secure,Path=/). Previously the cookieswere a static
COOKIEdefault header, sent to whatever host that client waspointed at; the jar limits them to x.com over HTTPS.
x-client-transactionto2b785eb. That is the crate's own repository(crates.io 0.1.0 lists it as
repository) at HEAD, which carries the parserfix. Glad to switch back to a version requirement if the author publishes it.
bad cookies.
Tests
session_cookies_are_scoped_to_secure_x_requests— cookies are sent tohttps://x.com, and not toabs.twimg.com, other hosts, or plain HTTP.session_cookies_reject_empty_or_injected_values— empty values and;/CRLFinjection are rejected.
live_home_timeline—#[ignore]d, hits the real API with the local config:cargo test live_home_timeline -- --ignored --nocapture. Say the word if you'drather not carry a test that reads a local config.
Verification
twit authcompletes and the timeline loads against a real account on Linux; theignored live test passes. The failure above is reproducible on
mainwith validcookies.