Skip to content

fix(keychain): load secure keychain export#2867

Merged
sjinks merged 1 commit into
trunkfrom
fix/secure-keychain
Jun 3, 2026
Merged

fix(keychain): load secure keychain export#2867
sjinks merged 1 commit into
trunkfrom
fix/secure-keychain

Conversation

@sjinks
Copy link
Copy Markdown
Member

@sjinks sjinks commented Jun 3, 2026

Description

Purpose and Context

The credential store should prefer the secure keychain backend when available and fall back to configstore otherwise. The dynamic require path was reading the secure backend with the wrong module shape, causing the CLI to use the insecure fallback even when the secure backend could be loaded.

Key Changes

  • Read the default export from the secure keychain module when requiring it dynamically.
  • Remove the unused constructor type import.

Impact and Considerations

Login credentials are stored in the secure keychain when that backend is available. The existing configstore fallback remains available for environments without secure keychain support.

If the secure keychain is available, the users will have to re-login to have their credentials migrated from the configstore to the

Changelog Description

Fixed

  • Secure keychain will be used if available.

Pull request checklist

New release checklist

Steps to Test

DEBUG=@automattic/vip:keychain vip must not show "Cannot use Secure keychain; falling back to Insecure keychain (Details: TypeError: Secure is not a constructor"

## Purpose and Context

The credential store should prefer the secure keychain backend when it is
available and only fall back to configstore otherwise. The dynamic require
path was reading the secure backend with the wrong module shape, which
made the CLI use the insecure fallback even when the secure backend could
be loaded.

## Key Changes

- Read the default export from the secure keychain module when requiring
  it dynamically.
- Remove the unused constructor type import.

## Impact and Considerations

Login credentials are stored in the secure keychain when that backend is
available. The existing configstore fallback remains available for
environments without secure keychain support.

If the secure keychain is available, the users will have to re-login
to have their credentials migrated from the configstore to the
Copilot AI review requested due to automatic review settings June 3, 2026 13:55
@sjinks sjinks self-assigned this Jun 3, 2026
@sjinks sjinks added the Bug label Jun 3, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 3, 2026

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

Scanned Files

None

@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes secure keychain backend selection by correcting the dynamic require() shape handling so the CLI actually instantiates the secure backend when it’s available, instead of unintentionally falling back to the insecure configstore-based backend.

Changes:

  • Load the secure keychain backend via its default export when requiring it dynamically.
  • Remove the now-unused KeychainConstructor type import from src/lib/keychain.ts.

@sjinks sjinks requested a review from a team June 3, 2026 14:05
@sjinks sjinks merged commit 5fd04f2 into trunk Jun 3, 2026
20 checks passed
@sjinks sjinks deleted the fix/secure-keychain branch June 3, 2026 17:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants