Fix PoP cache isolation bug causing repeated login prompts#719
Open
Fix PoP cache isolation bug causing repeated login prompts#719
Conversation
Previously, all PoP caches on macOS shared the same Keychain entry (service: "kubelogin-pop", account: "MSALCache"), which caused: 1. Test storage and actual cache to conflict 2. Test deletion could clear actual cache data 3. Multiple cache instances couldn't be isolated Now using cache filename as the account identifier to differentiate between different caches. Co-authored-by: daxakp <32614003+daxakp@users.noreply.github.com>
The bug affected both Linux and macOS platforms where different cache directories would share the same encryption key, causing cache conflicts and repeated login prompts. Linux: Changed keyring description from filename to full path macOS: Changed Keychain account from fixed "MSALCache" to hash of full path This ensures each cache directory (e.g., different clusters with --cache-dir) has its own isolated encryption key, preventing cache corruption and auth failures. Co-authored-by: daxakp <32614003+daxakp@users.noreply.github.com>
Co-authored-by: daxakp <32614003+daxakp@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix bug #654
Fix PoP cache isolation bug causing repeated login prompts
Oct 27, 2025
daxakp
approved these changes
Oct 27, 2025
Contributor
|
@daxakp Is this change tested end-end? |
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.
PoP token caches on Linux and macOS shared encryption keys across different cache directories, causing cache corruption and repeated authentication prompts when switching between clusters or contexts.
Root Cause
Cache encryption keys were identified by filename alone (
pop_tokens.cache) instead of full path:Changes
Linux (
pkg/internal/pop/cache/linux.go)filepath.Base(path)→ fullpathmacOS (
pkg/internal/pop/cache/darwin.go)"MSALCache"→sha256(cachePath)[:16]Test (
pkg/internal/pop/cache/linux_test.go)Impact
Fixes #654 for users experiencing repeated login with:
--cache-dirsettingsWarning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
invalid-url/tmp/go-build4145022418/b676/token.test -test.testlogfile=/tmp/go-build4145022418/b676/testlog.txt -test.paniconexit0 -test.timeout=5m0s(dns block)/tmp/go-build2879192260/b676/token.test -test.testlogfile=/tmp/go-build2879192260/b676/testlog.txt -test.paniconexit0 -test.timeout=5m0s(dns block)If you need me to access, download, or install something from one of these locations, you can either:
Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.