title: Play the Server description: A twelve-card game. You are the server: pick 200, 401, 403 or 404 for each request, using the rules for sign-in, roles, ownership and share codes. image: /sims/play-the-server-access/play-the-server-access.png og:image: /sims/play-the-server-access/play-the-server-access.png twitter:image: /sims/play-the-server-access/play-the-server-access.png social: cards: false status: built
Play the Server¶
Run the Play the Server MicroSim Fullscreen
About This MicroSim¶
You are the server. Each card shows who is asking and the request they sent. Pick the status code you would answer with. The card then tells you if you were right and why.
The server applies five rules, in order. No valid session and the route needs one: 401. Valid session, but the role may not use the route: 403. Valid session and role, but the object doesn't exist or isn't the requester's: 404. Shared route with a wrong code: 404. Otherwise: 200.
The people, IDs, routes and the share code 481920 are illustrative. The rule to answer 404 for someone else's scan, and the 6-digit share code, come from the chapter's running example.
How to Use¶
- Read card 1 and the "Who is who" panel on the right.
- Pick 200, 401, 403 or 404. Hover a button first to see what the code means.
- Read the feedback, then press Next card. Cards come in a fixed order, one attempt each.
- After card 12, the summary shows your score and repeats the five rules. Hover any dot at the top to review a card.
Iframe Embed Code¶
You can add this MicroSim to any web page by adding this to your HTML:
<iframe src="https://arunbatchu.github.io/good-enough-engineering/sims/play-the-server-access/main.html"
height="474px"
width="100%"
scrolling="no"></iframe>
Lesson Plan¶
Learning Objective¶
The learner will apply authentication, role, ownership and share-code rules to choose the correct status code (200, 401, 403 or 404) for each of twelve requests to the dating-safety app.
Grade Level¶
Adult professional (Good Enough Engineering)
Duration¶
10-15 minutes
Prerequisites¶
Authentication, authorization, session, role, protected route, object ownership check, insecure direct object reference, 404 instead of 403 and share code access, from the chapter sections before the game.
Activities¶
- Exploration (2 min): Read the cast panel and the meaning of each code.
- Guided Practice (8 min): Play all twelve cards. Before each pick, say which rule decides it.
- Assessment (5 min): Score 10 of 12 or better, then explain why cards 3 and 4 get the same answer.
Assessment¶
- Scores 10 of 12 or more on the first attempt.
- Tells authentication failures (401) apart from authorization failures (403 or 404).
- Explains why someone else's scan and a scan that doesn't exist both get 404.
References¶
- MDN: HTTP response status codes - what 200, 401, 403 and 404 mean.
- OWASP: Insecure Direct Object Reference Prevention Cheat Sheet - checking ownership on every object.
- p5.js reference - the library that draws the game.