Repository navigation
feat(security): add constant-time string and buffer comparison helpers - #649
Merged
Conversation
|
@akshatXD-hash is attempting to deploy a commit to the Vicky's projects Team on Vercel. A member of the Team first needs to authorize it. |
👋 Welcome to PACT OS, @akshatXD-hash! 🚀Thank you for taking the time to open your first pull request on PACT! We are thrilled to have you here in our open-source community. 🔍 What Happens Next?
📚 Helpful Quick Links
Thank you for helping make PACT better! Plan. Track. Improve. Repeat. 🏛️✨ |
Owner
|
Hey @akshatXD-hash , There are some merge conflict kindly fix it and raise a new PR |
Contributor
Author
|
I’ve opened PR #649 for this issue and resolved the merge conflicts with main. It’s ready for review. |
TheVicky1
approved these changes
Oct 24, 2026
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 #639
Adds src/lib/security/constant-time.ts with:
Adds 49 Vitest tests covering equality, mismatches, unequal lengths, empty inputs, Unicode, buffer views, selection, and continued byte reads after mismatches. Integrates the suite into npm test.
Validation:
Security limitation:
These helpers avoid mismatch-based early exits, but JavaScript execution, normalization, allocation, and observable lengths prevent a strict constant-time guarantee. This limitation is documented.