Skip to content

fix(NoTicket): remove password hashes from token cache filenames - #540

Merged
lorenzhs merged 2 commits into
mainfrom
lorenz/fix-token-cache-filenames
Oct 7, 2026
Merged

lorenzhs merged 2 commits into
mainfrom
lorenz/fix-token-cache-filenames

Conversation

@lorenzhs

@lorenzhs lorenzhs commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

Use identity-based, versioned cache filenames and discard legacy cache files, including those left after credential rotation. Do not migrate old tokens.

Cover cache isolation, cleanup, and wrong-password handling. Isolate real-filesystem unit test fixtures from the user token cache.


Note

Medium Risk
Changes on-disk token cache layout and deletes legacy cache files on startup, forcing re-auth for affected users; encryption still depends on password for read access.

Overview
Token cache files are renamed so filenames no longer embed a password hash—only a username-derived token-v2-{hash}.json path is used. On TokenSecureStorage init, legacy 64-hex-char.json cache files are deleted (no token migration), so users with old caches must sign in again.

A password change for the same username now hits the same cache file but cannot decrypt the stored token (expected). Tests cover filename stability, legacy cleanup, and that unrelated files/dirs in the cache folder are left alone. Unit tests that use the real filesystem get an autouse fixture that redirects user_data_dir to tmp_path.

Reviewed by Cursor Bugbot for commit 19984f8. Bugbot is set up for automated code reviews on this repo. Configure here.

Use identity-based, versioned cache filenames and discard legacy cache files, including those left after credential rotation. Do not migrate old tokens.

Cover cache isolation, cleanup, and wrong-password handling. Isolate real-filesystem unit test fixtures from the user token cache.
@lorenzhs
lorenzhs requested a review from a team as a code owner October 7, 2026 11:57
@sonarqubecloud

sonarqubecloud Bot commented Oct 7, 2026

Copy link
Copy Markdown

@lorenzhs
lorenzhs merged commit b9e0466 into main Oct 7, 2026
12 checks passed
@lorenzhs
lorenzhs deleted the lorenz/fix-token-cache-filenames branch October 7, 2026 12:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants