Skip to content

πŸ›‘οΈ Sentinel: [security improvement] Fix swallowed tracebacks in global exception handler - #236

Open
n24q02m wants to merge 1 commit into
mainfrom
sentinel/fix-swallowed-tracebacks-1979960182809448400
Open

πŸ›‘οΈ Sentinel: [security improvement] Fix swallowed tracebacks in global exception handler#236
n24q02m wants to merge 1 commit into
mainfrom
sentinel/fix-swallowed-tracebacks-1979960182809448400

Conversation

@n24q02m

@n24q02m n24q02m commented Sep 9, 2026

Copy link
Copy Markdown
Owner

🚨 Severity: MEDIUM
πŸ’‘ Vulnerability: The global @app.exception_handler(Exception) in src/tacet/serve/server.py was returning a generic 500 error to avoid leaking tracebacks to the client (which is good), but it failed to log the exception server-side. This silently swallowed all unhandled exceptions, making incident response and debugging extremely difficult.
🎯 Impact: Unhandled server errors would fail silently without leaving a trace in the logs, leading to a loss of critical diagnostic information and delayed vulnerability detection.
πŸ”§ Fix: Added logging.error("Unhandled exception", exc_info=_exc) to the unhandled_exception_handler to ensure the traceback is preserved in the server logs while still returning the safe, generic 500 response to the client.
βœ… Verification: Verified by throwing a deliberate exception (1/0) in a test route and confirming that the traceback is correctly logged via standard python logging output while the HTTP client still receives the generic 500 response. Tests pass via uv run --all-extras pytest.


PR created automatically by Jules for task 1979960182809448400 started by @n24q02m

The custom global exception handler for FastAPI (used to inject
security headers into 500 error responses) was successfully catching
all exceptions but returning a generic plain text response without
logging the exception traceback. This causes unhandled exceptions
to be silently swallowed on the server side, violating operational
security practices for debugging and incident response.

This commit adds a call to `logging.error` with `exc_info=_exc` to
explicitly log the traceback server-side before returning the
generic 500 response to the client.

Co-authored-by: n24q02m <135627235+n24q02m@users.noreply.github.com>
@google-labs-jules

Copy link
Copy Markdown
Contributor

πŸ‘‹ 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 @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant