π‘οΈ Sentinel: [MEDIUM] Fix information leakage in authentication exceptions - #183
π‘οΈ Sentinel: [MEDIUM] Fix information leakage in authentication exceptions#183shadowcoder8 wants to merge 1 commit into
Conversation
Explicitly catch and re-raise HTTPExceptions while general Exceptions are now logged and a generic 500 status error is returned to the client to prevent sensitive data disclosure. Co-authored-by: shadowcoder8 <185462083+shadowcoder8@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: MEDIUM
π‘ Vulnerability: Unhandled exceptions in the
admin_loginroute were caught by a broadexcept Exception as e:block and directly returned to the client as anHTTPExceptionwith the string representation of the error. This risks exposing sensitive internal details such as database connection strings, paths, or stack traces if an unexpected failure occurs.π― Impact: Potential information disclosure which attackers can use to gather context for further attacks.
π§ Fix: Refactored the
try...exceptblock to first catch and explicitly re-raise expectedHTTPExceptions. The generalExceptionhandler now logs the detailed error internally and returns a generic "An internal error occurred during login" message (status 500) to the client.β Verification: Added an ad-hoc test script
tests/verify_auth.pythat mocks an internal exception to verify the generic 500 error is returned and specific HTTP exceptions are still properly propagated. Run the full standard test suite to confirm no regressions. All pass. Also added learnings to.jules/sentinel.md.PR created automatically by Jules for task 1379834590047110492 started by @shadowcoder8