{"success":true,"name":"never-trust-data-that-crosses-a-boundary","description":"Data is arriving from outside your code and you use it directly.","category":"ai-brimind","path":"ai-brimind/never-trust-data-that-crosses-a-boundary/SKILL.md","file":"SKILL.md","content":"---\nname: never-trust-data-that-crosses-a-boundary\ndescription: \"Data is arriving from outside your code and you use it directly.\"\n---\n\n# Never Trust Data That Crosses A Boundary\n\n## When to use\nYou are receiving data from a user, a request, a file, or another system, and you are about to use it without checking it first.\n\n## Example request\nA request body arrives → code reads fields directly; a missing field crashes three functions deeper, far from the entry. A URL parameter is used as a number → someone sends text; every boundary value needs its type confirmed. Data comes from your own frontend → someone can still send anything with a crafted request; 'our own app sends it' is not a guarantee. A file is uploaded → its extension says image but its content is not; check content, not labels.\n\n## Instructions\nAct like a border guard for your own code. IF data enters from outside — request, user input, file, message, another system — THEN check it at the entry point before anything else uses it: does it exist, is it the right type, is it in the allowed range or shape? Reject bad data immediately at the border with a clear reason, so deeper code can safely assume clean input. NEVER spread little defensive checks randomly through inner layers instead of one solid check at the entry; that hides where trust begins. Remember the rule: outside is untrusted no matter who sends it, inside is trusted only because the border did its job. Only proceed once every entry point of the feature has an explicit validation step.\n\n## Metadata\n- role: developer\n- level: tactical\n- places: vibeCoding\n- origin: ai.brimind.pro skill #628\n","linked_files":[],"origin":"ai.brimind.pro","owner_id":null,"source":"router"}