Update keyring items in place instead of delete-and-recreate - #56
Open
aberoham wants to merge 1 commit into
Open
Update keyring items in place instead of delete-and-recreate#56aberoham wants to merge 1 commit into
aberoham wants to merge 1 commit into
Conversation
store_token, add_profile_to_index, and remove_profile_from_index deleted the keyring item before every set_password call. On macOS the recreation discards the item's access control list, so an "Always Allow" grant was revoked by the next silent token refresh and the keychain prompt returned within the hour. set_password already updates an existing item in place, which preserves the grant, so the delete calls are removed. The two index writers shared the same storage block and now use one helper. Verified on macOS: with this change `security find-generic-password` shows an unchanged creation date and an updated modification date on the token item after `teams auth refresh`; previously the item was recreated on every write. Fixes osodevops#51. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NXWLJ9g87M3GtLSACr2gmi
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.
Fixes #51.
store_token,add_profile_to_index, andremove_profile_from_indexdeleted the keyring item before everyset_passwordcall. On macOS the recreation discards the item's access control list, so an "Always Allow" grant was revoked by the next silent token refresh and the keychain prompt returned within the hour.keyringv3set_passwordalready updates an existing item in place (its macOS backend is create-or-update), so the delete calls are removed. The two index writers shared the same storage block and now use onewrite_profile_indexhelper.Verified on macOS 15 against a live login: after this change,
security find-generic-password -s teams-cli -a "default:token"shows an unchanged creation date and an updated modification date followingteams auth refresh. Before the change the creation date moved on every write, proving the item was recreated.cargo fmt,cargo clippy --all-targets -- -D warnings, andcargo test --binspass.🤖 Generated with Claude Code
https://claude.ai/code/session_01NXWLJ9g87M3GtLSACr2gmi