Skip to content

📈 Open source, privacy-first web analytics — a cookie-less Google Analytics alternative with built-in error tracking and performance monitoring. Self-host it or use our cloud. Get started for free!

planId guard

Blue Mouse606e5eea3e21
diff --git a/web/app/routes/user-settings.tsx b/web/app/routes/user-settings.tsx
index c48095ca4..93ad0ac51 100644
--- a/web/app/routes/user-settings.tsx
+++ b/web/app/routes/user-settings.tsx
@@ -474,6 +474,10 @@ export async function action({ request }: ActionFunctionArgs) {
case 'preview-subscription-update': {
const planId = Number(formData.get('planId'))
+ if (!Number.isFinite(planId) || planId <= 0 || !Number.isInteger(planId)) {
+ return data<UserSettingsActionData>({ intent, error: 'Invalid planId' }, { status: 400 })
+ }
+
const result = await serverFetch(request, 'user/preview-plan', {
method: 'POST',
body: { planId },
@@ -495,6 +499,10 @@ export async function action({ request }: ActionFunctionArgs) {
case 'change-subscription-plan': {
const planId = Number(formData.get('planId'))
+ if (!Number.isFinite(planId) || planId <= 0 || !Number.isInteger(planId)) {
+ return data<UserSettingsActionData>({ intent, error: 'Invalid planId' }, { status: 400 })
+ }
+
const result = await serverFetch(request, 'user/change-plan', {
method: 'POST',
body: { planId },