fix(orb): authenticate relay registration before body parse#1397
Open
JSONbored wants to merge 3 commits into
Open
fix(orb): authenticate relay registration before body parse#1397JSONbored wants to merge 3 commits into
JSONbored wants to merge 3 commits into
Conversation
Codecov Report❌ Patch coverage is
❌ Your patch check has failed because the patch coverage (85.29%) is below the target coverage (97.00%). You can increase the patch coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## main #1397 +/- ##
==========================================
- Coverage 95.37% 95.35% -0.03%
==========================================
Files 192 192
Lines 20852 20883 +31
Branches 7540 7549 +9
==========================================
+ Hits 19887 19912 +25
- Misses 383 385 +2
- Partials 582 586 +4
🚀 New features to boost your workflow:
|
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
gittensory-ui | 63d377c | Commit Preview URL Branch Preview URL |
Jun 25 2026, 11:03 PM |
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
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.
Motivation
/v1/orb/relay/registerparsed an unbounded JSON body before validating the caller's enrollment secret.Description
MAX_ORB_RELAY_REGISTER_BODY_BYTESandreadOrbRelayRegisterBodyinsrc/orb/relay.tsto enforce a 4 KiB streamed body ceiling and aContent-Lengthpre-check.validateOrbRelayEnrollmentandregisterValidatedOrbRelayinsrc/orb/relay.ts, and refactorregisterOrbRelayto reuse them so enrollment validation can be done independently of body parsing.src/api/routes.tsto validate the enrollment secret first, short-circuit with401/403on invalid secrets, callreadOrbRelayRegisterBodyto enforce the size cap (returning413on overflow), and only then parse JSON and persist the relay URL.test/integration/orb-relay.test.tsto cover oversized registration payloads (413) and to assert that an invalid enrollment is rejected before any request-body access.Testing
npx vitest run test/integration/orb-relay.test.tsand the integration suite fororb-relaypassed (all tests in that file succeeded).npm run typecheckandgit diff --checkwhich succeeded with no type or diff errors.npm run ui:openapi:checkwhich completed successfully.npm run test:ci, but the run failed during coverage generation with an unrelated Vitest coverage provider error (TypeError: jsTokens is not a function), so the full CI/gate could not be completed locally;npm audit --audit-level=moderatealso failed due to an npm registry403 Forbiddenduring the audit request.Codex Task