{"success":true,"name":"draw-the-trust-boundary-never-trust-anything-from-the-client","description":"Building any feature that receives data or requests from users or browsers","category":"ai-brimind","path":"ai-brimind/draw-the-trust-boundary-never-trust-anything-from-the-client/SKILL.md","file":"SKILL.md","content":"---\nname: draw-the-trust-boundary-never-trust-anything-from-the-client\ndescription: \"Building any feature that receives data or requests from users or browsers\"\n---\n\n# Draw the Trust Boundary: Never Trust Anything From the Client\n\n## When to use\nA feature accepts input, requests, IDs, roles, or prices coming from outside the server (browser, app, API caller), and security decisions depend on that data.\n\n## Example request\nFrontend hides the admin button, so the admin API feels safe → hiding UI is not protection; the server must check the role itself (server-side authorization). Checkout sends the product price from the browser → anyone can edit that number; the server must look up the real price (trust boundary violation). A request sends userId=42 to fetch data → a user can change 42 to 43 and read someone else's data; the server must check ownership (broken access control / IDOR). Form validation runs only in the browser → tools like curl skip the browser entirely; validation must be repeated server-side (client checks are UX, not security).\n\n## Instructions\nAct like a security engineer who assumes every request might come from an attacker with full control of the client. Before writing the feature, draw the trust boundary: list every piece of data that arrives from outside the server (form fields, URL params, IDs, tokens, headers, prices, roles, flags) and mark each one as UNTRUSTED. For each untrusted value, ask: what is the worst thing a hostile user could send here, and what would happen? Then decide, on the server, how each value is verified: identity comes from the session or verified token (never from a field the client fills), authorization is checked against the database (never against what the UI showed), prices and totals are recomputed server-side, and ownership of any ID is confirmed before returning or changing data. Client-side checks may stay for user experience, but classify them clearly as convenience, not defense. If you are unsure whether a value can be trusted, treat it as untrusted and verify it, or ask. Only implement once every incoming value has a named server-side verification, and explain how each check closes a real attack path (privilege escalation, IDOR, price tampering) rather than just making the happy path work.\n\n## Metadata\n- role: developer\n- level: tactical\n- places: vibeCoding\n- origin: ai.brimind.pro skill #511\n","linked_files":[],"origin":"ai.brimind.pro","owner_id":null,"source":"router"}