π‘οΈ Sentinel: [MEDIUM] Fix swallowed exceptions in custom global error handler - #213
π‘οΈ Sentinel: [MEDIUM] Fix swallowed exceptions in custom global error handler#213n24q02m wants to merge 1 commit into
Conversation
The global exception handler correctly obscured stack traces from clients by returning a generic 500 plain text response but accidentally swallowed the exception on the server side because it didn't explicitly log it. This commit adds `log.error` to properly track these unhandled exceptions internally. Co-authored-by: n24q02m <135627235+n24q02m@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: The FastAPI application used a custom global exception handler to apply security headers to 500 error responses, but this overrode Starlette's built-in
ServerErrorMiddlewarelogging. It returned a plain 500 response but silently swallowed the traceback on the server-side, making debugging impossible and masking potential exploitation attempts.π― Impact: Prevents operators from diagnosing internal server errors or identifying malicious activity causing repeated 500 responses.
π§ Fix: Added
log.error("Unhandled server error", exc_info=_exc)to the global exception handler to explicitly log the exception before returning the safe generic response.β Verification: Verified by inspecting the
src/tacet/serve/server.pyimplementation and ensuring the full test suite passes. Also ran the specifictest_mvp.pyendpoints.PR created automatically by Jules for task 12151315433162222503 started by @n24q02m