From b0b44f40a39ba8155c9257f16c4054f968ecf2e9 Mon Sep 17 00:00:00 2001 From: "Pablo F.G" Date: Tue, 21 Jul 2026 11:49:17 +0200 Subject: [PATCH] fix(ui): apply CodeRabbit feedback on cloud env migration - Evaluate isCloud() during sign-up validation instead of at module load, avoiding an island/bundle race; use Zod 4 error syntax - Scope Dockerfile env docs to the real integration legacy names, dropping the misleading NEXT_PUBLIC_* wildcard --- ui/Dockerfile | 4 ++-- ui/types/authFormSchema.ts | 11 ++++++----- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/ui/Dockerfile b/ui/Dockerfile index 4abfe1911a..932e889e91 100644 --- a/ui/Dockerfile +++ b/ui/Dockerfile @@ -81,8 +81,8 @@ ENV HOSTNAME="0.0.0.0" # - optional: UI_API_DOCS_URL # - optional: UI_CLOUD_ENABLED ("true" only in Prowler Cloud deployments) # - gated integrations (load only when *_ENABLED="true"; the value is then -# required or boot fails). Legacy names (NEXT_PUBLIC_*, POSTHOG_KEY/HOST) -# still activate without the flag: +# required or boot fails). Their legacy names (NEXT_PUBLIC_SENTRY_*, +# NEXT_PUBLIC_GOOGLE_TAG_MANAGER_ID, POSTHOG_KEY/HOST) still work: # UI_SENTRY_ENABLED + UI_SENTRY_DSN (+ optional UI_SENTRY_ENVIRONMENT) # UI_GOOGLE_TAG_MANAGER_ENABLED + UI_GOOGLE_TAG_MANAGER_ID # UI_POSTHOG_ENABLED + UI_POSTHOG_KEY + UI_POSTHOG_HOST (no consumer yet) diff --git a/ui/types/authFormSchema.ts b/ui/types/authFormSchema.ts index 83ee654188..1d2c1074f9 100644 --- a/ui/types/authFormSchema.ts +++ b/ui/types/authFormSchema.ts @@ -105,11 +105,12 @@ export const signUpSchema = baseAuthSchema }), company: z.string().optional(), invitationToken: z.string().optional(), - termsAndConditions: isCloud() - ? z.boolean().refine((value) => value === true, { - message: "You must accept the terms and conditions.", - }) - : z.boolean().optional(), + termsAndConditions: z + .boolean() + .optional() + .refine((value) => !isCloud() || value === true, { + error: "You must accept the terms and conditions.", + }), }) .refine( (data) => {