HACKORY
Language · English
← All chapters
HACKORY / Open library

How a web application works

A web application has two sides. Your browser shows the page and its buttons; another computer, the server, stores the data and decides what to show you and which changes to accept.

New here? Try the first lesson without an account

How it works

When you tap a button, the browser sends a message to the server: a request. The server reads it, decides what to do, and replies with another message: the response. These requests usually go to an API, the list of requests the server accepts from other programs, such as “show me invoice 101.” The page uses it behind the scenes, but anyone can send requests to it directly.

Expected behavior

You tap “View invoice” and the browser requests /facturas/101. Before answering, the server checks which account made the request and whether that invoice belongs to it.

What can go wrong

The screen does not show other people’s invoices, but the API returns /facturas/102 if someone requests it directly, without checking whose it is.

What to observe

Request the same address with two test accounts of your own and compare the responses: that shows whether the screen or the server makes the decision.

Common false positive

A button missing from the screen does not prove that the server protects that action.

Why it matters

If you know which side makes each decision, you know where to look for the bug. A screen can hide a button, but if the API still accepts that request, the action is still possible.

How to fix it

The rules about who can see or change something must live on the server, which processes the request, not only on the screen.

Understand it step by step

Who does each job

The browser draws the page with HTML, the text that describes its parts, and makes it interactive with JavaScript, a language of instructions. When it needs data, it sends a request to the server. The server decides whether the action is allowed, looks the data up in its database, and returns a response. There may be intermediaries along the way: a proxy, which receives the message and forwards it, or a cache, which keeps a copy of a response to deliver it faster. None of them should change who can see what.

Follow an invoice

When you tap “View invoice,” the page may ask the API for GET /api/facturas/101. GET is the kind of request used for reading, and 101 is the number that picks the invoice. A cookie travels with the request: a small value the browser stores and sends automatically to remember who you are. The server has to combine both to decide. If it only checks that a cookie is present, another person’s invoice may be reachable even though no button shows it.

What to look at in the lab

Take a real request from the lab and point out its parts: what was asked for, at which address, what extra data traveled, and what the server answered. Ask yourself which part you can change from the browser and which part the server decides. That separation keeps you from mistaking a change on the screen for a security decision.

Recommend this chapter to a friend