Skip to content

feat: skip caching token in keychain mode for accounts cache#3792

Open
k80bowman wants to merge 7 commits into
mainfrom
k80/accounts-keychain-cache
Open

feat: skip caching token in keychain mode for accounts cache#3792
k80bowman wants to merge 7 commits into
mainfrom
k80/accounts-keychain-cache

Conversation

@k80bowman

Copy link
Copy Markdown
Contributor

Summary

Adds keychain-mode awareness to the accounts cache system to prevent token persistence to disk when keychain storage is active.

When credentialStore (keychain) is configured, the CLI now:

  1. Skips saving tokens to account cache files in accounts:add command
  2. Skips netrc file updates in AccountsWrapper.set() method

This ensures tokens are only stored in the system keychain when keychain-mode is active, avoiding duplicate token storage in cache files.

Type of Change

Breaking Changes (major semver update)

  • Add a ! after your change type to denote a change that breaks current behavior

Feature Additions (minor semver update)

  • feat: Introduces a new feature to the codebase

Patch Updates (patch semver update)

  • fix: Bug fix
  • deps: Dependency upgrade
  • revert: Revert a previous commit
  • chore: Change that does not affect production code
  • refactor: Refactoring existing code without changing behavior
  • test: Add/update/remove tests

Testing

Notes:
Requires testing in both keychain-mode and netrc-mode configurations.

Setup:

  1. Check out this branch and run npm i && npm run build
  2. Logout using heroku logout

Steps:
Test keychain-mode

  1. Run ./bin/run accounts:add test-account
  2. Verify the account cache file at ~/.config/heroku/accounts/test-account contains only username: (no password: field)
  3. Run ./bin/run accounts:remove test-account to remove the account cache

Test netrc-mode

  1. Run HEROKU_NETRC_WRITE=true ./bin/run accounts:add test-account
  2. Verify the account cache file contains both username: and password: fields
  3. Run ./bin/run accounts:remove test-account to remove the account cache

Screenshots (if applicable)

N/A

Related Issues

GUS work item: W-23123793

@k80bowman k80bowman requested a review from a team as a code owner June 26, 2026 18:15
@k80bowman k80bowman deployed to AcceptanceTests June 26, 2026 18:15 — with GitHub Actions Active
@k80bowman k80bowman temporarily deployed to AcceptanceTests June 26, 2026 18:15 — with GitHub Actions Inactive
@k80bowman k80bowman temporarily deployed to AcceptanceTests June 26, 2026 18:15 — with GitHub Actions Inactive
@k80bowman k80bowman temporarily deployed to AcceptanceTests June 26, 2026 18:15 — with GitHub Actions Inactive

@tlowrimore-heroku tlowrimore-heroku left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

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