LogicTrail
  • Trails
  • Check my app
  • Pricing
  • Sign in
  1. Trails
  2. /
  3. Don't trust the browser
  4. · 4 minutes · Pro

Minus three tickets

A customer bought minus three concert tickets. Your app 'charged' them -$60 and added $60 of store credit to their wallet.

This answers: Is form validation enough to secure my API? No coding needed. 3 quick decisions.

  • Payments and webhooks
  • Where your data lives

Checking your access…

Is form validation enough to secure my API?

No. Form rules like required, min and max run in the browser for the honest user's convenience, but anyone can send the request directly with any values. Validate every field on the server, checking type, range, length and allowed values with a schema library like Zod, and add database constraints as a last line of defence.

Trail of the bug
  1. Browser
  2. Your server
  3. Database

Breaks at Your server: Quantity never checked on the server

Why AI tools write this bug

AI tools put validation where it is visible, in the form, and often generate that read the body without checking it.

How to fix it

  1. List every field each accepts.

3 more steps, and a prompt that checks your own app for this bug. Part of Pro.

Unlock

Common questions

Should I remove validation from the form then?
No. Keep it for a friendly experience, and repeat it on the server for safety. Only the server's check protects you.

Related scenarios

  • One field, a million creditsPro · 4 min
  • The double orderPro · 5 min
  • The webhook that arrived twicePro · 5 min

More on this trail

Don't trust the browser: Prices, webhooks, uploads, form limits and coupons: what visitors can change, and what your server must decide.

Want someone to look?

We check AI-built apps for this and three other common leaks, in plain English.

Check my app
Sign in

Sign in to walk this one

3 decisions, about 4 minutes, and a prompt to check your own app for the same problem.

Sign in No password. We email you a link.

How to fix it

  1. List every field each accepts.

3 more steps, and a prompt that checks your own app for this bug. Part of Pro.

Unlock