๐ก๏ธ Sentinel: [HIGH] Fix credential leak due to unhandled DSN URL schemes#412
Conversation
โฆL schemes) Python์ `urllib.parse.urlsplit` ํจ์๊ฐ ์ธ๋์ค์ฝ์ด(`_`)๊ฐ ํฌํจ๋ URL ์คํด(์: `snowflake_invalid://`)์ ์ฌ๋ฐ๋ฅด๊ฒ ํ์ฑํ์ง ๋ชปํ๊ณ ๋น(empty) ์คํด์ผ๋ก ํ๊ฐํ๋ ๋ฌธ์ ๊ฐ ์์์ต๋๋ค. ์ด๋ก ์ธํด DSN ์๋ฌ ๋ฉ์์ง์ ํฌํจ๋ ๋น๋ฐ๋ฒํธ๋ฅผ ์ถ์ถํ์ฌ ๋ง์คํน(redaction)ํ๋ ๋ก์ง์ด ๋์ํ์ง ์์, ๋ก๊ทธ ๋ฐ ํด๋ผ์ด์ธํธ ์๋ฌ ์๋ต์ ๋ฐ์ดํฐ๋ฒ ์ด์ค ์๊ฒฉ ์ฆ๋ช ์ด ๋ ธ์ถ๋๋ ์ทจ์ฝ์ ์ด ์กด์ฌํ์ต๋๋ค. ํ์ฑ ์ ์ ๊ทํํ์์ ํตํด ์คํด ๋ถ๋ถ์ ์์๋ก ์๋ ค์ง ์ฌ๋ฐ๋ฅธ ํํ(์: `http://`)๋ก ๋ณ๊ฒฝํ ๋ค `urlsplit`์ ์ํํ๋๋ก ์ฐํ ์ฝ๋๋ฅผ ์ถ๊ฐํ์ฌ, ์ ์ ์๊ฑฐ๋ ์๋ชป๋ ์คํด์ ๊ฐ์ง DSN ๋ฌธ์์ด์์๋ ์ฌ๋ฐ๋ฅด๊ฒ ๋น๋ฐ๋ฒํธ ํ๋ณด๊ตฐ์ ์ถ์ถํ๊ณ ๋ง์คํนํ ์ ์๋๋ก ์์ ํ์ต๋๋ค. ๋ํ ํด๋น ์ด์์ ๋ํ ์๋ํ๋ ํ๊ท ํ ์คํธ(regression test)๋ฅผ ์ถ๊ฐํ๊ณ , ๊ด๋ จ ๋ด์ฉ์ `.jules/sentinel.md` ์ ๊ธฐ๋กํ์์ต๋๋ค.
|
๐ 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
This PR addresses a credential leak risk in backend error redaction when DSNs use non-standard URL schemes (notably schemes containing underscores) that urllib.parse.urlsplit fails to parse correctly, potentially preventing password extraction/redaction.
Changes:
- Add a fallback parsing path in DSN password-candidate extraction by temporarily substituting an invalid/unknown scheme with
http://whenurlsplityields an empty scheme. - Add unit tests to verify secret candidate extraction and error-message redaction for DSNs with unsupported schemes and for standard PostgreSQL DSNs.
- Document the vulnerability/learning/prevention guidance in
.jules/sentinel.md.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
backend/app/dsn_redaction.py |
Adds scheme-substitution fallback so urlsplit can extract userinfo/query secrets for redaction even when the original scheme is malformed (e.g., contains underscores). |
backend/tests/test_dsn_redaction.py |
Adds focused tests validating secret candidate extraction and redaction behavior for malformed-scheme and standard DSNs. |
.jules/sentinel.md |
Records the vulnerability pattern and mitigation guidance for future prevention. |
๐ก Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
OpenCode exhausted the configured model pool without a usable current-head review conclusion. This is not approval evidence, so the PR is blocked until a source-backed review can establish approval sufficiency or identify concrete fixes.
Findings
1. HIGH .jules/sentinel.md:1 - OpenCode could not establish approval sufficiency
- Problem: every configured model path failed to produce a usable current-head control block.
- Root cause: model execution, timeout, export, normalization, or approval-gate validation did not complete after exponential retry across the configured model pool.
- Impact: approving from deterministic check state alone would miss PR-intent mismatches, missing files, edge-case bugs, robustness gaps, UX/DX regressions, security issues, and CodeGraph-backed base/head flow changes.
- Fix: rerun OpenCode after model availability recovers, or update the PR with the missing files, tests, docs, generated artifacts, and verification evidence needed for a source-backed review conclusion.
- Regression test: keep the approval gate posting REQUEST_CHANGES, not APPROVE or check-only failure, when no model produces a valid current-head review.
Summary
- Result: REQUEST_CHANGES
- Reason: coverage-evidence passed and peer GitHub Checks completed without failures, but no model produced a valid review control block.
- Deterministic evidence checked but not used for approval: current-head changed-file evidence (.jules/sentinel.md, backend/app/dsn_redaction.py, backend/tests/test_dsn_redaction.py); coverage-evidence result success; peer checks from statusCheckRollup excluding this OpenCode check.
- Model outcome: model_pool=exhausted; selected_model=none.
- Head SHA:
3962109996437937e24b2b79bfb2e9abc1398221 - Workflow run: 28549565437
- Workflow attempt: 1
No PR approval was posted because model-output failure is not evidence that the PR has no blockers.
Changed-File Evidence Map
flowchart LR
PR["PR changed files"] --> Evidence["OpenCode bounded evidence"]
Evidence --> S1["Changed file: sentinel.md"]
S1 --> I1["repository behavior"]
I1 --> R1["Review risk: Changed file: sentinel.md"]
R1 --> V1["required checks"]
Evidence --> S2["Backend (2 files)"]
S2 --> I2["API and service runtime"]
I2 --> R2["Review risk: Backend (2 files)"]
R2 --> V2["backend tests"]
| **Vulnerability:** Database driver exceptions can echo DSN fragments, query parameters, or assignment-style secrets after connection failures, leaking plaintext passwords through snapshot error messages and queue logs. | ||
| **Learning:** Redacting only the literal DSN is not enough. Error messages may contain decoded, percent-encoded, query-string, or `password=`/`api_key=` style forms of the same secret. | ||
| **Prevention:** Sanitize snapshot job errors before persisting or re-raising them, and raise sanitized exceptions with `from None` so Python exception chaining does not reattach the original secret-bearing exception. | ||
|
|
There was a problem hiding this comment.
HIGH OpenCode could not establish approval sufficiency
- Problem: the model pool exhausted without a valid current-head review control block, so this changed line cannot be approved from deterministic check state alone.
- Impact: PR-intent mismatches, missing files, robustness bugs, UX/DX regressions, and CodeGraph-backed flow changes could be missed.
- Fix: rerun OpenCode after model availability recovers, or add the missing source/test/docs/generated verification evidence needed for a source-backed approval.
- Verification: rerun the OpenCode Review workflow and confirm it emits APPROVE or source-backed REQUEST_CHANGES for this head SHA.
OpenCode Review Overview
Pull request overviewOpenCode exhausted the configured model pool without a usable current-head review conclusion. This is not approval evidence, so the PR is blocked until a source-backed review can establish approval sufficiency or identify concrete fixes. Findings1. HIGH .jules/sentinel.md:1 - OpenCode could not establish approval sufficiency
Summary
No PR approval was posted because model-output failure is not evidence that the PR has no blockers. Changed-File Evidence Mapflowchart LR
PR["PR changed files"] --> Evidence["OpenCode bounded evidence"]
Evidence --> S1["Changed file: sentinel.md"]
S1 --> I1["repository behavior"]
I1 --> R1["Review risk: Changed file: sentinel.md"]
R1 --> V1["required checks"]
Evidence --> S2["Backend (2 files)"]
S2 --> I2["API and service runtime"]
I2 --> R2["Review risk: Backend (2 files)"]
R2 --> V2["backend tests"]
|
๐จ Severity: HIGH
๐ก Vulnerability:
urllib.parse.urlsplit์ด ์ธ๋์ค์ฝ์ด๊ฐ ํฌํจ๋ URL ์คํด(์:snowflake_invalid://)์ ๋น ๋ฌธ์์ด๋ก ์ฒ๋ฆฌํ์ฌ, ์๋ชป๋ ํ์์ DSN ์ฐ๊ฒฐ ์คํจ ์ ์๋ฌ ๋ฉ์์ง์ ํ๋ฌธ ์ํธ๊ฐ ๊ทธ๋๋ก ๋ ธ์ถ๋๋ ์๊ฒฉ ์ฆ๋ช ์ ์ถ(Credential Leak) ์ทจ์ฝ์ ์ ๋๋ค.๐ฏ Impact: ๊ณต๊ฒฉ์ ํน์ ๋ด๋ถ ๋ก๊ทธ ์ ๊ทผ์๊ฐ ๋ฐ์ดํฐ๋ฒ ์ด์ค ์๊ฒฉ ์ฆ๋ช ์ ํ๋ํ ์ ์์ต๋๋ค.
๐ง Fix: ๋น๋ฐ๋ฒํธ ๋ง์คํน์ ์ํ DSN ํ์ฑ ์, ์ ์ ์๋ ์คํด ๋ถ๋ถ์ ์์๋ก
http://๋ก ์นํํ์ฌurlsplit์ด ์ฌ์ฉ์ ์ ๋ณด๋ฅผ ์ ์์ ์ผ๋ก ํ์ฑํ๋๋ก ๊ฐ์ ์ฐํํ์ต๋๋ค.โ Verification:
backend/tests/test_dsn_redaction.py์ ๋ ํ ์คํธ๋ฅผ ์ถ๊ฐํ์ฌ ์ ๊ทํ ๋ฐ ๋ง์คํน ์ฑ๊ณต์ ๊ฒ์ฆํ์ต๋๋ค. (cd backend && uv run pytest tests/test_dsn_redaction.py)PR created automatically by Jules for task 3749945389775870191 started by @seonghobae