Skip to content
engineering workbench.by StudyPort Academy
Learning path
Real-World18 min

Security as an ongoing practice

Understand the idea

Security is the next diff, not a checklist you finish before launch.

The idea

You now have a set of mechanisms, not a poster. names the caller. Authorization, including ownership, decides the action. Passwords are salted memory-hard hashes, not ciphertext. Sessions can be deleted. Token signatures cannot, unless the key stays with the signer and the token stays out of localStorage. OAuth codes are not tokens in URLs. Passkeys will not sign for the wrong origin. Login routes do not list which emails exist, and they stop answering when the bucket is empty. Secrets are injected, not committed. Dependencies are code. None of that stays true by itself. The next diff can put a token in localStorage, skip note.owner, or set the JWT header to alg none. The review function flags the first, recognizes the ownership compare, and does not congratulate a bare 401, because a 401 without the ownership line is the BOLA bug again. Run that kind of look at the change you are about to merge. Then do it on the one after that.

What changes

A checklist versus a practice
A launch checklistWhat it missesThe habit
We hashed passwords before launchA later debug route prints them, or a new column stores ciphertextThe next password-shaped change is reviewed against the hash rule
We added auth middlewareA new id route forgets the owner compareEvery new id is requested as the wrong user
The scanner was green on FridayMonday's dependency bump is an unfixed releaseLockfile diffs are part of review

The command

Flag the storage line, recognize the owner check

3s timeout · one stateless run. Node and Express use Piston when that instance accepts the job (public EMKC execute is whitelist-only; set PISTON_URL or PISTON_TOKEN). Otherwise a local Node process. MongoDB uses a fresh in-memory server per run, then it is stopped.

The mistake

Check the result

The localStorage line is flag storage. The owner compare is ownership check. A bare 401 is look again, because login without ownership is the bug in the BOLA lesson.

Guided challenge

Flag token storage

review ignores localStorage.setItem, so a token stored that way prints look again. Return flag storage for that line.

Flag token storage

3s timeout · one stateless run. Node and Express use Piston when that instance accepts the job (public EMKC execute is whitelist-only; set PISTON_URL or PISTON_TOKEN). Otherwise a local Node process. MongoDB uses a fresh in-memory server per run, then it is stopped.

EXPECTED RESULT

flag storage
ownership check

Hints 0/2

    Use all hints or make 3 failed checks (0/3).

    Free exploration

    Change this example and run it again. Each run is a new process. Nothing is saved.

    Your variation

    3s timeout · one stateless run. Node and Express use Piston when that instance accepts the job (public EMKC execute is whitelist-only; set PISTON_URL or PISTON_TOKEN). Otherwise a local Node process. MongoDB uses a fresh in-memory server per run, then it is stopped.

    Quiz

    A quick check for understanding. Retry as often as you like; your learning path stays open.

    01When do these checks happen?
    02What is the review looking for?

    Ready to call this one understood?

    Mark this lesson complete to earn 200 XP. You can always revisit it.

    Sign in to save progress