Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

fix(billing): reject backslash protocol-relative return paths

Tre Dubrava07d0d501c295
diff --git a/backend/src/ee/routes/v1/license-v2-router.ts b/backend/src/ee/routes/v1/license-v2-router.ts
index f421bbf71d..9d6d317a15 100644
--- a/backend/src/ee/routes/v1/license-v2-router.ts
+++ b/backend/src/ee/routes/v1/license-v2-router.ts
@@ -7,12 +7,15 @@ import { verifyAuth } from "@app/server/plugins/auth/verify-auth";
import { AuthMode } from "@app/services/auth/auth-type";
// The license server joins this onto its configured portal origin, so it must be a single-rooted
-// relative path. Reject protocol-relative ("//host") values that would escape the origin.
+// relative path. Reject protocol-relative ("//host", "/\\host") values that browsers can normalize
+// into a host override and use to redirect users off Infisical after the Stripe flow.
const ReturnPathSchema = z
.string()
.trim()
.startsWith("/")
- .refine((path) => !path.startsWith("//"), { message: "must be a relative path" })
+ .refine((path) => !path.startsWith("//") && !path.startsWith("/\\"), {
+ message: "must be a relative path"
+ })
.optional();
const BillingV2DimSchema = z.object({