Skip to content

test(locallibrary): tell a token from the same letters in a sign-in link - #448

Merged
botandbang merged 1 commit into
mainfrom
bnb/test-flakes
Nov 5, 2026
Merged

botandbang merged 1 commit into
mainfrom
bnb/test-flakes

Conversation

@botandbang

Copy link
Copy Markdown
Contributor

What and why

leaked looked for at-<n> and rt-<n> as substrings (shared_accounts.rs#L109). an_account_reads_back_the_same_wherever_its_asked passes it everything the commands printed, which includes each sign-in link with its random state and code_challenge. Both are base64url, so about 65 random characters per link can spell at-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 replays and 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_token in mock_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, on state=Qat-1Zk.

Changed

  • Mock::leaked in both crates uses holds_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_token differs from that run only in formatting.

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.
@botandbang
botandbang requested a review from bnb as a code owner November 5, 2026 15:08
@github-actions github-actions Bot added locallibrary locallibrary and the loclib-* crates locallibrary: cli The locallibrary command line locallibrary: core The core crate, the data model and rekordbox's formats locallibrary: plugins The plugin protocol, its host and the built-in plugins tests Tests, fixtures and test harnesses labels Nov 5, 2026
@github-actions

github-actions Bot commented Nov 5, 2026

Copy link
Copy Markdown

Rust coverage

From run 350. Both are held to the thresholds in .cargo/config.toml.

Tests Lines Functions Regions
All 97.66% (87906/90016) 97.07% (14299/14731) 96.05% (194296/202294)
Hegel property tests alone 96.08% (86484/90016) 95.38% (14051/14731) 94.35% (190856/202294)

@botandbang
botandbang added this pull request to the merge queue Nov 5, 2026
Merged via the queue into main with commit ffb274f Nov 5, 2026
32 checks passed
@botandbang
botandbang deleted the bnb/test-flakes branch November 5, 2026 17:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

locallibrary: cli The locallibrary command line locallibrary: core The core crate, the data model and rekordbox's formats locallibrary: plugins The plugin protocol, its host and the built-in plugins locallibrary locallibrary and the loclib-* crates tests Tests, fixtures and test harnesses

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants