π‘οΈ Sentinel: [CRITICAL] Fix Hardcoded Authentication Secrets and 2FA Bypasses#100
π‘οΈ Sentinel: [CRITICAL] Fix Hardcoded Authentication Secrets and 2FA Bypasses#100secrooq wants to merge 1 commit into
Conversation
Removed hardcoded `AUTH_SECRET` fallbacks from `src/middleware.ts` and `src/auth.ts`, alongside a hardcoded 2FA admin bypass backdoor. This enforces strict environment variable configuration, ensuring authentication mechanisms fail securely rather than defaulting to known, easily exploitable secrets. Co-authored-by: secrooq <81346684+secrooq@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 application relied on hardcoded fallbacks for
AUTH_SECRETin NextAuth andsrc/middleware.ts, and utilized a static backdoor string (stealth_dev_bypass_root_2026) for bypassing 2FA during admin recovery.π― Impact: If these files were leaked, an attacker could easily spoof valid administrative sessions using the known NextAuth encryption keys, or completely bypass the Two-Factor Authentication requirement for administrative users using the static backdoor string.
π§ Fix: Removed the static string fallbacks from
g.process.envedge initialization in bothsrc/auth.tsandsrc/middleware.ts. Replaced the static string fallback for NextAuth secret initialization with strict environment variable retrieval. Replaced the static 2FA backdoor expected secret with strict environment variable enforcement (process.env.ADMIN_BYPASS_SECRET).β Verification: Ran unit tests (
pnpm test) and production end-to-end tests (npx playwright test), both of which passed with the updated strict environment variables injected via test runtime configurations. Added the findings to.jules/sentinel.mdjournal.PR created automatically by Jules for task 12492422081940115033 started by @secrooq