fix(web): treat configured urls with uppercase schemes as secure - #8005
fix(web): treat configured urls with uppercase schemes as secure#8005Lucenx9 wants to merge 1 commit into
Conversation
resolveConfiguredPrimaryTarget classified VITE_WS_URL/VITE_HTTP_URL with case-sensitive startsWith checks while the URL parser accepts any scheme casing. A configured "WSS://host" was therefore swapped to plaintext http (and "HTTPS://host" to plaintext ws), silently downgrading TLS for the affected base URL. ox-alpha via opencode
|
@codex review |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review. 📝 WalkthroughWalkthroughThe target URL logic now normalizes configured schemes before detection. Tests cover uppercase ChangesSecure scheme normalization
Estimated code review effort: 2 (Simple) | ~10 minutes Merge Risk: ⚪ Minimal · up to This localized change prevents uppercase HTTPS/WSS configuration values from being downgraded to insecure derived URLs, with regression tests covering both cases. No actionable merge-blocking risk remains beyond normal checks and review. Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 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 |
|
Codex Review: Didn't find any major issues. You're on a roll. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
@coderabbitai review |
✅ Action performedReview finished.
|
ApprovabilityVerdict: Skipped Macroscope did not run approvability analysis for this PR. Macroscope could not determine whether this PR modifies its approvability configuration, so the PR was not approved automatically. A PR that may change the rules that govern approval is never approved automatically. |
Problem
resolveConfiguredPrimaryTargetclassifiesVITE_WS_URL/VITE_HTTP_URLwith case-sensitivestartsWith("wss:")/startsWith("https:")checks, while the URL parser folds any scheme casing (new URL("WSS://host")is valid). A configuredWSS://hosttherefore falls into the plaintext branch and the derived HTTP base URL becomeshttp://host— silently downgrading TLS for that deployment (same forHTTPS://host→ plainws://).Fix
Both raw-string scheme checks are case-folded before classification, so uppercase variants land in the secure branch like their lowercase equivalents.
Verification
bootstrap.test.ts(WSS://andHTTPS://configured URLs must resolve to https/wss targets); both fail against the old code and pass now.environments/primarysuite green,tsgo --noEmitclean.ox-alpha via opencode
Note
Fix
resolveConfiguredPrimaryTargetto treat uppercaseHTTPS/WSSschemes as secureWhen only one of
VITE_HTTP_URLorVITE_WS_URLis set, the other is derived from it. Previously, uppercase secure schemes likeHTTPS:orWSS:were not recognized as secure, causing the derived URL to downgrade tohttporws. The fix in target.ts normalizes the scheme viatoLowerCase()before the security check. Tests in bootstrap.test.ts cover uppercaseHTTPSandWSSenv values.Macroscope summarized 83fe887.
Note
Medium Risk
Touches how configured environment URLs are classified as TLS vs plaintext, which previously could silently downgrade derived http/ws bases. The change itself is a small, well-tested case-fold.
Overview
Stops a silent TLS downgrade when only one of
VITE_HTTP_URLorVITE_WS_URLis set with an uppercase scheme (HTTPS:///WSS://).resolveConfiguredPrimaryTargetnow case-folds the raw scheme before deciding whether to derivehttps/wssvshttp/ws. Regression tests cover both uppercase env values resolving to secure targets.Reviewed by Cursor Bugbot for commit 83fe887. Bugbot is set up for automated code reviews on this repo. Configure here.
Summary by CodeRabbit
HTTPSandWSSURL schemes.httpsandwsstargets instead of being downgraded.