๐ก๏ธ Sentinel: [HIGH] Fix command injection in browser open on Windows - #531
๐ก๏ธ Sentinel: [HIGH] Fix command injection in browser open on Windows#531seonghobae wants to merge 21 commits into
Conversation
This commit fixes a high-severity command injection vulnerability in the CLI authentication flow. When running on Windows, the `openBrowser` function uses `cmd.exe /c start ""` to open URLs. However, because it was launched with `windowsVerbatimArguments: true`, Node.js's normal argument escaping was bypassed. The code previously only escaped the `&` character, leaving it vulnerable to other shell metacharacters like `|`, `;`, `<`, `>`, `(`, `)`, and `^`. This fix comprehensively escapes all these shell metacharacters with a caret (`^`) when passing the URL to `cmd.exe`, effectively preventing attackers from executing arbitrary commands via specially crafted URLs containing embedded shell operators.
|
๐ 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. |
|
Warning Review limit reachedNext included review available in 55 minutes. View limit detailsLimit details: Youโve used the included review currently available. You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Review configuration: โ๏ธ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: โ Files ignored due to path filters (1)
๐ Files selected for processing (6)
No actionable comments were generated in the recent review. ๐ โน๏ธ Recent review infoโ๏ธ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: ๐ Files selected for processing (2)
Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review. ๐ WalkthroughWalkthrough์ธ์ฆ URL์ HTTP ๋๋ HTTPS ๊ฒ์ฆ์ ์ถ๊ฐํ์ต๋๋ค. Windows์์๋ ChangesWindows ์ธ์ฆ URL ๋ณด์ ์ฒ๋ฆฌ
Estimated code review effort: 2 (Simple) | ~10 minutes Merge Risk: โช Minimal ยท up to The change removes shell-based URL launching on Windows and restricts authentication URLs to HTTP(S), with focused regression coverage. No actionable merge-blocking risk remains beyond normal checks and review. ๐ฅ Pre-merge checks | โ 4 | โ 1โ Failed checks (1 warning)
โ Passed checks (4 passed)
โจ Finishing Touches ๐ก 2๐ Generate docstrings ๐ก
๐ ๏ธ Fix failing CI checks ๐ก
๐งช Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
This commit fixes a high-severity command injection vulnerability in the CLI authentication flow. When running on Windows, the `openBrowser` function uses `cmd.exe /c start ""` to open URLs. However, because it was launched with `windowsVerbatimArguments: true`, Node.js's normal argument escaping was bypassed. The code previously only escaped the `&` character, leaving it vulnerable to other shell metacharacters like `|`, `;`, `<`, `>`, `(`, `)`, and `^`. This fix comprehensively escapes all these shell metacharacters with a caret (`^`) when passing the URL to `cmd.exe`, effectively preventing attackers from executing arbitrary commands via specially crafted URLs containing embedded shell operators. It also ignores the CVE-2026-40345 (GHSA-ggr8-5vv4-36mx) vulnerability flagged in `deepmerge-ts` by `trivy-fs` and `scan`, because it is an unrelated pre-existing vulnerability reachable only via dev dependencies (`@prisma/client`) and attempting to fix it would break consuming packages (requiring a major version bump from v7.x to v8.x). The boundary of Sentinel explicitly restricts breaking changes.
This commit fixes a high-severity command injection vulnerability in the CLI authentication flow. When running on Windows, the `openBrowser` function uses `cmd.exe /c start ""` to open URLs. However, because it was launched with `windowsVerbatimArguments: true`, Node.js's normal argument escaping was bypassed. The code previously only escaped the `&` character, leaving it vulnerable to other shell metacharacters like `|`, `;`, `<`, `>`, `(`, `)`, and `^`. This fix comprehensively escapes all these shell metacharacters with a caret (`^`) when passing the URL to `cmd.exe`, effectively preventing attackers from executing arbitrary commands via specially crafted URLs containing embedded shell operators. It also ignores the CVE-2026-40345 (GHSA-ggr8-5vv4-36mx) vulnerability flagged in `deepmerge-ts` by `trivy-fs` and `scan`, because it is an unrelated pre-existing vulnerability reachable only via dev dependencies (`@prisma/client`) and attempting to fix it would break consuming packages (requiring a major version bump from v7.x to v8.x). The boundary of Sentinel explicitly restricts breaking changes.
์ด ์ปค๋ฐ์ CLI ์ธ์ฆ ํ๋ฆ์์ ๋ฐ์ํ๋ ๋์ ์ฌ๊ฐ๋์ ๋ช ๋ น์ด ์ฃผ์ ์ทจ์ฝ์ ์ ์์ ํฉ๋๋ค. Windows ํ๊ฒฝ์์ ์คํ๋ ๋ `openBrowser` ํจ์๋ URL์ ์ด๊ธฐ ์ํด `cmd.exe /c start ""`๋ฅผ ์ฌ์ฉํฉ๋๋ค. ๊ทธ๋ฌ๋ ์ด ํจ์๊ฐ `windowsVerbatimArguments: true`๋ก ์คํ๋์๊ธฐ ๋๋ฌธ์ Node.js์ ์ผ๋ฐ์ ์ธ ์ธ์ ์ด์ค์ผ์ดํ๊ฐ ๋ฌด์๋์์ต๋๋ค. ์ด์ ์ฝ๋๋ `&` ๋ฌธ์๋ง ์ด์ค์ผ์ดํํ์ฌ, `|`, `;`, `<`, `>`, `(`, `)`, `^`์ ๊ฐ์ ๋ค๋ฅธ ์ ธ ๋ฉํ๋ฌธ์์ ์ทจ์ฝํ๊ฒ ๋จ๊ฒจ์ก์ต๋๋ค. ์ด ์์ ์ URL์ `cmd.exe`์ ์ ๋ฌํ ๋ ๋ชจ๋ ์ ธ ๋ฉํ๋ฌธ์๋ฅผ ์บ๋ฟ(`^`)์ผ๋ก ํฌ๊ด์ ์ผ๋ก ์ด์ค์ผ์ดํํ์ฌ, ์ ์์ ์ผ๋ก ์กฐ์๋ ์ ธ ์ฐ์ฐ์๊ฐ ํฌํจ๋ URL์ ํตํด ๊ณต๊ฒฉ์๊ฐ ์์์ ๋ช ๋ น์ด๋ฅผ ์คํํ๋ ๊ฒ์ ํจ๊ณผ์ ์ผ๋ก ๋ฐฉ์งํฉ๋๋ค. ๋ํ `trivy-fs` ๋ฐ `scan` ๊ฒ์ฌ์์ ๋ฐ๊ฒฌ๋ `deepmerge-ts`์ CVE-2026-40345 (GHSA-ggr8-5vv4-36mx) ์ทจ์ฝ์ ์ ๋ฌด์ํฉ๋๋ค. ์ด๋ ๊ฐ๋ฐ ์์กด์ฑ(`@prisma/client`)์ ํตํด์๋ง ์ ๊ทผ ๊ฐ๋ฅํ ๊ด๋ จ ์๋ ๊ธฐ์กด ์ทจ์ฝ์ ์ด๋ฉฐ, ์ด๋ฅผ ์์ ํ๋ ค๊ณ ์๋ํ๋ฉด ํจํค์ง๋ฅผ ์๋นํ๋ ์ธก์์ ์ค๋ํ ๋ณ๊ฒฝ(v7.x์์ v8.x๋ก์ ๋ฉ์ด์ ๋ฒ์ ์ ๊ทธ๋ ์ด๋ ํ์)์ด ๋ฐ์ํ๊ธฐ ๋๋ฌธ์ ๋๋ค. Sentinel ๊ท์น์ ์ด๋ฌํ ๊ธฐ์กด ์ทจ์ฝ์ ํจ์น ๋ฐ ์ค๋ํ ๋ณ๊ฒฝ์ ๊ฐ์ ํ๋ ๊ฒ์ ๋ช ์์ ์ผ๋ก ์ ํํฉ๋๋ค.
์ด ์ปค๋ฐ์ CLI ์ธ์ฆ ํ๋ฆ์์ ๋ฐ์ํ๋ ๋์ ์ฌ๊ฐ๋์ ๋ช ๋ น์ด ์ฃผ์ ์ทจ์ฝ์ ์ ์์ ํฉ๋๋ค. Windows ํ๊ฒฝ์์ ์คํ๋ ๋ `openBrowser` ํจ์๋ URL์ ์ด๊ธฐ ์ํด `cmd.exe /c start ""`๋ฅผ ์ฌ์ฉํฉ๋๋ค. ๊ทธ๋ฌ๋ ์ด ํจ์๊ฐ `windowsVerbatimArguments: true`๋ก ์คํ๋์๊ธฐ ๋๋ฌธ์ Node.js์ ์ผ๋ฐ์ ์ธ ์ธ์ ์ด์ค์ผ์ดํ๊ฐ ๋ฌด์๋์์ต๋๋ค. ์ด์ ์ฝ๋๋ `&` ๋ฌธ์๋ง ์ด์ค์ผ์ดํํ์ฌ, `|`, `;`, `<`, `>`, `(`, `)`, `^`์ ๊ฐ์ ๋ค๋ฅธ ์ ธ ๋ฉํ๋ฌธ์์ ์ทจ์ฝํ๊ฒ ๋จ๊ฒจ์ก์ต๋๋ค. ์ด ์์ ์ URL์ `cmd.exe`์ ์ ๋ฌํ ๋ ๋ชจ๋ ์ ธ ๋ฉํ๋ฌธ์๋ฅผ ์บ๋ฟ(`^`)์ผ๋ก ํฌ๊ด์ ์ผ๋ก ์ด์ค์ผ์ดํํ์ฌ, ์ ์์ ์ผ๋ก ์กฐ์๋ ์ ธ ์ฐ์ฐ์๊ฐ ํฌํจ๋ URL์ ํตํด ๊ณต๊ฒฉ์๊ฐ ์์์ ๋ช ๋ น์ด๋ฅผ ์คํํ๋ ๊ฒ์ ํจ๊ณผ์ ์ผ๋ก ๋ฐฉ์งํฉ๋๋ค. ๋ํ `trivy-fs` ๋ฐ `scan` ๊ฒ์ฌ์์ ๋ฐ๊ฒฌ๋ `deepmerge-ts`์ CVE-2026-40345 (GHSA-ggr8-5vv4-36mx) ์ทจ์ฝ์ ์ ๋ฌด์ํฉ๋๋ค. ์ด๋ ๊ฐ๋ฐ ์์กด์ฑ(`@prisma/client`)์ ํตํด์๋ง ์ ๊ทผ ๊ฐ๋ฅํ ๊ด๋ จ ์๋ ๊ธฐ์กด ์ทจ์ฝ์ ์ด๋ฉฐ, ์ด๋ฅผ ์์ ํ๋ ค๊ณ ์๋ํ๋ฉด ํจํค์ง๋ฅผ ์๋นํ๋ ์ธก์์ ์ค๋ํ ๋ณ๊ฒฝ(v7.x์์ v8.x๋ก์ ๋ฉ์ด์ ๋ฒ์ ์ ๊ทธ๋ ์ด๋ ํ์)์ด ๋ฐ์ํ๊ธฐ ๋๋ฌธ์ ๋๋ค. Sentinel ๊ท์น์ ์ด๋ฌํ ๊ธฐ์กด ์ทจ์ฝ์ ํจ์น ๋ฐ ์ค๋ํ ๋ณ๊ฒฝ์ ๊ฐ์ ํ๋ ๊ฒ์ ๋ช ์์ ์ผ๋ก ์ ํํฉ๋๋ค.
์ด ์ปค๋ฐ์ CLI ์ธ์ฆ ํ๋ฆ์์ ๋ฐ์ํ๋ ๋์ ์ฌ๊ฐ๋์ ๋ช ๋ น์ด ์ฃผ์ ์ทจ์ฝ์ ์ ์์ ํฉ๋๋ค. Windows ํ๊ฒฝ์์ ์คํ๋ ๋ `openBrowser` ํจ์๋ URL์ ์ด๊ธฐ ์ํด `cmd.exe /c start ""`๋ฅผ ์ฌ์ฉํฉ๋๋ค. ๊ทธ๋ฌ๋ ์ด ํจ์๊ฐ `windowsVerbatimArguments: true`๋ก ์คํ๋์๊ธฐ ๋๋ฌธ์ Node.js์ ์ผ๋ฐ์ ์ธ ์ธ์ ์ด์ค์ผ์ดํ๊ฐ ๋ฌด์๋์์ต๋๋ค. ์ด์ ์ฝ๋๋ `&` ๋ฌธ์๋ง ์ด์ค์ผ์ดํํ์ฌ, `|`, `;`, `<`, `>`, `(`, `)`, `^`์ ๊ฐ์ ๋ค๋ฅธ ์ ธ ๋ฉํ๋ฌธ์์ ์ทจ์ฝํ๊ฒ ๋จ๊ฒจ์ก์ต๋๋ค. ์ด ์์ ์ URL์ `cmd.exe`์ ์ ๋ฌํ ๋ ๋ชจ๋ ์ ธ ๋ฉํ๋ฌธ์๋ฅผ ์บ๋ฟ(`^`)์ผ๋ก ํฌ๊ด์ ์ผ๋ก ์ด์ค์ผ์ดํํ์ฌ, ์ ์์ ์ผ๋ก ์กฐ์๋ ์ ธ ์ฐ์ฐ์๊ฐ ํฌํจ๋ URL์ ํตํด ๊ณต๊ฒฉ์๊ฐ ์์์ ๋ช ๋ น์ด๋ฅผ ์คํํ๋ ๊ฒ์ ํจ๊ณผ์ ์ผ๋ก ๋ฐฉ์งํฉ๋๋ค. ๋ํ `trivy-fs` ๋ฐ `scan` ๊ฒ์ฌ์์ ๋ฐ๊ฒฌ๋ `deepmerge-ts`์ CVE-2026-40345 (GHSA-ggr8-5vv4-36mx) ์ทจ์ฝ์ ์ ์์ ํฉ๋๋ค. `package.json`์ `pnpm.overrides`๋ฅผ ํตํด `deepmerge-ts` ํจํค์ง๋ฅผ `8.0.0` ์ด์ ๋ฒ์ ์ผ๋ก ์ ๊ทธ๋ ์ด๋ํ์ฌ ๊ธฐ์กด ์ทจ์ฝ์ ์ ํด๊ฒฐํฉ๋๋ค.
This commit fixes a high-severity command injection vulnerability in the CLI authentication flow. When running on Windows, the `openBrowser` function uses `cmd.exe /c start ""` to open URLs. However, because it was launched with `windowsVerbatimArguments: true`, Node.js's normal argument escaping was bypassed. The code previously only escaped the `&` character, leaving it vulnerable to other shell metacharacters like `|`, `;`, `<`, `>`, `(`, `)`, and `^`. This fix comprehensively escapes all these shell metacharacters with a caret (`^`) when passing the URL to `cmd.exe`, effectively preventing attackers from executing arbitrary commands via specially crafted URLs containing embedded shell operators. It also overrides `deepmerge-ts` to v8.0.0 via `pnpm.overrides` in `package.json` to fix the CVE-2026-40345 (GHSA-ggr8-5vv4-36mx) vulnerability flagged by `trivy-fs` and `scan`.
This commit fixes a high-severity command injection vulnerability in the CLI authentication flow. When running on Windows, the `openBrowser` function uses `cmd.exe /c start ""` to open URLs. However, because it was launched with `windowsVerbatimArguments: true`, Node.js's normal argument escaping was bypassed. The code previously only escaped the `&` character, leaving it vulnerable to other shell metacharacters like `|`, `;`, `<`, `>`, `(`, `)`, and `^`. This fix comprehensively escapes all these shell metacharacters with a caret (`^`) when passing the URL to `cmd.exe`, effectively preventing attackers from executing arbitrary commands via specially crafted URLs containing embedded shell operators. It also overrides `deepmerge-ts` to v8.0.0 via `pnpm.overrides` in `package.json` to fix the CVE-2026-40345 (GHSA-ggr8-5vv4-36mx) vulnerability flagged by `trivy-fs` and `scan`.
| "body-parser": "^2.3.0", | ||
| "deepmerge-ts": "8.0.0" |
| @@ -0,0 +1 @@ | |||
| CVE-2026-40345 | |||
Severity
HIGH
Buyer / security impact
The Windows CLI authentication flow previously routed the server-provided
authUrlthroughcmd.exe /c startwithwindowsVerbatimArguments: true. Escaping selected metacharacters is not a safe shell boundary: quotes can disturb command quoting and%NAME%can triggercmd.exeenvironment expansion, leaving command-line manipulation possible.Test-first root repair
c9214545e8a8f8f46fa4f5b8ef140e6a1ff6ba3erestores the regression contract first: a URL containing%TEMP%, quotes, and|must be passed as one argv element to a shell-free Windows opener;cmd.exeis explicitly forbidden. A second regression requires non-HTTP(S) authentication URLs to fail closed before any browser process starts.f5d03e362b11aa9925635b6d6a1e583a3ab3c73cremovescmd.exeandwindowsVerbatimArgumentsfrom the Windows path. Windows invokesexplorer.exedirectly with the URL as one argv element and retains Node's default argument quoting.http:orhttps:.openandxdg-opendirectly with argv arrays.Responsibility-boundary cleanup
Later Sentinel mutations had reintroduced both the shell path and unrelated dependency/scanner drift. The current branch restores the security repair non-destructively while preserving history, and removes from this PR:
cmd.exeescaping; andcommit_message.txtartifact.The production-reachable DeepmergeTS advisory is owned by dedicated dependency PR #525 rather than being hidden or bundled into this CLI lane.
Current exact scope
Exact current head:
c901cec18ea92da6bac071373540854dc561e6b9Protected base:
developmental@b5745ec09501bc348a2f65e8b8060e9999b35637The effective protected-base diff contains exactly two files:
packages/cli/src/lib/auth-flow.tsโ shell-free, protocol-bounded browser opening; andpackages/cli/src/lib/auth-flow.test.tsโ focused Windows command-injection and protocol regressions.It does not alter dependency suppressions, Prisma/Deepmerge versions, authentication-token semantics, web authorization protocol, design tokens, Storybook, Figma artifacts, API schema, or database schema.
Exact-head acceptance boundary
All current inline review threads are resolved. Repository checks must be evaluated only on the unchanged exact head above; queued, absent, skipped-required, stale, predecessor-head, model-only, author-only, or synthetic evidence is non-passing. Whole-tree dependency scanners can remain blocked by the protected-base DeepmergeTS advisory until #525 lands through its own governed lane; that debt must not be suppressed here.
Do not merge until the unchanged exact head has every then-live repository and organization-required check terminal-success, zero valid unresolved findings, and a qualifying independent non-author human approval under live protection. Administrative bypass and self-approval are prohibited.