Tip: Choose Save as PDF in the print dialog to download. Use A4 paper size.
Shade in the A or B circle for each question.
Draw a line connecting each item on the left to its match on the right.
| Left column | Right column | |
|---|---|---|
| 1GET /api/users/42 | AA rate limit that blocks a client sending too many requests, which stops brute-force and flooding attacks. | |
| 2if (requests > 100) { block() } | BA request that returns user 42's record. With no authentication check, anyone who knows the URL could read it. | |
| 3Excessive data exposure: the API returns more fields than the app needs, so attackers can read sensitive data | CThe request value is added to the query without validation, so an attacker can send SQL code and run an injection attack. | |
| 4Input validation: the API checks that data from a request is the expected type and format before using it | Dreturn user; // includes password_hash and tfn | |
| 5app.get('/admin/export', exportAll) | EThe admin endpoint has no authentication or authorisation check, so any attacker who finds the URL can download all the data. | |
| 6query = 'SELECT * FROM users WHERE id=' + id | Fif (!Number.isInteger(id)) { reject() } |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
API security risk — An API is risky when it lacks authentication, input validation or rate limits, so attackers can send requests straight to it and steal data or misuse it.IF caller is authenticated THEN
SEND orderData
END IFSELECT * FROM users WHERE userId = 5if (typeof qty !== "number") {
return res.status(400);
}IF requestCount > maxRequests THEN
RESPOND "429 Too Many Requests"
END IFfetch("/api/orders", {
headers: { Authorization: apiKey }
})