fix(security): use constant-time comparison for API key auth (#287) - #358
Merged
David-patrick-chuks-02 merged 3 commits intoSep 6, 2026
Merged
Conversation
added 2 commits
September 4, 2026 02:52
…-Protocol#294) Add custom res serializer to pino-http that keeps only statusCode and responseTime, omitting the full headers blob. This reduces log volume by ~1KB per request without losing operational visibility. Closes Lilly-Protocol#294
…rotocol#287) - Replace plain string inequality with crypto.timingSafeEqual - Reject mismatched lengths before comparison to prevent timing leaks - Add unit tests for matching, wrong-length, near-miss, and missing keys Closes Lilly-Protocol#287
Contributor
Author
|
This PR is currently marked DIRTY due to merge conflicts with the base branch. The constant-time comparison fix for API key auth (#287) is correct and important for security. I'll rebase this onto latest main once the pre-existing CI issues (npm audit vulnerabilities, lint errors) are resolved on main, since rebasing now would just inherit those failures. Ready for review once conflicts are resolved. |
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
Replaces plain string inequality check in
apiKeyAuthmiddleware withcrypto.timingSafeEqualto prevent timing-based side-channel attacks that could leak API key characters.Changes
timingSafeEqualfrom Node.jscryptomoduleTesting
Closes #287