Fix admin-key comparison timing vulnerability by extracting auth logic - #608
Open
whitezaddy wants to merge 5 commits into
Open
Fix admin-key comparison timing vulnerability by extracting auth logic#608whitezaddy wants to merge 5 commits into
whitezaddy wants to merge 5 commits into
Conversation
|
@whitezaddy 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! 🚀 |
whitezaddy
force-pushed
the
fix/issue-526-admin-key-comparison
branch
3 times, most recently
from
September 1, 2026 20:26
1b0959e to
15f8a02
Compare
whitezaddy
force-pushed
the
fix/issue-526-admin-key-comparison
branch
4 times, most recently
from
September 1, 2026 23:20
ac395e6 to
36ed1da
Compare
Author
|
Kindly review |
Author
|
Conflicts resolved. Please review. |
| } | ||
|
|
||
| export function triggerWebhooks(payload: unknown): void { | ||
| for (const wh of webhooks.values()) { |
Author
|
Conflict 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.
Description
Closes #526
This PR addresses the admin-key comparison vulnerability where a plain
===operator was incorrectly used, exposing theADMIN_API_KEYto potential timing side-channel attacks.Instead of fixing the vulnerable checks individually and leaving duplicated code, we extracted the entire authorization header parsing, admin key verification, and consumer key validation logic into a new centralized helper (
src/lib/authHelper.ts).Changes included:
resolveAuthFromHeadersinsrc/lib/authHelper.tsto cleanly extract and validate API keys from headers.src/middleware/apiKeyAuth.tsandsrc/graphql/schema.tsto consume the new helper, eliminating the duplicate code across REST and GraphQL implementations.timingSafeCompare) uniformly for the admin key check.authHelper.tsutility.Type of change
Testing checklist
Screenshots (if applicable)