Repository navigation
fix(backend): migrate webhooks to use canonical timingsafekey comparison - #1747
Conversation
replace two call sites of custom safeEqualString() with timingSafeKeyCompare() to match the canonical constant-time comparison used in other internal routes (serviceAnnounce.ts, internalNotify.ts, serviceGuild.ts). removes now-unused safeEqualString function definition and its timingSafeEqual import.
📝 WalkthroughWalkthroughWebhook token verification in webhooks.ts is refactored to use a shared timingSafeKeyCompare utility instead of a local safeEqualString helper combined with node:crypto's timingSafeEqual. Vote streak computation logic is reformatted without semantic changes. ChangesWebhook Auth Refactor
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related issues
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
|
Failed to generate code suggestions for PR |
There was a problem hiding this comment.
No issues found across 1 file
Auto-approved: Replaces custom safeEqualString with canonical timingSafeKeyCompare for webhook auth, matching other internal routes. Removes unused code. Low risk.
Re-trigger cubic
|
🤖 I have created a release *beep* *boop* --- <details><summary>2.34.0</summary> ## [2.34.0](v2.33.1...v2.34.0) (2026-07-10) ### Features * **twitch:** use Promise.allSettled for per-event subscription error logging ([#1749](#1749)) ([6691305](6691305)) ### Bug Fixes * [#1699](#1699) ([eef5aee](eef5aee)) * **backend:** migrate webhooks to use canonical timingsafekey comparison ([#1747](#1747)) ([eef5aee](eef5aee)) * **backend:** wrap lastfm routes with asynchandler ([#1726](#1726)) ([ce51d86](ce51d86)) * **batch-move:** graceful attachment-fetch degradation + mid-loop client re-check ([#1750](#1750)) ([f21a0ce](f21a0ce)) * **bot:** approve @discordjs/opus install script — P0 music playback outage ([#1757](#1757)) ([9d894e4](9d894e4)) * **ci:** add missing packages field to pnpm-workspace.yaml ([#1760](#1760)) ([a4c585d](a4c585d)) * **ci:** remove pnpm shim from bundle-size workflow ([#1759](#1759)) ([eaf676f](eaf676f)) * **deploy:** increase validation timeout to 10min ([#1743](#1743)) ([07891ec](07891ec)) * **docker:** copy+chown [@prisma](https://github.com/prisma) engines in production-backend — P0 deploy pipeline blocker ([#1758](#1758)) ([a70d0e8](a70d0e8)) * eliminate mock state pollution in bot tests and remove resetMocks config ([#1741](#1741)) ([2e5fd94](2e5fd94)) * **frontend:** prevent state updates after unmount ([#1748](#1748)) ([f4e7c45](f4e7c45)) * pin file-type to resolve CI flake [#1740](#1740) ([#1753](#1753)) ([6b8e527](6b8e527)) * reduce Jest maxWorkers and add DB pool config for test stability ([#1751](#1751)) ([cfead33](cfead33)) * use fake timers in ReminderService.spec to prevent race condition ([#1745](#1745)) ([ba2908c](ba2908c)) </details> --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).



fix: #1699
Replace two call sites of custom safeEqualString() with timingSafeKeyCompare() to match the canonical constant-time comparison used in other internal routes (serviceAnnounce.ts, internalNotify.ts, serviceGuild.ts). Removes now-unused safeEqualString function definition and its timingSafeEqual import.
Summary by cubic
Standardizes webhook auth to use
timingSafeKeyComparefor constant-time key checks in Top.gg and internal notify endpoints, aligning with other internal routes and addressing #1699. Removes the customsafeEqualStringhelper and thetimingSafeEqualimport.Written for commit d0c3fe2. Summary will update on new commits.
Summary by CodeRabbit