fix: resolve security issues #697 #698 #699 #700#753
Merged
Conversation
…heck (Haroldwonder#697) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…dance to RUNBOOK (Haroldwonder#698) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…roldwonder#699) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
… schema (Haroldwonder#700) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
@Grace-CODE-D is attempting to deploy a commit to the Harold's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
@Grace-CODE-D Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
4 tasks
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
This PR resolves four security and validation issues across the API and backend services.
#697 — Bearer token case sensitivity in WebSocket auth middleware
File:
api/src/websocket/middleware/auth.tsThe
extractTokenfunction previously stripped theBearerprefix using a case-insensitive regex (/^Bearer\s+/i). The fix replaces this with an explicittoLowerCase().startsWith('bearer ')check followed by a fixed-lengthslice(7), making the case normalization unambiguous and matching the approach described in the issue.Closes #697
#698 — ADMIN_SECRET_KEY stored without rotation mechanism
File:
RUNBOOK.mdAdded a new Section 7: Rotate ADMIN_SECRET_KEY (Service-Level Key) covering:
ADMIN_SECRET_KEYin AWS Secrets Manager or HashiCorp Vault with automatic rotation instead of a plain environment variable.Closes #698
#699 — No rate limiting on webhook registration endpoint
File:
backend/src/webhooks/service.tsAdded a
MAX_WEBHOOKS_PER_ACCOUNT = 10constant and enforced it insideregisterWebhookbefore writing to the store. If the total registered webhook count is already at the limit, the method throws with a descriptive error, preventing an attacker from registering thousands of webhook URLs that would trigger mass outbound HTTP requests per event.Closes #699
#700 — No input length limits on string fields in request validation
File:
api/src/schemas/requestValidation.tsmemoSchemawith.max(28)per the Stellar text memo specification (28-byte limit).memo: memoSchematocreateRemittanceSchemaso memo is validated at the schema layer..max(56)to thetokenfield increateRemittanceSchemato complement the existing pattern constraint.Closes #700
Test plan
bearer <token>,BEARER <token>, andBearer <token>all authenticate successfullymemolonger than 28 characters are rejected with a validation errorADMIN_SECRET_KEYrotation runbook steps are verified in a staging environment🤖 Generated with Claude Code