Skip to content

Open-source manufacturing ERP, MES and QMS. Quoting, MRP, inventory, shop floor, quality and lot/serial traceability on one Postgres schema, with a REST API and MCP server. Self-host or use Carbon Cloud.

feat(auth): replace Cloudflare Turnstile with Vercel BotID on login (#1719)

Brad Barbin6fcff5c45e2c
diff --git a/.claude/rules/authentication-system.md b/.claude/rules/authentication-system.md
index 0f3be3b0d8..7d5d2ca893 100644
--- a/.claude/rules/authentication-system.md
+++ b/.claude/rules/authentication-system.md
@@ -34,11 +34,26 @@ Export subpaths (`package.json`): `.` (`index.ts`), `./auth.server`, `./session.
## Login (`apps/erp/app/routes/_public+/login.tsx`)
Magic link is the primary flow. The action rate-limits by IP (Upstash via `@carbon/kv`,
-`RATE_LIMIT` env default **5 / hour**), optionally verifies a Cloudflare Turnstile token
-(Cloud edition), then:
+`RATE_LIMIT` env default **5 / hour**), runs Vercel BotID (`verifyBotId`), then:
- `DEV_BYPASS_EMAIL` match + active user → `signInWithBypassEmail` (local dev only).
- Existing active user → `sendMagicLink` (Supabase OTP email).
+
+**Bot protection (Vercel BotID).** `botIdEnabled` (`auth.server.ts`) is true only for
+the Cloud edition running ON Vercel (`IS_VERCEL`, from Vercel's own `VERCEL=1`, which
+SST/Docker/local never set; they set `VERCEL_ENV` by hand). Every login loader
+(erp, mes, academy, starter) returns it, and the page calls
+`useBotIdProtection("/login", botIdEnabled)` (`@carbon/react`). That hook runs
+`initBotId`, which patches `window.fetch` so a POST to `/login` or `/login.data` (React
+Router's action URL) carries the invisible challenge. The action calls
+`verifyBotId(ip, email)` → `checkBotId()`. Both sides read the one flag on purpose:
+off Vercel the challenge script (served through the `apps/*/vercel.json` rewrites) 404s
+and the patched fetch rejects, so the client must never init where the server cannot
+verify. A `checkBotId` THROW (e.g. the project's OIDC token is off) fails OPEN and logs.
+It is a platform misconfiguration, not a verdict, and failing closed would lock out every
+Cloud user. The rate limit and lockout still apply. Supabase Auth captcha (Attack Protection)
+must stay OFF: GoTrue only verifies hCaptcha/Turnstile tokens, and the magic-link call
+sends none.
- Unknown user (non-Enterprise) → `sendVerificationCode`, redirect to `/verify` (email
verification-code signup). Enterprise edition rejects unknown users.
@@ -382,7 +397,7 @@ ERP exposes an OAuth 2.0 AS for use as a remote Claude/MCP connector. Routes und
`SUPABASE_URL`, `SUPABASE_ANON_KEY`, `SUPABASE_SERVICE_ROLE_KEY`, `SUPABASE_JWT_SECRET`,
`SESSION_SECRET`, `SESSION_KEY` (`"auth"`), `SESSION_MAX_AGE`,
`REFRESH_ACCESS_TOKEN_THRESHOLD`, `DOMAIN`, `RATE_LIMIT`, `CarbonEdition`,
-`STRIPE_BYPASS_COMPANY_IDS`, Turnstile + OAuth-provider keys.
+`STRIPE_BYPASS_COMPANY_IDS`, `IS_VERCEL`, OAuth-provider keys.
## Gotchas
@@ -398,4 +413,4 @@ ERP exposes an OAuth 2.0 AS for use as a remote Claude/MCP connector. Routes und
- Service-role clients bypass RLS — only use behind `bypassRls` + employee role.
- API key `scopes: {}` denies, not grants. Don't assume empty = full access.
- Edition matters: Enterprise rejects unknown-user login; Cloud gates API keys by plan
- and enforces Turnstile.
+ and enforces BotID (on Vercel only).
diff --git a/.claude/rules/environment-configuration.md b/.claude/rules/environment-configuration.md
index 680331ef8f..8513d8c7e2 100644
--- a/.claude/rules/environment-configuration.md
+++ b/.claude/rules/environment-configuration.md
@@ -70,7 +70,8 @@ secret), `SUPABASE_JWT_SECRET` (optional), plus
**Auth / session** — `SESSION_SECRET` (required; also signs the short-lived,
single-use `carbon-oauth-state` cookie in `@carbon/auth/oauth-state.server`), `AUTH_PROVIDERS`
(`email,google,azure,passkey,sso`; gate via `isAuthProviderEnabled`),
-`CLOUDFLARE_TURNSTILE_SITE_KEY` / `_SECRET_KEY`, `RATE_LIMIT`.
+`RATE_LIMIT`. `IS_VERCEL` reads Vercel's own `VERCEL=1` and gates
+login BotID (see `authentication-system.md`).
`SAML_ENABLED` / `SAML_PRIVATE_KEY` are NOT `@carbon/env` vars — they live in
root `.env` and reach GoTrue via docker-compose substitution (`GOTRUE_SAML_*`).
Both `crbn up` and `crbn reload` preload `.env.local` then `.env` into
diff --git a/.claude/rules/sst-deployment-infrastructure.md b/.claude/rules/sst-deployment-infrastructure.md
index 3c21d12713..65373afffe 100644
--- a/.claude/rules/sst-deployment-infrastructure.md
+++ b/.claude/rules/sst-deployment-infrastructure.md
@@ -125,7 +125,7 @@ Both services get Supabase (`SUPABASE_URL`/`ANON_KEY`/`SERVICE_ROLE_KEY`/`JWT_SE
`POSTHOG_*`, `CARBON_EDITION`, `CONTROLLED_ENVIRONMENT`, `DOMAIN`, `ERP_URL`/`MES_URL`,
`NODE_ENV=production`, `VERCEL_ENV=production`, `VERCEL_URL` (set to the app host —
there is no real Vercel deploy, this is just an env shim). ERP additionally gets
-`OPENAI_API_KEY`, `GOOGLE_PLACES_API_KEY`, `CLOUDFLARE_TURNSTILE_*`, `STRIPE_*`,
+`OPENAI_API_KEY`, `GOOGLE_PLACES_API_KEY`, `STRIPE_*`,
`SLACK_*`, `JIRA_*`, `QUICKBOOKS_*`, `XERO_*`, `ONSHAPE_*`, `RAMP_CLIENT_ID`,
`RAMP_CLIENT_SECRET`, `AUTH_PROVIDERS`; MES is
the leaner subset (no Stripe/Slack/Jira/QuickBooks/Xero/OpenAI). Autodesk vars are
diff --git a/.env.example b/.env.example
index 9724715f34..e874df522e 100644
--- a/.env.example
+++ b/.env.example
@@ -47,14 +47,6 @@ SMTP_FROM="Carbon <[email protected]>"
# INNGEST_SIGNING_KEY="signkey-****-********************"
# INNGEST_EVENT_KEY="********************"
-# Cloudflare
-CLOUDFLARE_TURNSTILE_SITE_KEY="1x00000000000000000000AA"
-CLOUDFLARE_TURNSTILE_SECRET_KEY="********************"
-# Set to true once Supabase Auth captcha (Attack Protection -> Turnstile) is
-# enabled for the project — login actions then forward the Turnstile token to
-# GoTrue on the magic-link call instead of verifying it in-app.
-# SUPABASE_AUTH_CAPTCHA_ENABLED="false"
-
# Slack
SLACK_BOT_TOKEN="***********************"
diff --git a/apps/academy/app/routes/_auth+/login.tsx b/apps/academy/app/routes/_auth+/login.tsx
index 9390f647b7..d61f742929 100644
--- a/apps/academy/app/routes/_auth+/login.tsx
+++ b/apps/academy/app/routes/_auth+/login.tsx
@@ -8,11 +8,11 @@ import {
SUPABASE_AUTH_EXTERNAL_GOOGLE_CLIENT_ID
} from "@carbon/auth";
import {
+ botIdEnabled,
getMagicLinkErrorMessage,
sendMagicLink,
- turnstileSiteKey,
verifyAuthSession,
- verifyLoginCaptcha
+ verifyBotId
} from "@carbon/auth/auth.server";
import { flash, getAuthSession } from "@carbon/auth/session.server";
import { getUserByEmail } from "@carbon/auth/users.server";
@@ -25,11 +25,10 @@ import {
Button,
Heading,
Separator,
- TurnstileChallenge,
toast,
+ useBotIdProtection,
VStack
} from "@carbon/react";
-import { useState } from "react";
import { LuCircleAlert } from "react-icons/lu";
import type {
ActionFunctionArgs,
@@ -59,7 +58,7 @@ export async function loader({ request }: LoaderFunctionArgs) {
return {
hasOutlookAuth: !!SUPABASE_AUTH_EXTERNAL_AZURE_CLIENT_ID,
hasGoogleAuth: !!SUPABASE_AUTH_EXTERNAL_GOOGLE_CLIENT_ID,
- turnstileSiteKey
+ botIdEnabled
};
}
@@ -88,20 +87,20 @@ export async function action({ request }: ActionFunctionArgs) {
return error(validation.error, "Invalid email address");
}
- const { email, turnstileToken } = validation.data;
+ const { email } = validation.data;
- const captchaError = await verifyLoginCaptcha(turnstileToken, ip);
- if (captchaError) {
+ const botError = await verifyBotId(ip, email);
+ if (botError) {
return data(
- error(null, captchaError),
- await flash(request, error(null, captchaError))
+ error(null, botError),
+ await flash(request, error(null, botError))
);
}
const user = await getUserByEmail(email);
if (user.data && user.data.active) {
- const magicLink = await sendMagicLink(email, turnstileToken);
+ const magicLink = await sendMagicLink(email);
if (magicLink.error) {
const message = getMagicLinkErrorMessage(magicLink.error);
@@ -121,18 +120,15 @@ export async function action({ request }: ActionFunctionArgs) {
}
export default function LoginRoute() {
- const {
- hasOutlookAuth,
- hasGoogleAuth,
- turnstileSiteKey: siteKey
- } = useLoaderData<typeof loader>();
+ const { hasOutlookAuth, hasGoogleAuth, botIdEnabled } =
+ useLoaderData<typeof loader>();
+ useBotIdProtection("/login", botIdEnabled);
const [searchParams] = useSearchParams();
const redirectTo = searchParams.get("redirectTo") ?? undefined;
const fetcher = useFetcher<
{ success: true } | { success: false; message: string }
>();
- const [turnstileToken, setTurnstileToken] = useState<string>("");
const onSignInWithGoogle = async () => {
const { error } = await carbonClient.auth.signInWithOAuth({
@@ -188,7 +184,6 @@ export default function LoginRoute() {
method="post"
>
<Hidden name="redirectTo" value={redirectTo} type="hidden" />
- <Hidden name="turnstileToken" value={turnstileToken} />
<VStack spacing={2}>
{fetcher.data?.success === false && fetcher.data?.message && (
<Alert variant="destructive">
@@ -234,9 +229,7 @@ export default function LoginRoute() {
<Input name="email" label="" placeholder="Email Address" />
<Submit
- isDisabled={
- fetcher.state !== "idle" || (!!siteKey && !turnstileToken)
- }
+ isDisabled={fetcher.state !== "idle"}
isLoading={fetcher.state === "submitting"}
size="lg"
className="w-full"
@@ -245,10 +238,6 @@ export default function LoginRoute() {
>
Sign in with Email
</Submit>
- <TurnstileChallenge
- siteKey={siteKey ?? undefined}
- onToken={setTurnstileToken}
- />
</VStack>
</ValidatedForm>
)}
diff --git a/apps/academy/vercel.json b/apps/academy/vercel.json
new file mode 100644
index 0000000000..f93f49f0e2
--- /dev/null
+++ b/apps/academy/vercel.json
@@ -0,0 +1,19 @@
+{
+ "$schema": "https://openapi.vercel.sh/vercel.json",
+ "rewrites": [
+ {
+ "source": "/149e9513-01fa-4fb0-aad4-566afd725d1b/2d206a39-8ed7-437e-a3be-862e0f06eea3/a-4-a/c.js",
+ "destination": "https://api.vercel.com/bot-protection/v1/challenge"
+ },
+ {
+ "source": "/149e9513-01fa-4fb0-aad4-566afd725d1b/2d206a39-8ed7-437e-a3be-862e0f06eea3/:path*",
+ "destination": "https://api.vercel.com/bot-protection/v1/proxy/:path*"
+ }
+ ],
+ "headers": [
+ {
+ "source": "/149e9513-01fa-4fb0-aad4-566afd725d1b/2d206a39-8ed7-437e-a3be-862e0f06eea3/:path*",
+ "headers": [{ "key": "X-Frame-Options", "value": "SAMEORIGIN" }]
+ }
+ ]
+}
diff --git a/apps/erp/app/modules/agent/kb/docs/platform/self-hosting/environment-variables.md b/apps/erp/app/modules/agent/kb/docs/platform/self-hosting/environment-variables.md
index 2f27d616c7..470dd1fb9b 100644
--- a/apps/erp/app/modules/agent/kb/docs/platform/self-hosting/environment-variables.md
+++ b/apps/erp/app/modules/agent/kb/docs/platform/self-hosting/environment-variables.md
@@ -44,8 +44,9 @@ Enterprise `docs/reference/single-sign-on` adds two more:
Turns on the SAML engine in the auth service.
SAML signing key — base64-encoded PKCS#1 DER RSA, minimum 2048-bit; the generation command is in `.env.example`.
-Sign-in bot protection uses Cloudflare Turnstile: `CLOUDFLARE_TURNSTILE_SITE_KEY` and
-`CLOUDFLARE_TURNSTILE_SECRET_KEY`.
+Carbon Cloud protects sign-in with Vercel BotID. It runs only on a Vercel deployment of
+the Cloud edition and needs no environment variables, so a self-hosted instance has no
+bot check on sign-in. The per-IP rate limit and per-account lockout still apply.
## Jobs & cache
diff --git a/apps/erp/app/root.tsx b/apps/erp/app/root.tsx
index e768ac0310..bead39a6f4 100644
--- a/apps/erp/app/root.tsx
+++ b/apps/erp/app/root.tsx
@@ -95,7 +95,6 @@ export async function loader({ request, context }: LoaderFunctionArgs) {
CARBON_EDITION,
CARBON_API_URL,
CARBON_SLACK_ENABLED,
- CLOUDFLARE_TURNSTILE_SITE_KEY,
CONTROLLED_ENVIRONMENT,
ERP_URL,
GOOGLE_PLACES_API_KEY,
@@ -128,7 +127,6 @@ export async function loader({ request, context }: LoaderFunctionArgs) {
CARBON_API_URL,
CARBON_EDITION,
CARBON_SLACK_ENABLED,
- CLOUDFLARE_TURNSTILE_SITE_KEY,
CONTROLLED_ENVIRONMENT,
DEFAULT_LANGUAGE,
ERP_URL,
diff --git a/apps/erp/app/routes/_public+/login.tsx b/apps/erp/app/routes/_public+/login.tsx
index 83593372a4..0c0c9a9a98 100644
--- a/apps/erp/app/routes/_public+/login.tsx
+++ b/apps/erp/app/routes/_public+/login.tsx
@@ -9,13 +9,13 @@ import {
RATE_LIMIT
} from "@carbon/auth";
import {
+ botIdEnabled,
getMagicLinkErrorMessage,
logAuthEvent,
sendMagicLink,
signInWithBypassEmail,
- turnstileSiteKey,
verifyAuthSession,
- verifyLoginCaptcha
+ verifyBotId
} from "@carbon/auth/auth.server";
import { getCarbonServiceRole } from "@carbon/auth/client.server";
import {
@@ -43,8 +43,8 @@ import {
Heading,
ItarLoginDisclaimer,
Separator,
- TurnstileChallenge,
toast,
+ useBotIdProtection,
useMount,
VStack
} from "@carbon/react";
@@ -93,7 +93,7 @@ export async function loader({ request }: LoaderFunctionArgs) {
hasGoogleAuth,
hasPasskeyAuth,
hasSsoAuth,
- turnstileSiteKey
+ botIdEnabled
},
{ headers: cookieHeaders }
);
@@ -104,7 +104,7 @@ export async function loader({ request }: LoaderFunctionArgs) {
hasGoogleAuth,
hasPasskeyAuth,
hasSsoAuth,
- turnstileSiteKey
+ botIdEnabled
};
}
@@ -134,7 +134,7 @@ export async function action({ request }: ActionFunctionArgs) {
return error(validation.error, "Invalid email address");
}
- const { email, turnstileToken } = validation.data;
+ const { email } = validation.data;
// Per-account lockout (NIST 800-171 3.1.8) — layered ON TOP of the IP limit
// above. Keyed by the normalized email so an attacker rotating IPs, or
@@ -159,11 +159,11 @@ export async function action({ request }: ActionFunctionArgs) {
);
}
- const captchaError = await verifyLoginCaptcha(turnstileToken, ip);
- if (captchaError) {
+ const botError = await verifyBotId(ip, email);
+ if (botError) {
return data(
- error(null, captchaError),
- await flash(request, error(null, captchaError))
+ error(null, botError),
+ await flash(request, error(null, botError))
);
}
@@ -223,7 +223,7 @@ export async function action({ request }: ActionFunctionArgs) {
}
if (user.data && user.data.active) {
- const magicLink = await sendMagicLink(email, turnstileToken);
+ const magicLink = await sendMagicLink(email);
if (magicLink.error) {
logAuthEvent("login_failed", {
@@ -273,19 +273,6 @@ export async function action({ request }: ActionFunctionArgs) {
await flash(request, error(null, SELF_SIGNUP_BLOCKED_MESSAGE))
);
} else {
- // Signup verification codes go out via Resend, never GoTrue.
- const signupCaptchaError = await verifyLoginCaptcha(
- turnstileToken,
- ip,
- "app"
- );
- if (signupCaptchaError) {
- return data(
- error(null, signupCaptchaError),
- await flash(request, error(null, signupCaptchaError))
- );
- }
-
// User doesn't exist, send verification code for signup
const verificationSent = await sendVerificationCode(email);
@@ -307,15 +294,15 @@ export default function LoginRoute() {
hasGoogleAuth,
hasPasskeyAuth,
hasSsoAuth,
- turnstileSiteKey: siteKey
+ botIdEnabled
} = useLoaderData<typeof loader>();
+ useBotIdProtection("/login", botIdEnabled);
const [searchParams] = useSearchParams();
const redirectTo = searchParams.get("redirectTo") ?? undefined;
const emailParam = searchParams.get("email") ?? undefined;
const [mode, setMode] = useState<"login" | "signup" | "verify">("login");
const [signupEmail, setSignupEmail] = useState<string>("");
- const [turnstileToken, setTurnstileToken] = useState<string>("");
const [passkeySupported, setPasskeySupported] = useState(false);
const [passkeyLoading, setPasskeyLoading] = useState(false);
const [ssoLoading, setSsoLoading] = useState(false);
@@ -619,7 +606,6 @@ export default function LoginRoute() {
onSubmit={onSubmitEmail}
>
<Hidden name="redirectTo" value={redirectTo} type="hidden" />
- <Hidden name="turnstileToken" value={turnstileToken} />
<VStack spacing={2}>
{((fetcher.data?.success === false && fetcher.data?.message) ||
ssoError) && (
@@ -691,11 +677,7 @@ export default function LoginRoute() {
/>
<Submit
- isDisabled={
- fetcher.state !== "idle" ||
- ssoLoading ||
- (!!siteKey && !turnstileToken)
- }
+ isDisabled={fetcher.state !== "idle" || ssoLoading}
isLoading={fetcher.state === "submitting" || ssoLoading}
hideShortcutKey
size="lg"
@@ -705,10 +687,6 @@ export default function LoginRoute() {
>
<Trans>Continue</Trans>
</Submit>
- <TurnstileChallenge
- siteKey={siteKey ?? undefined}
- onToken={setTurnstileToken}
- />
</VStack>
</ValidatedForm>
)}
diff --git a/apps/erp/vercel.json b/apps/erp/vercel.json
new file mode 100644
index 0000000000..f93f49f0e2
--- /dev/null
+++ b/apps/erp/vercel.json
@@ -0,0 +1,19 @@
+{
+ "$schema": "https://openapi.vercel.sh/vercel.json",
+ "rewrites": [
+ {
+ "source": "/149e9513-01fa-4fb0-aad4-566afd725d1b/2d206a39-8ed7-437e-a3be-862e0f06eea3/a-4-a/c.js",
+ "destination": "https://api.vercel.com/bot-protection/v1/challenge"
+ },
+ {
+ "source": "/149e9513-01fa-4fb0-aad4-566afd725d1b/2d206a39-8ed7-437e-a3be-862e0f06eea3/:path*",
+ "destination": "https://api.vercel.com/bot-protection/v1/proxy/:path*"
+ }
+ ],
+ "headers": [
+ {
+ "source": "/149e9513-01fa-4fb0-aad4-566afd725d1b/2d206a39-8ed7-437e-a3be-862e0f06eea3/:path*",
+ "headers": [{ "key": "X-Frame-Options", "value": "SAMEORIGIN" }]
+ }
+ ]
+}
diff --git a/apps/mes/app/routes/_public+/login.tsx b/apps/mes/app/routes/_public+/login.tsx
index 60a752641d..ac40e8e53a 100644
--- a/apps/mes/app/routes/_public+/login.tsx
+++ b/apps/mes/app/routes/_public+/login.tsx
@@ -10,13 +10,13 @@ import {
RATE_LIMIT
} from "@carbon/auth";
import {
+ botIdEnabled,
getMagicLinkErrorMessage,
logAuthEvent,
sendMagicLink,
signInWithBypassEmail,
- turnstileSiteKey,
verifyAuthSession,
- verifyLoginCaptcha
+ verifyBotId
} from "@carbon/auth/auth.server";
import { getCarbonServiceRole } from "@carbon/auth/client.server";
import {
@@ -37,8 +37,8 @@ import {
Heading,
ItarLoginDisclaimer,
Separator,
- TurnstileChallenge,
toast,
+ useBotIdProtection,
useMount,
VStack
} from "@carbon/react";
@@ -87,7 +87,7 @@ export async function loader({ request }: LoaderFunctionArgs) {
hasGoogleAuth,
hasPasskeyAuth,
hasSsoAuth,
- turnstileSiteKey
+ botIdEnabled
},
{ headers: cookieHeaders }
);
@@ -98,7 +98,7 @@ export async function loader({ request }: LoaderFunctionArgs) {
hasGoogleAuth,
hasPasskeyAuth,
hasSsoAuth,
- turnstileSiteKey
+ botIdEnabled
};
}
@@ -127,13 +127,13 @@ export async function action({ request }: ActionFunctionArgs) {
return error(validation.error, "Invalid email address");
}
- const { email, turnstileToken } = validation.data;
+ const { email } = validation.data;
- const captchaError = await verifyLoginCaptcha(turnstileToken, ip);
- if (captchaError) {
+ const botError = await verifyBotId(ip, email);
+ if (botError) {
return data(
- error(null, captchaError),
- await flash(request, error(null, captchaError))
+ error(null, botError),
+ await flash(request, error(null, botError))
);
}
@@ -209,7 +209,7 @@ export async function action({ request }: ActionFunctionArgs) {
}
if (user.data && user.data.active) {
- const magicLink = await sendMagicLink(email, turnstileToken, getMESUrl());
+ const magicLink = await sendMagicLink(email, getMESUrl());
if (magicLink.error) {
logAuthEvent("login_failed", {
@@ -241,8 +241,9 @@ export default function LoginRoute() {
hasGoogleAuth,
hasPasskeyAuth,
hasSsoAuth,
- turnstileSiteKey: siteKey
+ botIdEnabled
} = useLoaderData<typeof loader>();
+ useBotIdProtection("/login", botIdEnabled);
const [searchParams] = useSearchParams();
const redirectTo = searchParams.get("redirectTo") ?? undefined;
@@ -252,7 +253,6 @@ export default function LoginRoute() {
{ success: true } | { success: false; message: string }
>();
- const [turnstileToken, setTurnstileToken] = useState<string>("");
const [passkeySupported, setPasskeySupported] = useState(false);
const [passkeyLoading, setPasskeyLoading] = useState(false);
const [ssoLoading, setSsoLoading] = useState(false);
@@ -497,7 +497,6 @@ export default function LoginRoute() {
onSubmit={onSubmitEmail}
>
<Hidden name="redirectTo" value={redirectTo} type="hidden" />
- <Hidden name="turnstileToken" value={turnstileToken} />
<VStack spacing={2}>
{((fetcher.data?.success === false && fetcher.data?.message) ||
ssoError) && (
@@ -572,11 +571,7 @@ export default function LoginRoute() {
/>
<Submit
- isDisabled={
- fetcher.state !== "idle" ||
- ssoLoading ||
- (!!siteKey && !turnstileToken)
- }
+ isDisabled={fetcher.state !== "idle" || ssoLoading}
isLoading={fetcher.state === "submitting" || ssoLoading}
hideShortcutKey
size="lg"
@@ -586,10 +581,6 @@ export default function LoginRoute() {
>
<Trans>Continue</Trans>
</Submit>
- <TurnstileChallenge
- siteKey={siteKey ?? undefined}
- onToken={setTurnstileToken}
- />
</VStack>
</ValidatedForm>
)}
diff --git a/apps/mes/vercel.json b/apps/mes/vercel.json
new file mode 100644
index 0000000000..f93f49f0e2
--- /dev/null
+++ b/apps/mes/vercel.json
@@ -0,0 +1,19 @@
+{
+ "$schema": "https://openapi.vercel.sh/vercel.json",
+ "rewrites": [
+ {
+ "source": "/149e9513-01fa-4fb0-aad4-566afd725d1b/2d206a39-8ed7-437e-a3be-862e0f06eea3/a-4-a/c.js",
+ "destination": "https://api.vercel.com/bot-protection/v1/challenge"
+ },
+ {
+ "source": "/149e9513-01fa-4fb0-aad4-566afd725d1b/2d206a39-8ed7-437e-a3be-862e0f06eea3/:path*",
+ "destination": "https://api.vercel.com/bot-protection/v1/proxy/:path*"
+ }
+ ],
+ "headers": [
+ {
+ "source": "/149e9513-01fa-4fb0-aad4-566afd725d1b/2d206a39-8ed7-437e-a3be-862e0f06eea3/:path*",
+ "headers": [{ "key": "X-Frame-Options", "value": "SAMEORIGIN" }]
+ }
+ ]
+}
diff --git a/apps/starter/app/routes/_public+/login.tsx b/apps/starter/app/routes/_public+/login.tsx
index 22553a8425..1cbd12b1cf 100644
--- a/apps/starter/app/routes/_public+/login.tsx
+++ b/apps/starter/app/routes/_public+/login.tsx
@@ -8,11 +8,11 @@ import {
SUPABASE_AUTH_EXTERNAL_GOOGLE_CLIENT_ID
} from "@carbon/auth";
import {
+ botIdEnabled,
getMagicLinkErrorMessage,
sendMagicLink,
- turnstileSiteKey,
verifyAuthSession,
- verifyLoginCaptcha
+ verifyBotId
} from "@carbon/auth/auth.server";
import { flash, getAuthSession } from "@carbon/auth/session.server";
import { getUserByEmail } from "@carbon/auth/users.server";
@@ -25,11 +25,10 @@ import {
Button,
Heading,
Separator,
- TurnstileChallenge,
toast,
+ useBotIdProtection,
VStack
} from "@carbon/react";
-import { useState } from "react";
import { LuCircleAlert } from "react-icons/lu";
import type {
ActionFunctionArgs,
@@ -59,7 +58,7 @@ export async function loader({ request }: LoaderFunctionArgs) {
return {
hasOutlookAuth: !!SUPABASE_AUTH_EXTERNAL_AZURE_CLIENT_ID,
hasGoogleAuth: !!SUPABASE_AUTH_EXTERNAL_GOOGLE_CLIENT_ID,
- turnstileSiteKey
+ botIdEnabled
};
}
@@ -88,20 +87,20 @@ export async function action({ request }: ActionFunctionArgs) {
return error(validation.error, "Invalid email address");
}
- const { email, turnstileToken } = validation.data;
+ const { email } = validation.data;
- const captchaError = await verifyLoginCaptcha(turnstileToken, ip);
- if (captchaError) {
+ const botError = await verifyBotId(ip, email);
+ if (botError) {
return data(
- error(null, captchaError),
- await flash(request, error(null, captchaError))
+ error(null, botError),
+ await flash(request, error(null, botError))
);
}
const user = await getUserByEmail(email);
if (user.data && user.data.active) {
- const magicLink = await sendMagicLink(email, turnstileToken);
+ const magicLink = await sendMagicLink(email);
if (magicLink.error) {
const message = getMagicLinkErrorMessage(magicLink.error);
@@ -121,18 +120,15 @@ export async function action({ request }: ActionFunctionArgs) {
}
export default function LoginRoute() {
- const {
- hasOutlookAuth,
- hasGoogleAuth,
- turnstileSiteKey: siteKey
- } = useLoaderData<typeof loader>();
+ const { hasOutlookAuth, hasGoogleAuth, botIdEnabled } =
+ useLoaderData<typeof loader>();
+ useBotIdProtection("/login", botIdEnabled);
const [searchParams] = useSearchParams();
const redirectTo = searchParams.get("redirectTo") ?? undefined;
const fetcher = useFetcher<
{ success: true } | { success: false; message: string }
>();
- const [turnstileToken, setTurnstileToken] = useState<string>("");
const onSignInWithGoogle = async () => {
const { error } = await carbonClient.auth.signInWithOAuth({
@@ -197,7 +193,6 @@ export default function LoginRoute() {
method="post"
>
<Hidden name="redirectTo" value={redirectTo} type="hidden" />
- <Hidden name="turnstileToken" value={turnstileToken} />
<VStack spacing={2}>
{fetcher.data?.success === false && fetcher.data?.message && (
<Alert variant="destructive">
@@ -243,9 +238,7 @@ export default function LoginRoute() {
<Input name="email" label="" placeholder="Email Address" />
<Submit
- isDisabled={
- fetcher.state !== "idle" || (!!siteKey && !turnstileToken)
- }
+ isDisabled={fetcher.state !== "idle"}
isLoading={fetcher.state === "submitting"}
size="lg"
className="w-full"
@@ -254,10 +247,6 @@ export default function LoginRoute() {
>
Sign in with Email
</Submit>
- <TurnstileChallenge
- siteKey={siteKey ?? undefined}
- onToken={setTurnstileToken}
- />
</VStack>
</ValidatedForm>
)}
diff --git a/apps/starter/vercel.json b/apps/starter/vercel.json
new file mode 100644
index 0000000000..f93f49f0e2
--- /dev/null
+++ b/apps/starter/vercel.json
@@ -0,0 +1,19 @@
+{
+ "$schema": "https://openapi.vercel.sh/vercel.json",
+ "rewrites": [
+ {
+ "source": "/149e9513-01fa-4fb0-aad4-566afd725d1b/2d206a39-8ed7-437e-a3be-862e0f06eea3/a-4-a/c.js",
+ "destination": "https://api.vercel.com/bot-protection/v1/challenge"
+ },
+ {
+ "source": "/149e9513-01fa-4fb0-aad4-566afd725d1b/2d206a39-8ed7-437e-a3be-862e0f06eea3/:path*",
+ "destination": "https://api.vercel.com/bot-protection/v1/proxy/:path*"
+ }
+ ],
+ "headers": [
+ {
+ "source": "/149e9513-01fa-4fb0-aad4-566afd725d1b/2d206a39-8ed7-437e-a3be-862e0f06eea3/:path*",
+ "headers": [{ "key": "X-Frame-Options", "value": "SAMEORIGIN" }]
+ }
+ ]
+}
diff --git a/ci/src/deploy.ts b/ci/src/deploy.ts
index 21b60e45c1..ccd761f0dc 100644
--- a/ci/src/deploy.ts
+++ b/ci/src/deploy.ts
@@ -40,8 +40,6 @@ export type Workspace = {
// App Configuration
auth_providers: string | null;
carbon_edition: string | null;
- cloudflare_turnstile_secret_key: string | null;
- cloudflare_turnstile_site_key: string | null;
controlled_environment: string | null;
exchange_rates_api_key: string | null;
google_places_api_key: string | null;
@@ -122,8 +120,6 @@ async function deploy(): Promise<void> {
carbon_edition,
cert_arn_erp,
cert_arn_mes,
- cloudflare_turnstile_secret_key,
- cloudflare_turnstile_site_key,
controlled_environment,
database_connection_pooler_url,
database_password,
@@ -288,10 +284,6 @@ async function deploy(): Promise<void> {
CARBON_EDITION: carbon_edition ?? "enterprise",
CERT_ARN_ERP: cert_arn_erp,
CERT_ARN_MES: cert_arn_mes,
- CLOUDFLARE_TURNSTILE_SECRET_KEY:
- cloudflare_turnstile_secret_key ?? undefined,
- CLOUDFLARE_TURNSTILE_SITE_KEY:
- cloudflare_turnstile_site_key ?? undefined,
CONTROLLED_ENVIRONMENT: controlled_environment ?? undefined,
DOMAIN: domain_name,
EXCHANGE_RATES_API_KEY: exchange_rates_api_key ?? undefined,
diff --git a/docs/content/docs/platform/self-hosting/environment-variables.mdx b/docs/content/docs/platform/self-hosting/environment-variables.mdx
index 843812a5a7..ef7842d7c8 100644
--- a/docs/content/docs/platform/self-hosting/environment-variables.mdx
+++ b/docs/content/docs/platform/self-hosting/environment-variables.mdx
@@ -53,8 +53,9 @@ Enterprise [SAML single sign-on](/docs/reference/single-sign-on) adds two more:
<EnvVar name="SAML_PRIVATE_KEY" type="string">SAML signing key — base64-encoded PKCS#1 DER RSA, minimum 2048-bit; the generation command is in `.env.example`.</EnvVar>
</EnvVars>
-Sign-in bot protection uses Cloudflare Turnstile: `CLOUDFLARE_TURNSTILE_SITE_KEY` and
-`CLOUDFLARE_TURNSTILE_SECRET_KEY`.
+Carbon Cloud protects sign-in with Vercel BotID. It runs only on a Vercel deployment of
+the Cloud edition and needs no environment variables, so a self-hosted instance has no
+bot check on sign-in. The per-IP rate limit and per-account lockout still apply.
## Jobs & cache
diff --git a/packages/auth/package.json b/packages/auth/package.json
index f2e840fc93..f8683a1b5e 100644
--- a/packages/auth/package.json
+++ b/packages/auth/package.json
@@ -60,6 +60,7 @@
"@carbon/logger": "workspace:*",
"@react-email/components": "catalog:",
"@simplewebauthn/server": "^13.1.0",
+ "botid": "catalog:",
"cookie": "catalog:",
"dompurify": "catalog:",
"jose": "catalog:",
diff --git a/packages/auth/src/services/auth.server.ts b/packages/auth/src/services/auth.server.ts
index b6088309dc..1c042cc27a 100644
--- a/packages/auth/src/services/auth.server.ts
+++ b/packages/auth/src/services/auth.server.ts
@@ -11,18 +11,17 @@ import type {
AuthSession as SupabaseAuthSession,
SupabaseClient
} from "@supabase/supabase-js";
+import { checkBotId } from "botid/server";
import { createHash } from "crypto";
import { redirect } from "react-router";
import {
CarbonEdition,
- CLOUDFLARE_TURNSTILE_SECRET_KEY,
- CLOUDFLARE_TURNSTILE_SITE_KEY,
CONTROLLED_ENVIRONMENT,
IS_LOCAL_DEV,
+ IS_VERCEL,
REFRESH_ACCESS_TOKEN_THRESHOLD,
SESSION_IDLE_LOCK_MS,
STRIPE_BYPASS_COMPANY_IDS,
- SUPABASE_AUTH_CAPTCHA_ENABLED,
VERCEL_URL
} from "../config/env";
import { getCarbon } from "../lib/supabase";
@@ -459,24 +458,17 @@ export async function sendInviteByEmail(
});
}
-const TURNSTILE_TEST_SITE_KEY = "1x00000000000000000000AA";
-const CAPTCHA_FAILED_MESSAGE = "Bot verification failed. Please try again.";
+const BOT_BLOCKED_MESSAGE = "Bot verification failed. Please try again.";
-// Cloud with a real site key requires a Turnstile token on login.
-export const requiresTurnstile =
- CarbonEdition === Edition.Cloud &&
- Boolean(CLOUDFLARE_TURNSTILE_SITE_KEY) &&
- CLOUDFLARE_TURNSTILE_SITE_KEY !== TURNSTILE_TEST_SITE_KEY;
-
-// For login loaders: render the widget whenever a key is configured — the
-// test key gives previews an auto-passing widget. Enforcement (requiresTurnstile)
-// is deliberately narrower, so a widget without enforcement is possible but
-// enforcement without a widget is not.
-export const turnstileSiteKey = CLOUDFLARE_TURNSTILE_SITE_KEY ?? null;
+// Vercel BotID guards login on Cloud. It only works on a Vercel deployment:
+// the client challenge script is served through Vercel rewrites (vercel.json)
+// and checkBotId() needs Vercel's request context and OIDC token, so the SST,
+// Docker and local stacks never enable it. Login loaders pass this flag to
+// useBotIdProtection so the client and server can never disagree.
+export const botIdEnabled = CarbonEdition === Edition.Cloud && IS_VERCEL;
export async function sendMagicLink(
email: string,
- turnstileToken?: string,
// The app's own origin. VERCEL_URL is only correct for the app it was set
// for — in local dev crbn writes the ERP url (or a localhost fallback) into
// .env.local, so an MES started outside `crbn up` would send its first-login
@@ -486,39 +478,35 @@ export async function sendMagicLink(
return getCarbonServiceRole().auth.signInWithOtp({
email,
options: {
- emailRedirectTo: `${origin ?? VERCEL_URL}/callback`,
- // GoTrue verifies the token itself when Supabase Auth captcha is on
- ...(SUPABASE_AUTH_CAPTCHA_ENABLED && turnstileToken
- ? { captchaToken: turnstileToken }
- : {})
+ emailRedirectTo: `${origin ?? VERCEL_URL}/callback`
}
});
}
-// Turnstile tokens are single-use, so exactly one side verifies: "gotrue"
-// sends verify in-app only when GoTrue won't; "app" sends (Resend, which
-// GoTrue never sees) only when the earlier "gotrue" gate stood down.
-// Returns a user-facing message on failure, null when the gate passes.
-export async function verifyLoginCaptcha(
- turnstileToken: string | undefined,
+// Returns a user-facing message when BotID classifies the request as a bot,
+// null when the gate passes. A request that skipped the client challenge
+// arrives without the x-is-human header and is classified as a bot.
+export async function verifyBotId(
ip: string,
- send: "gotrue" | "app" = "gotrue"
+ actor?: string
): Promise<string | null> {
- if (!requiresTurnstile) return null;
- const appVerifies =
- send === "gotrue"
- ? !SUPABASE_AUTH_CAPTCHA_ENABLED
- : SUPABASE_AUTH_CAPTCHA_ENABLED;
- if (!appVerifies) return null;
- return (await verifyTurnstileToken(turnstileToken, ip))
- ? null
- : CAPTCHA_FAILED_MESSAGE;
+ if (!botIdEnabled) return null;
+ try {
+ const { isBot } = await checkBotId();
+ if (!isBot) return null;
+ logAuthEvent("login_failed", { actor, ip, reason: "bot detected" });
+ return BOT_BLOCKED_MESSAGE;
+ } catch (e) {
+ // A throw is a platform misconfiguration (e.g. OIDC disabled on the
+ // project), not a verdict on the caller — fail open so it cannot lock
+ // every Cloud user out; the IP rate limit and account lockout still apply.
+ log.error("BotID check failed", { error: e });
+ return null;
+ }
}
export function getMagicLinkErrorMessage(error: { code?: string }): string {
switch (error.code) {
- case "captcha_failed":
- return CAPTCHA_FAILED_MESSAGE;
case "over_email_send_rate_limit":
case "over_request_rate_limit":
return "Too many sign-in attempts. Please try again later.";
@@ -527,35 +515,6 @@ export function getMagicLinkErrorMessage(error: { code?: string }): string {
}
}
-async function verifyTurnstileToken(
- token: string | undefined,
- remoteip: string
-): Promise<boolean> {
- try {
- const response = await fetch(
- "https://challenges.cloudflare.com/turnstile/v0/siteverify",
- {
- method: "POST",
- signal: AbortSignal.timeout(5000),
- headers: {
- "Content-Type": "application/x-www-form-urlencoded"
- },
- body: new URLSearchParams({
- secret: CLOUDFLARE_TURNSTILE_SECRET_KEY ?? "",
- response: token ?? "",
- // the client address, not the full x-forwarded-for proxy chain
- remoteip: remoteip.split(",")[0]?.trim() ?? ""
- })
- }
- );
- const result = await response.json();
- return Boolean(result.success);
- } catch (e) {
- log.error("Turnstile siteverify request failed", { error: e });
- return false;
- }
-}
-
// DEV_BYPASS_EMAIL signs a developer in with no magic link, so it is a local
// stack's convenience and nothing else: refuse it anywhere the env says this
// is a real deployment (production, preview, or self-hosted), whatever the
diff --git a/packages/auth/src/validators.ts b/packages/auth/src/validators.ts
index e6a9e8797e..1004f5fbdc 100644
--- a/packages/auth/src/validators.ts
+++ b/packages/auth/src/validators.ts
@@ -29,8 +29,7 @@ export const magicLinkValidator = z.object({
.string()
.min(1, { message: "Email is required" })
.email("Must be a valid email"),
- redirectTo: zfd.text(z.string().optional()),
- turnstileToken: zfd.text(z.string().optional())
+ redirectTo: zfd.text(z.string().optional())
});
export const passwordLoginValidator = z.object({
@@ -39,8 +38,7 @@ export const passwordLoginValidator = z.object({
.min(1, { message: "Email is required" })
.email("Must be a valid email"),
password: z.string().min(6, { message: "Password is too short" }),
- redirectTo: zfd.text(z.string().optional()),
- turnstileToken: zfd.text(z.string().optional())
+ redirectTo: zfd.text(z.string().optional())
});
export const resetPasswordValidator = z.object({
diff --git a/packages/env/src/index.ts b/packages/env/src/index.ts
index 7ac6e68bbe..7b85a119a8 100644
--- a/packages/env/src/index.ts
+++ b/packages/env/src/index.ts
@@ -9,7 +9,6 @@ declare global {
CARBON_API_URL: string;
CARBON_SLACK_ENABLED: string;
STRIPE_CONNECT_ENABLED: string;
- CLOUDFLARE_TURNSTILE_SITE_KEY: string;
CONTROLLED_ENVIRONMENT: string;
ERP_URL: string;
JIRA_CLIENT_ID: string;
@@ -36,8 +35,6 @@ declare global {
interface ProcessEnv {
CARBON_EDITION: string;
CARBON_API_URL: string;
- CLOUDFLARE_TURNSTILE_SITE_KEY: string;
- CLOUDFLARE_TURNSTILE_SECRET_KEY: string;
DOMAIN: string;
ERP_URL: string;
JIRA_CLIENT_ID: string;
@@ -163,15 +160,6 @@ export const CARBON_API_URL =
isSecret: false
}) ?? getEnv("SUPABASE_URL", { isSecret: false });
-export const CLOUDFLARE_TURNSTILE_SITE_KEY = getEnv(
- "CLOUDFLARE_TURNSTILE_SITE_KEY",
- { isRequired: false, isSecret: false }
-);
-export const CLOUDFLARE_TURNSTILE_SECRET_KEY = getEnv(
- "CLOUDFLARE_TURNSTILE_SECRET_KEY",
- { isRequired: false }
-);
-
export const DOMAIN = getEnv("DOMAIN", { isRequired: false }); // preview environments need no domain
export const EXCHANGE_RATES_API_KEY = getEnv("EXCHANGE_RATES_API_KEY", {
@@ -377,15 +365,6 @@ export const SUPABASE_AUTH_EXTERNAL_GOOGLE_CLIENT_ID = getEnv(
isSecret: true
}
);
-// True once Supabase Auth captcha (Attack Protection) is enabled — login
-// actions then forward Turnstile tokens to GoTrue instead of verifying in-app.
-export const SUPABASE_AUTH_CAPTCHA_ENABLED = parseBoolean(
- getEnv("SUPABASE_AUTH_CAPTCHA_ENABLED", {
- isRequired: false,
- isSecret: false
- }),
- false
-);
export const SESSION_SECRET = getEnv("SESSION_SECRET");
export const SESSION_KEY = "auth";
export const SESSION_ERROR_KEY = "error";
@@ -493,6 +472,11 @@ export const IS_LOCAL_DEV =
VERCEL_ENV !== "production" &&
VERCEL_ENV !== "preview";
+// Set to "1" by Vercel itself on every build and function — never by SST,
+// Docker, or a local stack, which all set VERCEL_ENV by hand. Server-only.
+export const IS_VERCEL =
+ getEnv("VERCEL", { isRequired: false, isSecret: true }) === "1";
+
export const POSTHOG_API_HOST = getEnv("POSTHOG_API_HOST", {
isSecret: false
});
@@ -580,7 +564,6 @@ export function getBrowserEnv() {
CARBON_EDITION,
CARBON_SLACK_ENABLED: CARBON_SLACK_ENABLED ? "true" : "",
STRIPE_CONNECT_ENABLED: STRIPE_CONNECT_ENABLED ? "true" : "",
- CLOUDFLARE_TURNSTILE_SITE_KEY,
CONTROLLED_ENVIRONMENT,
DEFAULT_LANGUAGE,
ERP_URL,
diff --git a/packages/react/package.json b/packages/react/package.json
index 3e144dfb84..1b62500c21 100644
--- a/packages/react/package.json
+++ b/packages/react/package.json
@@ -66,6 +66,7 @@
"@visx/scale": "3.12.0",
"@visx/shape": "3.12.0",
"@visx/text": "3.12.0",
+ "botid": "catalog:",
"class-variance-authority": "catalog:",
"clsx": "2.1.1",
"cmdk": "0.2.0",
@@ -121,7 +122,6 @@
"peerDependencies": {
"@internationalized/date": "catalog:",
"@lingui/react": "catalog:",
- "@marsidev/react-turnstile": "catalog:",
"framer-motion": "catalog:",
"react": "catalog:",
"react-dom": "catalog:",
diff --git a/packages/react/src/BotId.tsx b/packages/react/src/BotId.tsx
new file mode 100644
index 0000000000..75810149ca
--- /dev/null
+++ b/packages/react/src/BotId.tsx
@@ -0,0 +1,22 @@
+import { initBotId } from "botid/client/core";
+import { useEffect } from "react";
+
+let initialized = false;
+
+// Vercel BotID: patches window.fetch so POSTs to `path` carry an invisible
+// challenge that checkBotId() verifies on the server. React Router submits an
+// action to `${path}.data`, so both forms are protected. Pass the server's
+// `botIdEnabled` — off Vercel the challenge script 404s and the patched fetch
+// would reject every submission.
+export function useBotIdProtection(path: string, enabled: boolean) {
+ useEffect(() => {
+ if (!enabled || initialized) return;
+ initialized = true;
+ initBotId({
+ protect: [
+ { path, method: "POST" },
+ { path: `${path}.data`, method: "POST" }
+ ]
+ });
+ }, [path, enabled]);
+}
diff --git a/packages/react/src/Turnstile.tsx b/packages/react/src/Turnstile.tsx
deleted file mode 100644
index 55f54278b3..0000000000
--- a/packages/react/src/Turnstile.tsx
+++ /dev/null
@@ -1,31 +0,0 @@
-import { Turnstile } from "@marsidev/react-turnstile";
-import { useMode } from "./hooks/useMode";
-
-type TurnstileChallengeProps = {
- siteKey?: string;
- onToken: (token: string) => void;
-};
-
-// Clears the token on error/expiry so callers can gate submission on it.
-export function TurnstileChallenge({
- siteKey,
- onToken
-}: TurnstileChallengeProps) {
- const mode = useMode();
-
- if (!siteKey) return null;
-
- return (
- <div className="w-full flex justify-center">
- <Turnstile
- siteKey={siteKey}
- onSuccess={onToken}
- onError={() => onToken("")}
- onExpire={() => onToken("")}
- options={{
- theme: mode === "dark" ? "dark" : "light"
- }}
- />
- </div>
- );
-}
diff --git a/packages/react/src/index.tsx b/packages/react/src/index.tsx
index c4ff246a6c..b4614abd69 100644
--- a/packages/react/src/index.tsx
+++ b/packages/react/src/index.tsx
@@ -27,6 +27,7 @@ import {
import type { BadgeProps } from "./Badge";
import { Badge, BadgeCloseButton } from "./Badge";
import { BarProgress } from "./BarProgress";
+import { useBotIdProtection } from "./BotId";
import {
BottomSheet,
BottomSheetBody,
@@ -348,7 +349,6 @@ import {
usePickOrderOptions
} from "./TrackedEntityPicker";
import { TruncatedTooltipText } from "./TruncatedTooltipText";
-import { TurnstileChallenge } from "./Turnstile";
import { TVColorBars } from "./TVColorBars";
import { cn } from "./utils/cn";
import { hasOpenDialog, isInsideTopmostDialog } from "./utils/dialog";
@@ -634,7 +634,6 @@ export {
TimePicker,
Toaster,
Toggle,
- TurnstileChallenge,
ToggleGroup,
ToggleGroupItem,
TrackedEntityPicker,
@@ -656,6 +655,7 @@ export {
reactNodeToString,
shortcutKeyVariants,
toast,
+ useBotIdProtection,
useModalCardType,
useModalDrawerType,
useOperatingSystem,
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index b04cf7bd76..fb3153e15b 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -51,9 +51,6 @@ catalogs:
'@logtape/testing':
specifier: 2.2.3
version: 2.2.3
- '@marsidev/react-turnstile':
- specifier: 1.5.0
- version: 1.5.0
'@nanostores/react':
specifier: 0.7.3
version: 0.7.3
@@ -174,6 +171,9 @@ catalogs:
'@vercel/react-router':
specifier: 1.2.6
version: 1.2.6
+ botid:
+ specifier: 1.5.11
+ version: 1.5.11
class-variance-authority:
specifier: 0.7.1
version: 0.7.1
@@ -1937,6 +1937,9 @@ importers:
'@vercel/react-router':
specifier: 'catalog:'
+ botid:
+ specifier: 'catalog:'
cookie:
specifier: 'catalog:'
version: 1.1.1
@@ -3206,9 +3209,6 @@ importers:
'@lingui/react':
specifier: 'catalog:'
- '@marsidev/react-turnstile':
- specifier: 'catalog:'
'@nanostores/react':
specifier: 'catalog:'
@@ -3383,6 +3383,9 @@ importers:
'@visx/text':
specifier: 3.12.0
version: 3.12.0([email protected])
+ botid:
+ specifier: 'catalog:'
class-variance-authority:
specifier: 'catalog:'
version: 0.7.1
@@ -5653,12 +5656,6 @@ packages:
react-native-uuid: ^2
tiny-invariant: ^1
- '@marsidev/[email protected]':
- resolution: {integrity: sha512-Ph6mcj8u9WBDsBO7s9jKPsyRDz1sBPBJwrk+Ngx09vFInvKsQ6U6kW5amEcGq4dHOreB6DgFrOJk7/fy318YlQ==}
- peerDependencies:
- react: 18.3.1
- react-dom: 18.3.1
-
'@mdx-js/[email protected]':
resolution: {integrity: sha512-f6ZO2ifpwAQIpzGWaBQT2TXxPv6z3RBzQKpVftEWN78Vl/YweF1uwussDx8ECAXVtr3Rs89fKyG9YlzUs9DyGQ==}
@@ -11168,6 +11165,17 @@ packages:
resolution: {integrity: sha512-JZOSA7Mo9sNGB8+UjSgzdLtokWAky1zbztM3WRLCbZ70/3cTANmQmOdR7y2g+J0e2WXywy1yS468tY+IruqEww==}
+ resolution: {integrity: sha512-KOO1A3+/vFVJk5aFoG3sNwiogKFPVR+x4aw4gQ1b2e0XoE+i5xp48/EZn+WqR07jRHeDGwHWQUOtV5WVm7xiww==}
+ peerDependencies:
+ next: 15.5.21
+ react: 18.3.1
+ peerDependenciesMeta:
+ next:
+ optional: true
+ react:
+ optional: true
+
resolution: {integrity: sha512-tzPjzCxygAKWFOJP011oxFHs57HzIhOEracIgAePE4pqB3LikALKnSzUyU4MGs9/iCEUuHlAJTjTc5M+u7YEGg==}
@@ -18674,11 +18682,6 @@ snapshots:
optionalDependencies:
'@rollup/rollup-linux-x64-gnu': 4.9.5
- dependencies:
- react: 18.3.1
- react-dom: 18.3.1([email protected])
-
'@mdx-js/[email protected]':
dependencies:
'@types/estree': 1.0.8
@@ -25552,6 +25555,11 @@ snapshots:
+ optionalDependencies:
+ react: 18.3.1
+
diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml
index 9613df0c6f..06a28ee2e1 100644
--- a/pnpm-workspace.yaml
+++ b/pnpm-workspace.yaml
@@ -65,7 +65,6 @@ catalog:
'@lingui/macro': 5.9.4
'@lingui/react': 5.9.4
'@lingui/vite-plugin': 5.9.4
- '@marsidev/react-turnstile': 1.5.0
'@logtape/logtape': 2.2.3
'@logtape/redaction': 2.2.3
'@logtape/testing': 2.2.3
@@ -113,6 +112,7 @@ catalog:
'@vercel/analytics': 1.6.1
'@vercel/react-router': 1.2.6
axios: 1.16.0
+ botid: 1.5.11
class-variance-authority: 0.7.1
cookie: 1.1.1
cross-env: 7.0.3
diff --git a/sst.config.ts b/sst.config.ts
index 94299a4844..9198bafe57 100644
--- a/sst.config.ts
+++ b/sst.config.ts
@@ -52,10 +52,6 @@ export default $config({
ASSEMBLER_SERVICE_URL: process.env.ASSEMBLER_SERVICE_URL,
AUTH_PROVIDERS: process.env.AUTH_PROVIDERS,
CARBON_EDITION: process.env.CARBON_EDITION,
- CLOUDFLARE_TURNSTILE_SECRET_KEY:
- process.env.CLOUDFLARE_TURNSTILE_SECRET_KEY,
- CLOUDFLARE_TURNSTILE_SITE_KEY:
- process.env.CLOUDFLARE_TURNSTILE_SITE_KEY,
CONTROLLED_ENVIRONMENT: process.env.CONTROLLED_ENVIRONMENT,
DOMAIN: process.env.DOMAIN ?? "carbon.ms",
ERP_URL: process.env.URL_ERP ? `https://${process.env.URL_ERP}` : "https://itar.carbon.ms",
@@ -164,10 +160,6 @@ export default $config({
ASSEMBLER_SERVICE_URL: process.env.ASSEMBLER_SERVICE_URL,
AUTH_PROVIDERS: process.env.AUTH_PROVIDERS,
CARBON_EDITION: process.env.CARBON_EDITION,
- CLOUDFLARE_TURNSTILE_SECRET_KEY:
- process.env.CLOUDFLARE_TURNSTILE_SECRET_KEY,
- CLOUDFLARE_TURNSTILE_SITE_KEY:
- process.env.CLOUDFLARE_TURNSTILE_SITE_KEY,
CONTROLLED_ENVIRONMENT: process.env.CONTROLLED_ENVIRONMENT,
DOMAIN: process.env.DOMAIN ?? "carbon.ms",
ERP_URL: process.env.URL_ERP ? `https://${process.env.URL_ERP}` : "https://itar.carbon.ms",