Repository navigation
Reject Neon organization keys and say why - #78
Merged
Merged
Conversation
Attendees in browser Codespaces paste a Neon API key, and many made an organization key from the organization's Settings > API keys. neonctl 8.0.8's profile create accepts organization and project keys (it validates with GET /auth, not /users/me) and saves them to ~/.config/neon/credentials.json as usual, but neonctl me then gets 404 "not allowed for organization API keys". The check reported that as "sign-in expired or key rejected", and the skill sent the attendee to an instructor. The check now asks neonctl profile list for the credential it will use, names an organization or project key without a network call, and otherwise passes on neonctl me's own first error sentence with tokens redacted. neon-key.sh save runs the check after storing the key and keeps the form when it fails, so the attendee can paste a personal key in its place. The form, skill and README now say to make a personal key from Account settings, not the organization's API keys, and the skill retries before escalating.
The pinned firstdraft/dockerfiles contract stubbed neonctl for profile create only, so neon-key.sh save's new check failed there. The repinned contract answers profile list and me, and covers both an organization key and a personal key.
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.
Codespace attendees who pasted an organization or project Neon API key got SAVED, then
auth.sh check neonfailed with "sign-in expired or key rejected" and the skill sent them to an instructor.Root cause, from neonctl 8.0.8's source:
profile create --api-key -validates withGET /authand acceptsapi_key_orgkeys (dist/commands/profile.js:274-292,dist/profile_keys.js:30-41), storing them in~/.config/neon/credentials.jsonwith anorg_id.neonctl mecallsGET /users/me, which answers404 not allowed for organization API keysfor those keys (dist/commands/user.js:20). Storage is consistent:mereads the same DEFAULT profile file thatprofile create DEFAULTwrites.check_neonasksneonctl profile listfor the active credential (offline, no browser sign-in), names an organization or project key directly, and otherwise passes onneonctl me's first error sentence with long tokens redacted.neon-key.sh saveruns that check after storing the key and keeps the form when it fails.Tested against a local stub of the Neon API with scratch homes: organization key, personal key, rejected key, unreachable API, hanging API, and an unreadable profiles file. Not tested with a real Neon key.