fix(orb-broker): validate App credentials only after enrollment is proven valid - #2733
Merged
Conversation
…oven valid brokerOrbToken checked ORB_GITHUB_APP_ID/ORB_GITHUB_APP_PRIVATE_KEY before looking up the enrollment secret, so ANY caller — including one with no valid secret at all — could distinguish "broker misconfigured" from "invalid secret" via the response code, leaking the server's deployment config state to unauthenticated callers. Move the credential check to immediately before the mint call, the only place it's actually needed (a cache hit never needs it), so an invalid/unknown secret always yields invalid_enrollment regardless of server configuration.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2733 +/- ##
=======================================
Coverage ? 96.02%
=======================================
Files ? 244
Lines ? 27300
Branches ? 9919
=======================================
Hits ? 26214
Misses ? 460
Partials ? 626
🚀 New features to boost your workflow:
|
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.
Summary
brokerOrbTokencheckedORB_GITHUB_APP_ID/ORB_GITHUB_APP_PRIVATE_KEYbefore looking up the enrollment secret, so an unauthenticated caller with any bad/unknown secret could distinguish "broker misconfigured" (503) from "invalid secret" (401) via the response code alone — leaking the server's deployment-config state without ever proving a valid enrollment. Moves the credential check to immediately before the mint call (the only place it's actually needed — a cache hit never needs it), so an invalid/unknown secret always yieldsinvalid_enrollmentregardless of server configuration.Scope
type(scope): short summaryConventional Commit format, for examplefix(api): restore profile access checks.CONTRIBUTING.mdand does not reintroduce GitHub Pages, VitePress,site/, orCNAME.Validation
git diff --checknpm run typechecknpm run test:coveragelocally (scoped tosrc/orb/broker.ts— 100% patch coverage on the changed lines/branches)Safety
invalid_enrollment, even with zero App credentials configured.)UI Evidence
N/A — backend-only change, no UI.
Notes
installation_not_eligible) still runs before the credential check, so a revoked/suspended install never leaks config state either.readCachedOrbTokenonly depends onTOKEN_ENCRYPTION_SECRET.