Skip to content

🛡️ Sentinel: [CRITICAL] Fix Sensitive Data Leakage in Schema Exports#616

Open
seonghobae wants to merge 2 commits into
mainfrom
sentinel/fix-schema-export-leak-5919666819166976175
Open

🛡️ Sentinel: [CRITICAL] Fix Sensitive Data Leakage in Schema Exports#616
seonghobae wants to merge 2 commits into
mainfrom
sentinel/fix-schema-export-leak-5919666819166976175

Conversation

@seonghobae

Copy link
Copy Markdown
Collaborator

🚨 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_fields redaction 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_json payload 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

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.
Copilot AI review requested due to automatic review settings July 22, 2026 01:57
@google-labs-jules

Copy link
Copy Markdown

👋 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.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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.

Comment thread backend/app/api/share.py Outdated
Comment thread backend/app/api/share.py Outdated
Comment thread backend/app/api/share.py Outdated
Comment thread backend/app/api/share.py Outdated
Comment thread backend/app/api/share.py Outdated
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.
Copilot AI review requested due to automatic review settings July 22, 2026 02:59

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.

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.

2 participants