Skip to content

Add auth config export from keychain#1615

Merged
rudrankriyam merged 5 commits into
mainfrom
cursor/keychain-json-migration-825f
Jun 6, 2026
Merged

Add auth config export from keychain#1615
rudrankriyam merged 5 commits into
mainfrom
cursor/keychain-json-migration-825f

Conversation

@rudrankriyam

@rudrankriyam rudrankriyam commented Jun 4, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Add asc auth export-to-config to copy keychain-backed App Store Connect API credentials into JSON config storage.
  • Export embedded keychain PEM material to secure .p8 files when the original private key path is missing.
  • Support --local, --config, --private-key-dir, --remove-keychain, and JSON/table output for auditable migration workflows.
  • Harden migration edge cases found during PR audit: active config path resolution, destination default preservation, keychain cleanup reporting, original keychain-name removal, private-key export filename collisions, and ambiguous trimmed profile-name collisions.

Validation

  • asc auth export-to-config --help
  • asc auth export-to-config exits 2 when --confirm is missing
  • asc auth export-to-config --confirm --output yaml exits 2 for unsupported output
  • asc auth export-to-config --confirm --local --config /tmp/asc-config.json exits 2 for mutually exclusive config targets
  • Built /tmp/asc-pr-1615 and ran a live local migration drill:
    • Seeded keychain from the existing /Users/rudrank/.asc/config.json credential data
    • Temporarily moved the config aside
    • Ran /tmp/asc-pr-1615 auth export-to-config --confirm --output json
    • Verified ASC_BYPASS_KEYCHAIN=1 /tmp/asc-pr-1615 auth status --output json reads the migrated config credential
    • Restored the original config file and its uchg flag
  • make format
  • make check-command-docs
  • make lint
  • ASC_BYPASS_KEYCHAIN=1 make test
  • Cursor Bugbot review threads resolved

Notes

The command was renamed from migrate-to-config to export-to-config during audit because the default behavior copies credentials to config while leaving keychain entries in place. Destructive cleanup remains explicit behind --remove-keychain.

Open in Web Open in Cursor 

Co-authored-by: Rudrank Riyam <rudrankriyam@gmail.com>
@coderabbitai

coderabbitai Bot commented Jun 4, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@rudrankriyam, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 1 hour, 25 minutes, and 50 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 06aec3eb-44b9-4ba8-abc4-a63db2d538b3

📥 Commits

Reviewing files that changed from the base of the PR and between d65779b and fb9b352.

📒 Files selected for processing (5)
  • internal/auth/keychain.go
  • internal/auth/keychain_test.go
  • internal/cli/auth/auth.go
  • internal/cli/auth/auth_test.go
  • internal/cli/auth/test_hooks.go
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch cursor/keychain-json-migration-825f

Comment @coderabbitai help to get the list of available commands and usage tips.

@mintlify

mintlify Bot commented Jun 4, 2026

Copy link
Copy Markdown

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated (UTC)
rudrankriyam-app-store-connect-cli-67 🟡 Building Jun 4, 2026, 11:18 PM

💡 Tip: Enable Workflows to automatically generate PRs for you.

Comment thread internal/auth/keychain.go
Comment thread internal/auth/keychain.go
Comment thread internal/auth/keychain.go
Co-authored-by: Rudrank Riyam <rudrankriyam@gmail.com>
Comment thread internal/auth/keychain.go
Co-authored-by: Rudrank Riyam <rudrankriyam@gmail.com>
Comment thread internal/auth/keychain.go
Comment thread internal/auth/keychain.go

@cursor cursor Bot 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.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 10d7c85. Configure here.

Comment thread internal/auth/keychain.go
@rudrankriyam rudrankriyam marked this pull request as ready for review June 6, 2026 15:49
@rudrankriyam rudrankriyam changed the title Add auth keychain-to-config migration Add auth config export from keychain Jun 6, 2026
@rudrankriyam rudrankriyam merged commit 3ef9a1f into main Jun 6, 2026
13 checks passed
@rudrankriyam rudrankriyam deleted the cursor/keychain-json-migration-825f branch June 6, 2026 15:50

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: fb9b352025

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread internal/cli/auth/auth.go
Comment on lines +547 to +548
Name: "export-to-config",
ShortUsage: "asc auth export-to-config --confirm [flags]",

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Regenerate docs for the new auth subcommand

AGENTS.md requires command/help text changes to run make generate-command-docs and commit docs/COMMANDS.md. This registers a new auth export-to-config subcommand and updates auth help, but rg "export-to-config|migrate-to-config" docs/COMMANDS.md internal/cli shows the generated command reference still has no entry for it, so users relying on the generated docs cannot discover the command and the command-docs check should fail until the docs are regenerated.

Useful? React with 👍 / 👎.

Comment thread internal/auth/keychain.go
Comment on lines +424 to +425
upsertConfigCredential(cfg, configCred)
migratedConfigCreds = append(migratedConfigCreds, configCred)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Clear stale keychain metadata when migrating profiles

When migrating into a config that already has keychain_metadata for the same profile, this upsert updates cfg.Keys but leaves the old keychain metadata in place. internal/cli/shared.configCredentialMetadataSummaries reads KeychainMetadata before Keys and skips duplicate key names, so metadata-only auth resolution can keep returning the stale key ID/issuer after the profile has been migrated to config storage; clear or replace metadata entries for migrated names before saving.

Useful? React with 👍 / 👎.

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