fix: timing-safe OAuth client secret comparison (fixes #8)#60
Open
infinitedim wants to merge 1 commit into
Open
fix: timing-safe OAuth client secret comparison (fixes #8)#60infinitedim wants to merge 1 commit into
infinitedim wants to merge 1 commit into
Conversation
…ition#8) Replace the !== check on client_secret with SHA-256 digest comparison via crypto.timingSafeEqual to prevent timing attacks during /token. Add Jest unit tests for the comparison helper. Remove root node_modules from version control; it was accidentally tracked despite .gitignore. Run npm ci in the repo root after checkout. Co-authored-by: Cursor <cursoragent@cursor.com>
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
!==client secret check in/tokenwith SHA-256 digest comparison viacrypto.timingSafeEqual, avoiding length-based timing leaks.isClientSecretValidhelper and Jest unit tests underfunctions/.node_modules/from version control (4,300+ files). It was committed despite.gitignore; deleting it locally keeps the repo lighter on GitHub. After checkout, runnpm ciin the repo root to restore dependencies.Type
Test plan
cd functions && npm ci && npm test— 6 tests passcd functions && npm run build— TypeScript compiles/tokenexchange with valid/invalidclient_secretNotes
node_modulesremoval is a one-time cleanup — future installs stay local thanks to.gitignore.Made with Cursor