Skip to content

πŸ›‘οΈ Sentinel: Fix information leakage in error responses#151

Open
AGI-Corporation wants to merge 1 commit intomainfrom
sentinel-error-leakage-prevention-7671149980504850261
Open

πŸ›‘οΈ Sentinel: Fix information leakage in error responses#151
AGI-Corporation wants to merge 1 commit intomainfrom
sentinel-error-leakage-prevention-7671149980504850261

Conversation

@AGI-Corporation
Copy link
Copy Markdown
Owner

πŸ›‘οΈ Sentinel: Fix information leakage in error responses

🚨 Severity: MEDIUM

πŸ’‘ Vulnerability: Unhandled exceptions and explicit HTTP 500 errors were returning raw exception strings (including potential stack traces or sensitive internal details) to the client. This could assist an attacker in mapping the application's internal structure and identifying further vulnerabilities.

🎯 Impact: Exposure of internal system details, library versions, and potential database structure through error messages.

πŸ”§ Fix:

  • Added a global @app.exception_handler(Exception) in backend/main.py that sanitizes unexpected errors.
  • Updated agents/mistral_agent/agent.py to log errors server-side and return generic safe messages.
  • Configured central logging for consistent auditability.

βœ… Verification:

  • New test suite tests/test_sentinel_errors.py specifically checks that raw error messages are suppressed while maintaining 404 and 422 informativeness.
  • All existing tests pass.
  • Verified manual triggers of unhandled exceptions return {"detail": "Internal server error"}.

PR created automatically by Jules for task 7671149980504850261 started by @AGI-Corporation

- Implemented a global exception handler in `backend/main.py` to catch unhandled errors and return a generic "Internal server error" message.
- Configured central logging to ensure all unhandled exceptions are logged with stack traces server-side.
- Refactored `agents/mistral_agent/agent.py` to stop leaking internal exception strings in HTTP 500 responses.
- Added `tests/test_sentinel_errors.py` to verify error leakage prevention and ensure built-in FastAPI exceptions (404, 422) are still informative.
- Ensured PEP8 compliance and verified all tests pass.

Co-authored-by: AGI-Corporation <186229839+AGI-Corporation@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.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 13, 2026

Warning

Rate limit exceeded

@AGI-Corporation has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 53 minutes and 23 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 53 minutes and 23 seconds.

βŒ› How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
βš™οΈ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 69a6d40d-bf6b-4572-a732-833cd664364d

πŸ“₯ Commits

Reviewing files that changed from the base of the PR and between c9be2df and 9de59d3.

πŸ“’ Files selected for processing (3)
  • agents/mistral_agent/agent.py
  • backend/main.py
  • tests/test_sentinel_errors.py
✨ Finishing Touches
πŸ§ͺ Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch sentinel-error-leakage-prevention-7671149980504850261

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❀️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

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