Skip to content

πŸ›‘οΈ Sentinel: Fix information leakage in Kafka app error handling#11

Merged
lgcorzo merged 2 commits into
mainfrom
sentinel-fix-kafka-leakage-4279098938021721935
Feb 6, 2026
Merged

πŸ›‘οΈ Sentinel: Fix information leakage in Kafka app error handling#11
lgcorzo merged 2 commits into
mainfrom
sentinel-fix-kafka-leakage-4279098938021721935

Conversation

@lgcorzo
Copy link
Copy Markdown
Owner

@lgcorzo lgcorzo commented Feb 4, 2026

πŸ›‘οΈ 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 the error field 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:

  • Modified FastAPIKafkaService._process_message to return "An error occurred during prediction processing." instead of the exception string.
  • Modified my_prediction_function in main() to return "Prediction failed." instead of the exception string.
  • Added logger.exception() to ensure full details are still available in server logs.

βœ… Verification:
Added tests/controller/test_kafka_app_leakage.py which mocks a sensitive exception and asserts that the returned error message is generic.


PR created automatically by Jules for task 4279098938021721935 started by @lgcorzo

- 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>
@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.

- 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>
@lgcorzo lgcorzo merged commit 1868b6d into main Feb 6, 2026
4 checks passed
@lgcorzo lgcorzo deleted the sentinel-fix-kafka-leakage-4279098938021721935 branch February 6, 2026 15:38
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