🛡️ Sentinel: [MEDIUM] Fix information disclosure in upload error handling#73
🛡️ Sentinel: [MEDIUM] Fix information disclosure in upload error handling#73socialawy-dev wants to merge 1 commit into
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 information disclosure vulnerability in the /projects/{project_id}/ingest endpoint by sanitizing error messages returned to the client and logging the actual errors internally. It also updates the security documentation to reflect this fix. A review comment suggests using logger.exception instead of logger.error to ensure the full stack trace is captured for debugging purposes.
| with open(dest, "wb") as buffer: | ||
| shutil.copyfileobj(file.file, buffer) | ||
| except Exception as e: | ||
| logger.error(f"Upload failed for project {project_id}: {e}") |
There was a problem hiding this comment.
Using logger.exception is preferred over logger.error with the exception string in an except block. logger.exception automatically captures the full stack trace, which is invaluable for debugging internal errors that are now hidden from the API response. Note that logger.exception is already used elsewhere in this file (e.g., line 59).
| logger.error(f"Upload failed for project {project_id}: {e}") | |
| logger.exception(f"Upload failed for project {project_id}") |
Understood. Acknowledging that this work is superseded by #90 and stopping work on this task. |
🚨 Severity: MEDIUM
💡 Vulnerability: The
/projects/{project_id}/ingestAPI endpoint returned raw exception messages directly to clients on failure, potentially exposing sensitive internal details like stack traces, specific system errors, or file paths.🎯 Impact: Attackers could use this internal system information to map infrastructure or find other exploitation vectors.
🔧 Fix: Captured the actual exception using
logger.errorfor safe internal logging, and returned a generic, non-sensitive error message (Upload failed due to an internal error) via the HTTP 500 response.✅ Verification: Review the log entries to confirm
Upload failed for projectincludes the exception details and that thedetailinHTTPExceptionreturns the safe string. Tests pass successfully.PR created automatically by Jules for task 13803727874769485186 started by @socialawy