Track 10 · Lesson 1 of 4Capstone

Track 10 · Capstone

Audit your own project

Lesson 1 of 4· 20 min

Time to point everything at real code: yours. Answer twenty-four questions about how your project handles sessions, cookies, refresh and attacks, find where each piece lives, then work through the review findings that apply.

Audit your auth

Yes, no or not sure: saved in this browser

Storage

Cookies

Sessions and refresh

Attacks

Operations

0 yes0 no0 not sure0 of 24 answered

Answer from the code, not from memory#

“I think we set HttpOnly” isn’t a yes. Open the file, find the line, then answer. Anything you can’t confirm in a few minutes is “not sure”, which is a finding in its own right: nobody on the team knows.

Where to look#

Every codebase hides these in different places, but the names are predictable. Each row has a search you can paste into a terminal at the root of your project (it uses ripgrep, rg).

Find it in your codebase

Copy a search, run it, read the hits

  • Where login issues the session or tokens

    loginsignInauthenticatejwt.signSignInAsynccreate_session

    Usually in: auth routes, controllers, route handlers, services/auth

    rg -n -i "login|signIn|authenticate|jwt\.sign|SignInAsync|create_session"
  • Where tokens are stored in the browser

    localStorage.setItemsessionStoragedocument.cookieaccessToken

    Usually in: auth context/store, API client, utils/auth

    rg -n -i "localStorage\.setItem|sessionStorage|document\.cookie|accessToken"
  • Cookie flags and lifetime

    Set-Cookieres.cookie(cookies().set(SESSION_COOKIECookieOptionshttpOnly

    Usually in: server config, session middleware, cookie helpers

    rg -n -i "Set-Cookie|res\.cookie\(|cookies\(\)\.set\(|SESSION_COOKIE|CookieOptions|httpOnly"
  • Refresh logic

    refreshinterceptorsonResponseError401retry

    Usually in: API client, fetch wrapper, HTTP interceptor

    rg -n -i "refresh|interceptors|onResponseError|401|retry"
  • Logout and revocation

    logoutsignOutrevokedestroy_session

    Usually in: auth routes, auth context, user menu

    rg -n -i "logout|signOut|revoke|destroy_session"
  • Who can do what (authorization)

    authorizecan(policyguard[Authorize]@PreAuthorizelogin_requiredbefore_action

    Usually in: API middleware, policies, controllers

    rg -n -i "authorize|can\(|policy|guard|\[Authorize\]|@PreAuthorize|login_required|before_action"
  • Route protection in the UI

    middlewareProtectedRouteRequireAuthbeforeEachredirect('/login')

    Usually in: router config, layouts, middleware file

    rg -n -i "middleware|ProtectedRoute|RequireAuth|beforeEach|redirect\('/login'\)"
  • CSP and security headers

    Content-Security-Policyhelmetheaders()SecurityMiddleware

    Usually in: framework config, reverse proxy (nginx, CDN)

    rg -n -i "Content-Security-Policy|helmet|headers\(\)|SecurityMiddleware"
  • Rate limiting and lockout

    rate-limitthrottleLockoutMaxFailedAccessAttempts429

    Usually in: API gateway, middleware, identity config

    rg -n -i "rate-limit|throttle|Lockout|MaxFailedAccessAttempts|429"
  • Secrets and keys

    SECRETKEYprocess.env.envNEXT_PUBLIC_VITE_

    Usually in: .env files, deployment settings, secret manager

    rg -n -i "SECRET|KEY|process\.env|\.env|NEXT_PUBLIC_|VITE_"
  • Real-time auth

    WebSocketsocket.io authaccessTokenFactoryaccess_token

    Usually in: socket/hub service

    rg -n -i "WebSocket|socket\.io auth|accessTokenFactory|access_token"

Every finding, one at a time#

The review cards from the last two tracks, all in one place. Start with Critical, tick what you’ve checked, and file a ticket for anything you find.

Review findings

Filter by severity

In a code review

CriticalFrontend / Backend

Known-vulnerable dependency

Fix: Bump to the fixed version; force transitive ones with an override or resolution; rerun the audit until no High remains; automate it in CI.

0 of 3 checked

In a code review

CriticalDevOps

Secret committed to git or baked into an image

Fix: Rotate and revoke first, review provider access logs for the exposure window, delete old images and stale CI secrets. Purging history is optional once the key is dead.

0 of 3 checked

In a code review

CriticalBackend

SQL or command injection

Fix: Use parameterised queries and argument arrays everywhere; validate input types; run the database user with least privilege.

0 of 3 checked