Skip to content

Commit 3ec0301

Browse files
committed
docs: add security warnings to hosted.ts url query param functions
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.
1 parent a09d300 commit 3ec0301

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

packages/app/src/utils/hosted.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,11 @@ export function isHostedEnvironment(): boolean {
99

1010
/**
1111
* Checks if a ?url= query parameter was provided in the URL.
12-
* This indicates the user is trying to connect to a specific server.
12+
*
13+
* SECURITY WARNING: This function exists ONLY for display purposes (e.g., showing
14+
* "Could not connect to X" in welcome-screen.tsx). The ?url= parameter must NEVER
15+
* be used to determine actual server connections due to CVE-2026-22813 (XSS vulnerability).
16+
* Server URL is determined exclusively by app.tsx defaultServerUrl logic.
1317
*/
1418
export function hasUrlQueryParam(): boolean {
1519
if (typeof window === "undefined") return false
@@ -18,6 +22,11 @@ export function hasUrlQueryParam(): boolean {
1822

1923
/**
2024
* Gets the ?url= query parameter value if present.
25+
*
26+
* SECURITY WARNING: This function exists ONLY for display purposes (e.g., showing
27+
* error messages with the attempted URL). The returned value must NEVER be used
28+
* for actual server connections due to CVE-2026-22813 (XSS vulnerability).
29+
* Server URL is determined exclusively by app.tsx defaultServerUrl logic.
2130
*/
2231
export function getUrlQueryParam(): string | null {
2332
if (typeof window === "undefined") return null

0 commit comments

Comments
 (0)