Skip to content

fix: timing-safe OAuth client secret comparison (fixes #8)#60

Open
infinitedim wants to merge 1 commit into
nick-transition:mainfrom
infinitedim:fix/issue-8-timing-safe-oauth-secret
Open

fix: timing-safe OAuth client secret comparison (fixes #8)#60
infinitedim wants to merge 1 commit into
nick-transition:mainfrom
infinitedim:fix/issue-8-timing-safe-oauth-secret

Conversation

@infinitedim
Copy link
Copy Markdown

@infinitedim infinitedim commented May 23, 2026

Summary

  • Fixes Security: Client secret comparison not timing-safe #8 by replacing the !== client secret check in /token with SHA-256 digest comparison via crypto.timingSafeEqual, avoiding length-based timing leaks.
  • Adds isClientSecretValid helper and Jest unit tests under functions/.
  • Removes accidentally tracked root node_modules/ from version control (4,300+ files). It was committed despite .gitignore; deleting it locally keeps the repo lighter on GitHub. After checkout, run npm ci in the repo root to restore dependencies.

Type

  • Bug fix
  • New feature
  • Breaking change
  • Documentation
  • Refactor

Test plan

  • cd functions && npm ci && npm test — 6 tests pass
  • cd functions && npm run build — TypeScript compiles
  • Manual OAuth /token exchange with valid/invalid client_secret

Notes

Made with Cursor

…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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Security: Client secret comparison not timing-safe

1 participant