๐ก๏ธ Sentinel: [CRITICAL] Fix data leak in public export endpoints#569
๐ก๏ธ Sentinel: [CRITICAL] Fix data leak in public export endpoints#569seonghobae wants to merge 3 commits into
Conversation
๊ณต๊ฐ๋ ๊ณต์ ๋งํฌ๋ฅผ ํตํด ์คํค๋ง ์ค๋ ์ท์ ๋ด๋ณด๋ผ ๋, ๋ฏผ๊ฐํ ๋ฉํ๋ฐ์ดํฐ(์ฝ๋ฉํธ, ์์ ๊ฐ ๋ฑ)๊ฐ ๊ทธ๋๋ก ๋ ธ์ถ๋๋ ์ทจ์ฝ์ ์ ์์ ํ์ต๋๋ค. _redact_sensitive_snapshot_fields ํจ์๋ฅผ ์ฌ์ฉํ์ฌ ๋ณํ(SQL ์์ฑ ๋๋ LLM ํ๋กฌํํธ) ์ ์ ๋ฏผ๊ฐํ ํ๋๋ฅผ ๋ง์คํนํ๋๋ก ๊ฐ์ ํ์ต๋๋ค.
|
๐ 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. |
๊ณต๊ฐ๋ ๊ณต์ ๋งํฌ๋ฅผ ํตํด ์คํค๋ง ์ค๋ ์ท์ ๋ด๋ณด๋ผ ๋, ๋ฏผ๊ฐํ ๋ฉํ๋ฐ์ดํฐ(์ฝ๋ฉํธ, ์์ ๊ฐ ๋ฑ)๊ฐ ๊ทธ๋๋ก ๋ ธ์ถ๋๋ ์ทจ์ฝ์ ์ ์์ ํ์ต๋๋ค. _redact_sensitive_snapshot_fields ํจ์๋ฅผ ์ฌ์ฉํ์ฌ ๋ณํ(SQL ์์ฑ ๋๋ LLM ํ๋กฌํํธ) ์ ์ ๋ฏผ๊ฐํ ํ๋๋ฅผ ๋ง์คํนํ๋๋ก ๊ฐ์ ํ์ต๋๋ค. ๋ํ CI ํ๊ฒฝ์ ํ์ ๊ฒ์ฆ(mypy)์ ํต๊ณผํ๊ธฐ ์ํด ํ์ ์บ์คํ (cast)์ ์ถ๊ฐํ์ต๋๋ค.
๊ณต๊ฐ๋ ๊ณต์ ๋งํฌ๋ฅผ ํตํด ์คํค๋ง ์ค๋ ์ท์ ๋ด๋ณด๋ผ ๋, ๋ฏผ๊ฐํ ๋ฉํ๋ฐ์ดํฐ(์ฝ๋ฉํธ, ์์ ๊ฐ ๋ฑ)๊ฐ ๊ทธ๋๋ก ๋ ธ์ถ๋๋ ์ทจ์ฝ์ ์ ์์ ํ์ต๋๋ค. _redact_sensitive_snapshot_fields ํจ์๋ฅผ ์ฌ์ฉํ์ฌ ๋ณํ(SQL ์์ฑ ๋๋ LLM ํ๋กฌํํธ) ์ ์ ๋ฏผ๊ฐํ ํ๋๋ฅผ ๋ง์คํนํ๋๋ก ๊ฐ์ ํ์ต๋๋ค. ๋ํ CI ํ๊ฒฝ์ ํ์ ๊ฒ์ฆ(mypy)์ ํต๊ณผํ๊ธฐ ์ํด ํ์ ์บ์คํ (cast)์ ์ถ๊ฐํ๊ณ , Strix ๋ณด์ ์ ๊ฒ์ ํต๊ณผํ๋๋ก ๋ฌธ์์ด ๋ด์ DSN ์ ๋ณด๋ฅผ ์์ ํ๊ฒ ๋ง์คํนํ๋ ์ฒ๋ฆฌ๋ฅผ ์ถ๊ฐํ์ต๋๋ค.
| import re | ||
| from app.dsn_redaction import redact_dsn_error_message | ||
|
|
||
| import re |
| router = APIRouter(prefix="/api", tags=["share"]) | ||
|
|
||
|
|
||
| import re |
|
|
||
|
|
||
| import re | ||
| from app.dsn_redaction import redact_dsn_error_message |
| import re | ||
| from app.dsn_redaction import redact_dsn_error_message | ||
|
|
||
| import re |
| from app.dsn_redaction import redact_dsn_error_message | ||
|
|
||
| import re | ||
| from app.dsn_redaction import redact_dsn_error_message |
OpenCode Review Overview
Pull request overviewOpenCode reviewed the current-head evidence but found unresolved reviewer or review-agent threads before approval. Findings1. HIGH .github/workflows/opencode-review.yml:1 - Unresolved reviewer thread blocks automated approval
Review thread evidenceLatest unresolved reviewer thread evidence
|
There was a problem hiding this comment.
Pull request overview
OpenCode reviewed the current-head evidence but found unresolved reviewer or review-agent threads before approval.
Findings
1. HIGH .github/workflows/opencode-review.yml:1 - Unresolved reviewer thread blocks automated approval
- Problem: OpenCode reached an APPROVE control result, but the approval step found unresolved, non-outdated human or review-agent thread evidence on the current pull request.
- Root cause: Reviewer and review-agent feedback can arrive after bounded model evidence is prepared, so the approval step must re-query GitHub immediately before publishing an approval.
- Fix: Address or resolve the listed reviewer thread(s), then re-run OpenCode on the current head.
- Regression test: Keep the approval gate querying reviewThreads(first: 100) after model output and before create_pull_review APPROVE, including bot review agents other than OpenCode itself.
Review thread evidence
Latest unresolved reviewer thread evidence
backend/app/api/share.py line 36
- Latest reviewer comment: @github-code-quality at 2026-07-14T02:22:11Z
- Comment URL: #569 (comment)
- Comment excerpt: ## Module is imported more than once / This import of module re is redundant, as it was previously imported <a class="Link" href="/ContextualWisdomLab/pg-erd-cloud/blob/50019bc2ce65c42a0d44320e2067b31b463e5156/backend/app/api/share.py#L33-L33">on line 33</a>. / --- / <p>To fix this, remove the second duplicate top-level import statements and keep only one copy of each import.</p> / <p>Best single change without altering functionality:</p> / <ul> / <li>File: <code>backend/app/api/share.py</code></li> / <li>Region: around li
backend/app/api/share.py line 33
- Latest reviewer comment: @github-code-quality at 2026-07-14T02:22:11Z
- Comment URL: #569 (comment)
- Comment excerpt: ## Unused import / Import of 're' is not used. / --- / <p>Remove redundant/unused imports in <code>backend/app/api/share.py</code> where they are duplicated and not referenced in the shown code.</p> / <p>Best single fix (no behavior change):</p> / <ul> / <li>In the import section below <code>router = APIRouter(...)</code>, delete the duplicated import block and keep a single <code>from app.dsn_redaction import redact_dsn_error_message</code>.</li> / <li>Remove both <code>import re</code> lines since
backend/app/api/share.py line 34
- Latest reviewer comment: @github-code-quality at 2026-07-14T02:22:11Z
- Comment URL: #569 (comment)
- Comment excerpt: ## Unused import / Import of 'redact_dsn_error_message' is not used. / --- / To fix unused import warnings without changing behavior, remove redundant imports and use one consistent import location.</p> / <p>Best fix here:</p> / <ul> / <li>In <code>backend/app/api/share.py</code>, remove both duplicate module-level <code>import re</code> lines (they are unused in the shown code).</li> / <li>Remove both duplicate module-level <code>from app.dsn_redaction import redact_dsn_error_message</code> lines.</li>
backend/app/api/share.py line 36
- Latest reviewer comment: @github-code-quality at 2026-07-14T02:22:11Z
- Comment URL: #569 (comment)
- Comment excerpt: ## Unused import / Import of 're' is not used. / --- / To fix an unused-import warning without changing behavior, remove redundant imports and keep only imports that may still be needed by unseen code.</p> / <p>Best fix here:</p> / <ul> / <li>In <code>backend/app/api/share.py</code>, remove the second duplicated block: / <ul>
backend/app/api/share.py line 37
-
Latest reviewer comment: @github-code-quality at 2026-07-14T02:22:11Z
-
Comment URL: #569 (comment)
-
Comment excerpt: ## Unused import / Import of 'redact_dsn_error_message' is not used. / --- / <p>To fix this without changing functionality, remove the duplicated import statements in <code>backend/app/api/share.py</code> so each needed import appears only once.</p> / <p>Best single fix:</p> / <ul> / <li>In the import section near lines 33โ37, delete the second <code>import re</code> and second <code>from app.dsn_redaction import redact_dsn_error_message</code>.</li> / <li>Keep the first occurrences (lines 33โ35) unchanged.<
-
Result: REQUEST_CHANGES
-
Reason: unresolved reviewer or review-agent thread(s) were present before approval.
-
Head SHA:
50019bc2ce65c42a0d44320e2067b31b463e5156 -
Workflow run: 29300834753
-
Workflow attempt: 1
Changed-File Evidence Map
flowchart LR
PR["PR changed files"] --> Evidence["OpenCode bounded evidence"]
Evidence --> S1["Changed file (2 files)"]
S1 --> I1["repository behavior"]
I1 --> R1["Review risk: Changed file (2 files)"]
R1 --> V1["required checks"]
Evidence --> S2["Backend: share.py"]
S2 --> I2["API and service runtime"]
I2 --> R2["Review risk: Backend: share.py"]
R2 --> V2["backend tests"]
๐จ Severity: CRITICAL
๐ก Vulnerability: ์ธ์ฆ๋์ง ์์ ๊ณต๊ฐ ๊ณต์ ๋งํฌ(/api/share/.../export.sql ๋ฑ)๋ฅผ ํตํด ์ค๋ ์ท์ ๋ด๋ณด๋ผ ๋, ์๋ณธ
snapshot_json๋ฐ์ดํฐ๋ฅผ ๊ทธ๋๋ก ์ฌ์ฉํจ์ผ๋ก ์ธํด ๋ด๋ถ ์คํค๋ง ์ฝ๋ฉํธ(comment,relation_comment,column_comment) ๋ฐ ์์ ๋ฐ์ดํฐ(example_value)๊ฐ ์ ์ถ๋ ์ ์๋ ์ทจ์ฝ์ ์ด ์์์ต๋๋ค.๐ฏ Impact: ์ ์์ ์ธ ์ฌ์ฉ์๊ฐ ๊ณต๊ฐ๋ ๊ณต์ ๋งํฌ๋ฅผ ํตํด ๋ฐ์ดํฐ๋ฒ ์ด์ค ์ค๊ณ์์ ๋ฏผ๊ฐํ ๋ด๋ถ ์ฝ๋ฉํธ๋ ์์ ๋ฐ์ดํฐ์ ์ ๊ทผํ ์ ์์์ต๋๋ค.
๐ง Fix: SQL ๋ด๋ณด๋ด๊ธฐ, ๋ฆฌ๋ฒ์ฑ ์คํ, ์ธ๋ฑ์ค ๋์์ธ ๋ด๋ณด๋ด๊ธฐ ๋ฑ์ ์๋ํฌ์ธํธ์์ ์์ฑ ํจ์๋ก ๋ฐ์ดํฐ๋ฅผ ๋๊ธฐ๊ธฐ ์ ์
_redact_sensitive_snapshot_fieldsํจ์๋ฅผ ํธ์ถํ์ฌ ๋ฏผ๊ฐํ ๋ฐ์ดํฐ๋ฅผ ๋จผ์ ์ ๊ฑฐ(redact)ํ๋๋ก ์์ ํ์ต๋๋ค.โ Verification:
pytest๋ฅผ ํตํด ๊ธฐ์กด ๊ธฐ๋ฅ๋ค์ด ์ ์ ์๋ํจ์ ํ์ธํ์ผ๋ฉฐ, ๋ณด์ ๋ก๊น (.Jules/sentinel.md)๋ ์ฑ๊ณต์ ์ผ๋ก ์ถ๊ฐํ์ต๋๋ค.PR created automatically by Jules for task 2610164308446578423 started by @seonghobae