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
{{ message }}
Repository navigation
fix(auth): keep the auth cache out of the invocation directory - #793
VIP wrote a live session (IdP, Connect, and Workbench cookies) and a minted Connect API key into the invocation directory, which is exactly what users zip and share. This moves the auth cache out of that directory.
File
Before
After
.vip-auth-cache.json
./
~/.cache/vip/auth/<hash of cwd>/
.vip-auth-cache.meta.json
./
same directory
Root is $XDG_CACHE_HOME (absolute only), then ~/.cache. On Windows, %LOCALAPPDATA% comes before XDG_CACHE_HOME. The vip/, vip/auth/ and leaf directories are 0700.
Keyed on the resolved invocation directory, so vip verify and vip cleanup still share one cache per directory.
Existing caches in cwd are moved on first use, keeping their mtime so the 4-hour TTL still applies (also across filesystems). If a new cache already exists, the old files are deleted.
If the cache directory can't be written, VIP skips caching. It never falls back to cwd.
vip verify and vip cleanup delete other directories' caches that have not been written for a day. A cache older than 4 hours is never reused.
README now says where credentials live, including inline secrets in vip.toml.
The User Guide has a new section on where the saved session lives.
A shareable vip bundle command is tracked in #794.
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
Live cookies and API keys can still be exposed in shared invocation directories because migration may be skipped or exit before cleanup, and cache roots can remain inside those directories.
Keep a private cache snapshot alive for the duration of a run
src/vip/auth/cache.py:155
If a run reuses a cache shortly before its four-hour expiry, a command from another directory can delete the file while that run is still using it. _load_cached_auth() returns the cache itself as storage_state_path, so later browser contexts in the first run fail when it disappears. Return a private, session-owned snapshot tracked by _tmpdir, and update the cache-reuse tests to verify it survives pruning.
Clean up legacy credentials when no cache root is available
src/vip/auth/cache.py:113
When cwd is accessible but no home or cache root can be resolved, this early return leaves the legacy cookies and API key in the directory users share. Best-effort delete the legacy state/metadata pair before returning, warning if removal fails. Update test_no_home_directory_leaves_legacy_cache_alone to expect removal.
Add pytest hooks to manage authentication cache during tests.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Not quite yet. The latest commit (b603dbf) fixes the non-UTF-8 path hashing issue, but the review still lists unresolved cache-snapshot/pruning, no-cache-root legacy cleanup, and selftest startup-isolation concerns. The latest smoke workflows are still running, so I can’t confirm the full CI result yet.
Both suggestions from the latest review are applied in b8d2518 (selftests no longer prepare the real cache during outer pytest setup) and b603dbf (cache key uses os.fsencode). 0b74e5f adds a regression test for a directory name that is not valid UTF-8.
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
Human assessment is needed because unpublished findings identify credential-exposure risks, deletion of caches still in use, and tests that can move real credential files.
On the unpublished finding about deleting caches still in use: fixed in f0ede10. A run can reuse a cache that is almost 4 hours old and keep reading it for the rest of the run, so pruning another directory cache at 4 hours could pull it out from under that run. Pruning now waits until a cache has not been written for a day. Reuse still stops at 4 hours.
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
Human review is needed to assess credential-retention and concurrent-migration risks that could expose legacy credentials or leave the authentication cache unusable.
Both risks are known trade-offs. Credential retention: another directory cache can stay on disk for up to a day after its last write, so a long run that reused it keeps working. It is never reused after 4 hours, the folder is owner-only, and the next login removes its Connect key. Concurrent migration: if two runs in the same directory move the legacy cache at once, the one that loses the race leaves the moved files alone and deletes what is left in the working directory. The worst case is a session file with no meta file, which the loader treats as a miss, so that run signs in again.
Preview removed because the pull request was closed.
2026-11-18 23:27 UTC
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
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.
VIP wrote a live session (IdP, Connect, and Workbench cookies) and a minted Connect API key into the invocation directory, which is exactly what users zip and share. This moves the auth cache out of that directory.
.vip-auth-cache.json./~/.cache/vip/auth/<hash of cwd>/.vip-auth-cache.meta.json./$XDG_CACHE_HOME(absolute only), then~/.cache. On Windows,%LOCALAPPDATA%comes beforeXDG_CACHE_HOME. Thevip/,vip/auth/and leaf directories are0700.vip verifyandvip cleanupstill share one cache per directory.vip verifyandvip cleanupdelete other directories' caches that have not been written for a day. A cache older than 4 hours is never reused.vip.toml.A shareable
vip bundlecommand is tracked in #794.Closes #620