Skip to content

🛡️ Sentinel: [MEDIUM] Fix Error Information Leakage#106

Open
socialawy-dev wants to merge 1 commit into
mainfrom
sentinel/fix-error-information-leakage-8927445750477530569
Open

🛡️ Sentinel: [MEDIUM] Fix Error Information Leakage#106
socialawy-dev wants to merge 1 commit into
mainfrom
sentinel/fix-error-information-leakage-8927445750477530569

Conversation

@socialawy-dev
Copy link
Copy Markdown
Collaborator

🚨 Severity: MEDIUM
💡 Vulnerability: The /api/projects/{project_id}/ingest endpoint inadvertently returned raw Python exception strings (e) directly to the client via a 500 HTTPException response. 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.error and return a generic "Upload failed" message in the HTTPException detail.
✅ Verification: We have run automated tests for ingest routes, and checked manually for regressions.

Additionally, updated .jules/sentinel.md to reflect this critical learning about information leakage.


PR created automatically by Jules for task 8927445750477530569 started by @socialawy

Co-authored-by: socialawy <24765060+socialawy@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.

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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}")
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

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.

Suggested change
logger.error(f"Upload failed for project {project_id}: {e}")
logger.exception(f"Upload failed for project {project_id}")

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