Chapter quiz · Auth & Security

Test what you learned.

8 questions on Auth & Security. Pass 70% to clear the chapter.

← Review chapter lessons

Quiz

Auth & Security — Chapter Quiz

Eight questions on sessions vs JWT, app.keys for signed cookies, cookie flags, koa-jwt, helmet headers, CSRF/SameSite, rate limiting, and password hashing.

0/ 9
  1. Question 1
    1

    In Koa, what must you set before ctx.cookies.set('sid', value, { signed: true }) works?

  2. Question 2
    2

    After adding koa-jwt middleware, where is the decoded JWT payload available in a route handler?

  3. Question 3
    3

    Which combination of cookie flags provides the best baseline security for a session cookie?

  4. Question 4
    4

    What is the primary advantage of JWTs over server-side sessions for a horizontally scaled API?

  5. Question 5
    5

    Why should you use bcrypt or argon2 instead of SHA-256 for password hashing?

  6. Question 6
    6

    Setting sameSite: 'strict' on a cookie fully replaces the need for CSRF tokens in all scenarios.

  7. Question 7
    7

    Apply koa-helmet middleware to automatically set security headers including Content-Security-Policy and ___.

  8. Question 8
    8

    Which measures defend against brute-force login attacks?

    Select all that apply.

Pick an answer — instant feedback as you go.