Repository navigation
test(locallibrary): tell a token from the same letters in a sign-in link - #448
Merged
Merged
Conversation
The account leak check looked for at-1 and rt-1 anywhere in what was printed, and a sign-in link prints a random state and PKCE challenge in base64url, which can spell either. It now matches whole tokens.
bnb
approved these changes
Nov 5, 2026
Rust coverageFrom run 350. Both are held to the thresholds in .cargo/config.toml.
|
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.
What and why
leakedlooked forat-<n>andrt-<n>as substrings (shared_accounts.rs#L109).an_account_reads_back_the_same_wherever_its_askedpasses it everything the commands printed, which includes each sign-in link with its randomstateandcode_challenge. Both are base64url, so about 65 random characters per link can spellat-1. By my estimate that's about 1 run in 6,000.This may be what failed this run, where the test failed once with
failed 0 of 10 replaysand no panic text, but that log can't prove it: Hegel prints no panic text for a failure it can't replay. 300 cases of the property, 37 times a normal run, passed on macOS, so I found no other cause there. The run was on Linux and I didn't stress it on Linux.Added
holds_tokeninmock_oauth.rs, shared by both crates' tests: a token counts only when it isn't part of a longer word.a_token_is_told_from_the_same_letters_in_a_random_word. It fails with the old substring match, onstate=Qat-1Zk.Changed
Mock::leakedin both crates usesholds_token.Removed
Nothing.
How it was tested
On macOS: the new test, with the check broken and then restored. Both packages in one run, 3,518 tests, 3,517 passed, and the one timeout was a temporary 300-case build of the account property hitting its 120 s limit. The final
holds_tokendiffers from that run only in formatting.