fix: remove XSS vulnerability (CVE-2026-22813) and duplicate variant tooltip#294
fix: remove XSS vulnerability (CVE-2026-22813) and duplicate variant tooltip#294shuv1337 merged 2 commits intointegrationfrom
Conversation
- Remove ?url= query parameter from app.tsx (CVE-2026-22813, GHSA-c83v-7274-4vgp) Critical XSS vulnerability allowing command execution via malicious server URLs - Remove duplicate variant cycle tooltip from TUI prompt Upstream implemented their own version, causing duplicate tooltips - Document security fix in fork-features.json
| // NOTE: The ?url= query parameter was intentionally removed due to CVE-2026-22813 (GHSA-c83v-7274-4vgp) | ||
| // Allowing arbitrary server URLs via query params enables XSS attacks on localhost:4096 |
There was a problem hiding this comment.
CRITICAL: Incomplete security fix - ?url= parameter still accessible elsewhere
While this PR correctly removes the ?url= query parameter from defaultServerUrl, the security vulnerability is not fully addressed. The codebase still reads and displays this parameter in other locations:
Still vulnerable:
packages/app/src/utils/hosted.ts- FunctionsgetUrlQueryParam()andhasUrlQueryParam()still exist and read the?url=parameterpackages/app/src/components/welcome-screen.tsx(line 41) - CallsgetUrlQueryParam()and displays the value in the UI (line 108)
Why this matters:
- Although SolidJS escapes text interpolation by default (preventing HTML injection), the query parameter reading infrastructure remains in place
- Tests in
packages/app/test/hosted.test.tsstill validate this functionality, suggesting it's intentionally maintained - This creates confusion about whether
?url=is safe to use and leaves the door open for future re-introduction of the vulnerability
Recommendation:
Either:
- Complete removal (recommended): Remove
getUrlQueryParam()andhasUrlQueryParam()fromhosted.ts, remove their usage fromwelcome-screen.tsx, and delete the associated tests - Clear documentation: If the display-only usage is intentionally kept, add explicit comments explaining that this parameter must NEVER be used for server connections, only for display purposes
The current state creates a security risk through incomplete remediation.
Prompt To Fix With AI
This is a comment left during a code review.
Path: packages/app/src/app.tsx
Line: 42:43
Comment:
**CRITICAL: Incomplete security fix - `?url=` parameter still accessible elsewhere**
While this PR correctly removes the `?url=` query parameter from `defaultServerUrl`, the security vulnerability is not fully addressed. The codebase still reads and displays this parameter in other locations:
**Still vulnerable:**
1. `packages/app/src/utils/hosted.ts` - Functions `getUrlQueryParam()` and `hasUrlQueryParam()` still exist and read the `?url=` parameter
2. `packages/app/src/components/welcome-screen.tsx` (line 41) - Calls `getUrlQueryParam()` and displays the value in the UI (line 108)
**Why this matters:**
- Although SolidJS escapes text interpolation by default (preventing HTML injection), the query parameter reading infrastructure remains in place
- Tests in `packages/app/test/hosted.test.ts` still validate this functionality, suggesting it's intentionally maintained
- This creates confusion about whether `?url=` is safe to use and leaves the door open for future re-introduction of the vulnerability
**Recommendation:**
Either:
1. **Complete removal** (recommended): Remove `getUrlQueryParam()` and `hasUrlQueryParam()` from `hosted.ts`, remove their usage from `welcome-screen.tsx`, and delete the associated tests
2. **Clear documentation**: If the display-only usage is intentionally kept, add explicit comments explaining that this parameter must NEVER be used for server connections, only for display purposes
The current state creates a security risk through incomplete remediation.
How can I resolve this? If you propose a fix, please make it concise.Address Greptile review concern - add clear SECURITY WARNING comments to hasUrlQueryParam() and getUrlQueryParam() explaining they must NEVER be used for server connections (CVE-2026-22813). Functions are kept for display-only purposes in welcome-screen.tsx.
|
Addressed Greptile feedback in commit 3ec0301: Added clear SECURITY WARNING comments to both The functions are intentionally kept for display-only purposes in The warning comments explicitly state:
This documents the security boundary while preserving the helpful error messaging UX. |
Summary
?url=query parameter fromapp.tsxto fix CVE-2026-22813 (GHSA-c83v-7274-4vgp)fork-features.jsonto document the security fixSecurity Details
CVE-2026-22813 - Critical XSS vulnerability (CVSS 9.4)
The
?url=query parameter allowed malicious websites to:localhost:4096?url=http://attacker.example/pty/API endpointsUpstream fixed this in v1.1.10, but our fork had re-added the feature. This PR removes it.
Testing
Greptile Overview
Greptile Summary
This PR addresses a critical XSS vulnerability (CVE-2026-22813) and removes a duplicate UI element.
Security Fix Analysis
The PR removes the
?url=query parameter from thedefaultServerUrlfunction inapp.tsx, which previously allowed attackers to inject arbitrary server URLs. The attack vector was:localhost:4096?url=http://malicious.example/pty/APIWhat was fixed:
defaultServerUrlinapp.tsx(lines 42-44)fork-features.jsonCritical Issue Found:
The fix is incomplete. The
?url=query parameter infrastructure remains accessible through:packages/app/src/utils/hosted.tsfunctions (getUrlQueryParam(),hasUrlQueryParam())packages/app/src/components/welcome-screen.tsxstill calls and displays this valuepackages/app/test/hosted.test.tsvalidate this functionalityWhile the display usage is likely safe (SolidJS escapes text), this creates confusion and leaves the door open for future re-introduction of the vulnerability.
UI Fix
Successfully removes the duplicate "cycle variants" tooltip from the TUI prompt component. The conditional tooltip wrapped in
<Show when={hasVariants()}>is removed, while the main variants tooltip remains.Documentation
The
fork-features.jsonproperly documents this security fix with comprehensive details about the vulnerability, attack vector, and removal rationale.Confidence Score: 3/5
Important Files Changed
File Analysis
Sequence Diagram
sequenceDiagram participant Attacker participant User participant Browser participant ShuvCode UI participant LocalServer Note over Attacker,LocalServer: BEFORE FIX (CVE-2026-22813) Attacker->>User: Send link: localhost:4096?url=http://evil.com User->>Browser: Click link Browser->>ShuvCode UI: Load with ?url=http://evil.com ShuvCode UI->>ShuvCode UI: Read URLSearchParams("url") ShuvCode UI->>ShuvCode UI: Set serverUrl = http://evil.com ShuvCode UI->>Attacker: Connect to http://evil.com Attacker->>ShuvCode UI: Return malicious XSS payload ShuvCode UI->>LocalServer: Execute commands via /pty/ API Note over Attacker,LocalServer: AFTER FIX Attacker->>User: Send link: localhost:4096?url=http://evil.com User->>Browser: Click link Browser->>ShuvCode UI: Load with ?url=http://evil.com ShuvCode UI->>ShuvCode UI: SKIP query param (removed) ShuvCode UI->>ShuvCode UI: Use safe defaults only ShuvCode UI->>LocalServer: Connect to localhost:4096 Note over ShuvCode UI,LocalServer: Safe connection - no XSS possible