Websites and web apps take input from people they cannot see or control. Almost every web security bug comes from trusting that input too much. This lesson sets out the first rule.
The browser belongs to the user
Anything that happens in the browser is under the user’s control. Hidden fields, greyed-out buttons, price boxes and checks written into the page can all be changed or skipped. Requests can be sent to the server without the page at all.
marks form, in the browser
A teacher enters marks in a web form. The page has a check built into it: the box accepts only numbers from 0 to 100, and shows an error otherwise. This check runs in the teacher's browser.
Check on the server
Allow what is valid
There are two ways to check input. A blocklist rejects inputs that look bad, such as certain characters. An allowlist accepts only inputs that look exactly as expected, such as “a whole number from 0 to 100” or “a roll number in the form 21CS047”. Blocklists always miss something nobody thought of. OWASP, the leading web security project, recommends allowlists. One of this course’s books relies on filtering out bad characters; that advice is out of date.
WEBA-1 counts as completed once you step through the figure to its last step.