fix: security enhancements — timing protection, JWT rotation, CORS, audit logging - #543
Merged
DeFiVC merged 3 commits intoOct 1, 2026
Merged
Conversation
…hainLearnOfficial#492) Use crypto.timingSafeEqual() for stellarAddress and nonce comparisons to prevent timing side-channel attacks. Add reusable safeEqual() helper in src/utils/crypto.ts.
…LearnOfficial#489) Allow configuring previous JWT secrets so tokens signed with old keys remain valid during a rotation window. New tokens are always signed with the current JWT_SECRET.
|
@oomokaro1 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! 🚀 |
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.
Closes #489, Closes #490, Closes #491, Closes #492
Type of Change
Summary
This PR addresses four security-related issues: timing attack protection for sensitive token comparisons (#492), JWT signing key rotation support (#489), stricter CORS configuration for non-production environments (#490), and audit logging for sensitive operations (#491). It also fixes a pre-existing syntax error in the config test-mode fallback that prevented tests from running.
Motivation / Context
===comparisons for tokens/addresses are vulnerable to timing side-channel attacks. All sensitive comparisons now usecrypto.timingSafeEqual()via a reusablesafeEqual()helper.JWT_SECRET_PREVIOUSallows graceful key rotation.localhost:3000for CORS without warning. Staging/CI environments now get a warning to configureCORS_ORIGINSexplicitly, and CORS decisions are logged at debug level.Closes #489, Closes #490, Closes #491, Closes #492