Repository navigation
🚨 Flash: [CRITICAL] Fix API Key DoS Vulnerability - #17
Conversation
This modifies `verifyApiKey` to use `api_key_prefix` (the first 16 characters of the key) to perform an O(1) database lookup instead of fetching all enabled merchants and running an O(N) `bcrypt.compare` on every single one. This neutralizes a critical Denial of Service (DoS) vulnerability. Co-authored-by: Shreyassp002 <96625037+Shreyassp002@users.noreply.github.com>
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
- Fixed `any` type casting on Supabase client across multiple files (`route.ts`). - Fixed unused `payment_links` variable from transaction queries by explicitly ignoring them. - Fixed other unused variables identified by ESLint in CI. Co-authored-by: Shreyassp002 <96625037+Shreyassp002@users.noreply.github.com>
verifyApiKeyfunction insrc/lib/api/verify-api-key.tswas doing an O(N) lookup. It would fetch all enabled merchants and run a computationally expensivebcrypt.compareoperation against each one until it found a match.bcrypt.compareis designed to be slow, forcing the server to hash and compare against every single merchant in the database for each invalid request would quickly exhaust server resources and cause a Denial of Service (DoS).bcrypt.compareoperations to an O(1) database query followed by at most onebcrypt.compareoperation.package.jsonwas restored to its original state. Runnpm run lintandnpm run buildlocally.PR created automatically by Jules for task 630936692844794017 started by @Shreyassp002