🛡️ Sentinel: [MEDIUM] Fix Error Information Leakage#106
Conversation
Co-authored-by: socialawy <24765060+socialawy@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.
Code Review
This pull request addresses an error information leakage vulnerability in the ingest endpoint by logging the detailed error internally and returning a generic error message to the client. It also documents this security fix in .jules/sentinel.md and updates dependency constraints in uv.lock. The reviewer suggested using logger.exception instead of logger.error to preserve the full stack trace for easier debugging.
| except Exception as e: | ||
| shutil.rmtree(tmp_dir, ignore_errors=True) | ||
| raise HTTPException(status_code=500, detail=f"Upload failed: {e}") | ||
| logger.error(f"Upload failed for project {project_id}: {e}") |
There was a problem hiding this comment.
Logging only the exception string e via logger.error discards the traceback, which makes debugging production issues difficult. Using logger.exception instead will automatically log the full stack trace of the caught exception.
| logger.error(f"Upload failed for project {project_id}: {e}") | |
| logger.exception(f"Upload failed for project {project_id}") |
🚨 Severity: MEDIUM
💡 Vulnerability: The
/api/projects/{project_id}/ingestendpoint inadvertently returned raw Python exception strings (e) directly to the client via a 500HTTPExceptionresponse. This allows an attacker to glean internal application data such as file paths (like/tmp/...) or stack traces when providing malformed inputs.🎯 Impact: Attackers can learn about internal filesystem structure or implementation details, assisting in reconnaissance.
🔧 Fix: We changed the exception handling logic to log the exact error server-side via
logger.errorand return a generic "Upload failed" message in theHTTPExceptiondetail.✅ Verification: We have run automated tests for
ingestroutes, and checked manually for regressions.Additionally, updated
.jules/sentinel.mdto reflect this critical learning about information leakage.PR created automatically by Jules for task 8927445750477530569 started by @socialawy