π‘οΈ Sentinel: Fix information leakage in Kafka app error handling#11
Conversation
- Catch exceptions in `FastAPIKafkaService._process_message` and return generic error message - Catch exceptions in `my_prediction_function` and return generic error message - Ensure full exceptions are logged for debugging - Add regression test `tests/controller/test_kafka_app_leakage.py` This prevents sensitive internal details (stack traces, database errors) from being exposed in the `error` field of prediction responses. Co-authored-by: lgcorzo <46710567+lgcorzo@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. |
- Catch exceptions in `FastAPIKafkaService._process_message` and return generic error message - Catch exceptions in `my_prediction_function` and return generic error message - Ensure full exceptions are logged for debugging - Add regression test `tests/controller/test_kafka_app_leakage.py` This prevents sensitive internal details (stack traces, database errors) from being exposed in the `error` field of prediction responses. Co-authored-by: lgcorzo <46710567+lgcorzo@users.noreply.github.com>
π‘οΈ Sentinel: [MEDIUM] Fix Information Leakage in Kafka App
π¨ Severity: MEDIUM
π‘ Vulnerability: Information Leakage in Exception Handling
The application was catching exceptions in the Kafka message processor and the prediction callback, then assigning the raw exception string (
str(e)) to theerrorfield of the response. This could leak sensitive internal details (e.g., "Sensitive Database Error...") to consumers or API clients.π― Impact:
Attackers could gain insight into the internal state, database structure, or library versions by triggering errors and inspecting the response.
π§ Fix:
FastAPIKafkaService._process_messageto return "An error occurred during prediction processing." instead of the exception string.my_prediction_functioninmain()to return "Prediction failed." instead of the exception string.logger.exception()to ensure full details are still available in server logs.β Verification:
Added
tests/controller/test_kafka_app_leakage.pywhich mocks a sensitive exception and asserts that the returned error message is generic.PR created automatically by Jules for task 4279098938021721935 started by @lgcorzo