🔒 [security] Fix timing attack vulnerabilities in IPFS upload and admin routes#96
🔒 [security] Fix timing attack vulnerabilities in IPFS upload and admin routes#96scobru wants to merge 1 commit into
Conversation
…routes Replaced direct string comparisons (===) with timing-safe comparison logic using hashing and crypto.timingSafeEqual. This prevents attackers from brute-forcing the admin password by measuring response times. Modified files: - relay/src/routes/ipfs/upload.ts - relay/src/routes/ipfs/upload-directory.ts - relay/src/utils/relay-user.ts - relay/src/index.ts - relay/src/routes/index.ts Co-authored-by: scobru <1079164+scobru@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. |
🎯 What: The vulnerability fixed is a timing attack vulnerability in various authentication checks for the relay server's admin password.
ADMIN_PASSWORD, allowing them to brute-force the password in linear time (O(N)) instead of exponential time (O(CHARSET^N)). This would grant them full administrative access to the relay.🛡️ Solution: The fix replaces all direct string comparisons of the admin password with a timing-safe pattern:
secureCompare(which usescrypto.timingSafeEqual), ensuring the comparison takes the same amount of time regardless of how many characters match.This pattern was applied to the IPFS upload routes, the GunDB message validation, the static route protection middleware, and the IPFS API proxy authentication. All modified files now import
secureCompareandhashTokenfromrelay/src/utils/security.ts.PR created automatically by Jules for task 6069315999008562488 started by @scobru