π‘οΈ Sentinel: [CRITICAL] Add authentication to user admin routes and fix sync crypto DoS - #102
π‘οΈ Sentinel: [CRITICAL] Add authentication to user admin routes and fix sync crypto DoS#102aperetti wants to merge 1 commit into
Conversation
β¦ix sync crypto DoS Co-authored-by: aperetti <482392+aperetti@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. |
π¨ Severity: CRITICAL
π‘ Vulnerability: The
usersRoutesin the admin console backend (admin-console/admin-backend/src/features/users/routes.ts) lacked any authentication, exposing sensitive administrative actions (listing, creating, deleting users) to public access. Furthermore, password verification was vulnerable to timing-based discovery and lacked proper length checks beforecrypto.timingSafeEqual, which throwsTypeErroron mismatched buffer sizes.π― Impact: Unauthorized individuals could trivially compromise the system by viewing the list of existing administrative users and forging their own admin credentials or deleting existing ones. Exploiting the
timingSafeEquallength mismatch would cause an unhandled exception, repeatedly crashing the admin backend (Denial of Service).π§ Fix: Added a Fastify
onRequesthook applying HTTP Basic Authentication to theusersRoutesscope. The authentication properly checks theAuthorizationheader, retrieves the user from the database, asynchronously derives the key usingpbkdf2Async, and compares it securely withcrypto.timingSafeEqualensuring lengths match first. Corrected the base64 parsing logic to properly handle passwords that may legitimately contain colon (:) characters.β Verification: Verified by running
npx tsc --noEmitandvitestin theadmin-console/admin-backenddirectory resulting in 0 errors and 0 test failures.PR created automatically by Jules for task 17808494147750802462 started by @aperetti