π‘οΈ Sentinel: [HIGH] Fix Information Leakage in API Errors#159
π‘οΈ Sentinel: [HIGH] Fix Information Leakage in API Errors#159AGI-Corporation wants to merge 1 commit intomainfrom
Conversation
Implemented a global exception handler to prevent sensitive data leakage in 500 responses. Detailed unhandled exceptions are now logged server-side while clients receive a generic message. Removed insecure try-except blocks in Mistral agent endpoints. Added tests to verify protection and ensure no regression for standard HTTP exceptions. Co-authored-by: AGI-Corporation <186229839+AGI-Corporation@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. |
There was a problem hiding this comment.
π‘ Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8882fa4304
βΉοΈ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with π.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| return JSONResponse( | ||
| status_code=exc.status_code, | ||
| content={"detail": exc.detail}, | ||
| ) |
There was a problem hiding this comment.
Preserve HTTPException headers in error responses
The new global handler rewraps StarletteHTTPException into a fresh JSONResponse but drops exc.headers, which changes protocol behavior for framework-generated/client-critical errors. In backend/main.py, this means responses like 405 Method Not Allowed lose their Allow header (and any future 401 auth challenges would lose WWW-Authenticate), so clients can no longer rely on standard HTTP metadata even though the status code/detail are preserved.
Useful? React with πΒ / π.
|
Warning Rate limit exceeded
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 55 minutes and 53 seconds. β How to resolve this issue?After the wait time has elapsed, a review can be triggered using the 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 configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: π Files selected for processing (4)
β¨ Finishing Touchesπ§ͺ Generate unit tests (beta)
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. Comment |
π¨ Severity: HIGH
π‘ Vulnerability: API endpoints in the Mistral agent were explicitly catching all exceptions and returning the raw exception message (
str(e)) in the HTTP 500 response detail.π― Impact: Sensitive internal information, such as database connection strings, internal file paths, or detailed logic errors, could be exposed to end users or attackers, facilitating further exploitation.
π§ Fix: Implemented a global exception handler in
backend/main.pythat intercepts all unhandled exceptions, logs the full details server-side for debugging, and returns a safe, generic "Internal server error" message to the client. Removed redundant and insecuretry-exceptblocks from agent routers.β Verification: Created
tests/test_error_leakage.pywhich mocks a sensitive exception and confirms that the response does not contain the secret data and instead returns a generic error. Verified that standard 4xx errors are still preserved.PR created automatically by Jules for task 11848863788720786274 started by @AGI-Corporation