🛡️ Sentinel: [CRITICAL] Fix Sensitive Data Leakage in Schema Exports#616
🛡️ Sentinel: [CRITICAL] Fix Sensitive Data Leakage in Schema Exports#616seonghobae wants to merge 2 commits into
Conversation
The public unauthenticated share endpoints were passing raw database schema payload (`data.snapshot_json`) directly into downstream export functions (SQL, Markdown, etc.). This exposed sensitive schema metadata, such as database comments and example values. This commit wraps the payload with `_redact_sensitive_snapshot_fields` before passing it to downstream exporters, successfully mitigating the information disclosure vulnerability.
|
👋 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.
Pull request overview
Note
Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.
Fixes sensitive schema metadata leakage in public share export endpoints by ensuring snapshot JSON is redacted before producing SQL/Markdown exports and LLM prompts.
Changes:
- Apply
_redact_sensitive_snapshot_fields()to snapshot payloads for SQL export. - Apply
_redact_sensitive_snapshot_fields()to snapshot payloads for reversing spec and index design endpoints (including LLM draft mode). - Document the incident and prevention guidance in Sentinel notes.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| backend/app/api/share.py | Redacts sensitive snapshot fields before serializing to SQL/Markdown or sending to LLM generation functions. |
| .Jules/sentinel.md | Adds an incident entry describing the export redaction gap and prevention guidance. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
The previous commit introduced a CI failure (`app/api/share.py:175: error: Argument 1 to "snapshot_json_to_sql" has incompatible type`) because `_redact_sensitive_snapshot_fields` is typed to return `dict | list | str | int | float | bool | None`, but the downstream serializers expect a strictly typed `dict`. This patch introduces a `cast(dict, ...)` to satisfy `mypy` and resolve the GitHub Action CI check failure.
🚨 Severity: CRITICAL
💡 Vulnerability: The public, unauthenticated share endpoints (
/api/share/.../export.sql,/api/share/.../reversing-spec.md,/api/share/.../index-design.md) were returning sensitive database schema metadata (comments, example values) when exporting schemas to SQL or Markdown format, as they failed to apply the_redact_sensitive_snapshot_fieldsredaction utility used for JSON payloads.🎯 Impact: Unauthenticated users with a share link could potentially view sensitive data (e.g. PII, internal logic, or credentials) inadvertently stored in database schema comments or example values.
🔧 Fix: Wrapped the raw
data.snapshot_jsonpayload with_redact_sensitive_snapshot_fields()before passing it to downstream serializer/LLM functions, ensuring the same sanitization is applied across all public export endpoints.✅ Verification: Backend unit tests were executed and passed successfully (
pytest --cov=app), demonstrating that the endpoints function correctly with the sanitization step included.PR created automatically by Jules for task 5919666819166976175 started by @seonghobae