chore: warn when admin/bootstrap mint API keys without TOKEN_PEPPER (#133)#150
Merged
Conversation
scripts/create-api-key.mts and packages/onboarding/src/merchant.ts (mintApiKey, used by bootstrap-merchant) mint directly against the DB via hashNewApiKey, which silently falls back to legacy SHA-256 when TOKEN_PEPPER is unset. Add a loud warning at both sites when minting without a pepper, plus a TOKEN_PEPPER note in the create-api-key usage. Part of #133. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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.
What
Adds a loud warning at the two direct-DB API-key mint sites when
TOKEN_PEPPERis absent — i.e. when they fall back to minting a legacy SHA-256 key instead of an HMAC key:scripts/create-api-key.mts(admin key creation) —console.warn+ aTOKEN_PEPPERnote in the--helpusage.packages/onboarding/src/merchant.ts(mintApiKey, used bybootstrap-merchant) —console.warnto stderr.Changeset:
@pincerpay/onboardingpatch.Why
Part of #133 (the #124/#135 HMAC rollout). These paths silently fall back to SHA-256 when no pepper is set, so a misconfigured operator/CI environment would mint legacy keys with no signal. The warning surfaces it. No other behavior change — the key is still minted and works via the facilitator's fallback.
What this does NOT do
This is the safety-net half of #133. The operational half — exporting
TOKEN_PEPPER(same value as the facilitator) whereverpnpm create-api-key/pnpm bootstrap-merchantactually run (operator shell.env, any CI secret) — is environment config, not code. #133 stays open until that's in place.Test
@pincerpay/onboardingtypecheck + 7 tests pass.🤖 Generated with Claude Code