skip to content

Authentication & Authorization

Proving who a caller is — by session cookie, bearer token or second factor — then deciding what they may do. Interviewers separate the two because conflating them starts most access-control bugs.

on this pageshow

explore

questions

152 · 6 sections

Why does a guest's held campsite selection vanish at sign-in unless the server copies it into the new server-side session record?

level: juniorimportance: must knowfreq 52%
basics
~20 s

Because the selection is filed server-side under the identifier the visitor had before signing in, and sign-in issues a new one. Carrying it over is an explicit step in the login handler, and not every item should be carried.

open as a page

A playout scheduler's session cookie carries `presenter=dmorgan; role=engineer` in plain text — what stops a presenter becoming the engineer?

level: juniorimportance: must knowfreq 72%
basics
~20 s

Nothing stops them. A cookie value is input the caller can retype, so a plain-text role claim is simply edited. The value must be an unguessable reference to a record the scheduler holds, or state the server can prove it wrote.

open as a page

A server-side session runs on an idle clock and an absolute clock — what does each one defend against?

level: juniorimportance: must knowfreq 74%
basics
~20 s

The idle clock restarts on every request and ends a session left unattended. The absolute clock counts from the sign-in that created the record, never restarts, and caps how long one authentication may keep counting.

open as a page

What handle should a server issue between a successful password step and a verified second factor, and how must it differ from a signed-in session?

level: middleimportance: must knowfreq 58%
basics
~20 s

A short-lived, single-purpose pre-authentication handle bound to one login attempt and to the factor still pending, carrying no authority to reach application endpoints. It must be its own credential, not a signed-in session record wearing a pending flag.

open as a page

Your server pins each stored session record to the client address seen at login — what does that buy, and what breaks?

level: middleimportance: must knowfreq 62%
basics
~20 s

Pinning raises the cost of using a stolen session reference — the thief must also call from that network — but never prevents it. The price is paid by legitimate callers whose address moves: roaming clients, carrier re-addressing and shared egress pools.

open as a page

A partner station posts telemetry with a long-lived API key that never expires — what does your ingest service store for it?

level: juniorimportance: must knowfreq 72%
basics
~20 s

Store a one-way digest of the key, never the key itself, alongside a non-secret prefix and last characters for display, the owning station, the key's permissions, and timestamps. The plaintext is shown once at creation and is not recoverable afterwards.

open as a page

Your server stores each sensor's long-lived refresh credential in a table — why store a hash of it, and one row per device?

level: juniorimportance: must knowfreq 58%
basics
~20 s

Storing only a digest keeps the table from being a pile of live bearer credentials: a leaked read yields nothing a sensor could present. One row per device keeps revocation targeted, so killing one sensor does not strand the whole fleet.

open as a page

Where a browser client keeps an access token between requests decides which attack wins — which attack goes with which resting place?

level: juniorimportance: must knowfreq 78%
basics
~20 s

A token in script-readable storage loses to script injection; a token in a cookie the browser attaches automatically loses to cross-site forged requests. Neither is safer until you name the threat you are buying down.

open as a page

A verified access token's `scope` claim names three permissions — may the caller now perform all three on your service?

level: juniorimportance: must knowfreq 58%
basics
~20 s

No. A scope records the ceiling the issuer put on what the caller may ask for; it grants nothing on your service. Your own authorization rules still decide, and both the scope check and your rule must pass.

open as a page

You are minting long-lived ingest keys for four hundred partner stations — how many random bits, what leading segment, and which one-way function at rest?

level: middleimportance: must knowfreq 60%
basics
~20 s

At least 128 bits from a cryptographically secure generator; a fixed, recognisable leading segment plus a non-secret key identifier; and a fast cryptographic digest such as SHA-256 as the verifier. A deliberately slow password-hashing function is the wrong tool for a high-entropy machine key.

open as a page

A server-side relying party redirects a depot supervisor to the fleet operator's identity provider — what must it keep until the callback arrives?

level: juniorimportance: must knowfreq 72%
basics
~20 s

A relying party parks one short-lived record per sign-in attempt, holding the value it sent as state, the nonce, the code_verifier, which provider was used, and the page the user was heading to. The callback request itself brings back almost none of that.

open as a page

A scheduled meter-polling service holds its own machine token — why cache it instead of acquiring one per outbound call?

level: juniorimportance: must knowfreq 52%
basics
~20 s

A machine token stays valid for the whole expires_in window the authorization server granted, so one acquisition serves thousands of polls. Acquiring per call adds a round trip to every request and hammers a shared, rate-limited endpoint for nothing.

open as a page

A user disconnects your meal planner at their grocery-list provider — how does your server find out?

level: juniorimportance: must knowfreq 58%
basics
~20 s

No notification arrives. The next refresh of that user's stored grant is refused with invalid_grant, or an API call answers 401, and that refusal is terminal: mark the row dead and stop the work rather than retrying.

open as a page

At federated login, what must your server record so that a later logout notice naming a provider session identifier maps onto local sessions?

level: middleimportance: must knowfreq 45%
basics
~20 s

Record the issuer, the subject and, when the provider issues one, the provider session identifier on every local session row you create at login. Without that index an arriving logout notice names nothing you hold, and your endpoint can only discard it.

open as a page

Your service can run its own OAuth 2.0 authorization server or rent a managed one — what does each choice leave your team to operate?

level: middleimportance: must knowfreq 52%
basics
~20 s

Renting moves the login path's uptime, its abuse handling and most of its key custody onto someone else; running your own leaves you all three plus the on-call rotation behind them. Neither choice moves your obligation to show who consented to what.

open as a page

On a claims desk, why must an acting-as session carry both the supervisor acting and the adjuster acted for?

level: juniorimportance: must knowfreq 50%
basics
~20 s

An acting-as session has two principals: the actor doing the work and the subject whose authority is being used. Carry only the subject and every record reads as the adjuster's own work, so nothing shows who really acted.

open as a page

Why does an authorization check placed only in the HTTP handler miss the nightly job and e-mail intake that also close tickets?

level: juniorimportance: must knowfreq 66%
basics
~20 s

A check in the HTTP handler only runs when a request reaches that handler. A scheduled job, a message consumer or an import script call the ticket-closing code directly, so the guarded path is simply not on their route.

open as a page

A booking service serves many charterers — where does the server get the charterer identifier for a request, and why never from the request body?

level: juniorimportance: must knowfreq 70%
basics
~20 s

The charterer identifier must come from something the caller cannot rewrite: a claim in the verified credential, the hostname the request arrived on, or a header the edge sets and strips. A body field is caller-controlled input.

open as a page

Why does an application store permissions as resource-action strings like establishment:inspect rather than one boolean column per feature?

level: juniorimportance: must knowfreq 72%
basics
~20 s

A permission string names one resource and one action together: establishment:inspect is the inspect action on establishment records. Keeping permissions as rows makes capability data rather than schema, so adding one is an insert instead of a new column and a deployment.

open as a page

In relationship-based access control, what does one relation tuple `object#relation@subject` record, and what replaces a role column?

level: juniorimportance: must knowfreq 45%
basics
~20 s

A relation tuple records one fact — this subject holds this relation on this object, written object#relation@subject. Permission becomes the set of stored tuples plus the schema's rules about which relations imply which, instead of a role value stored on the user row.

open as a page

A donor portal emails a one-time sign-in code. What does the server write down so it can verify it later?

level: juniorimportance: must knowfreq 58%
basics
~20 s

A pending-attempt record on the server: a digest of the delivered code, the sign-in attempt it belongs to, an expiry a few minutes out, a consumed marker, and the count of failed guesses against it.

open as a page

Why is an authenticator app's shared secret stored in recoverable encrypted form rather than hashed like a password?

level: juniorimportance: must knowfreq 62%
basics
~20 s

A time-derived code is recomputed by the server from the shared secret and the clock, so it must hold that secret itself, not a digest. Encrypting it at rest protects it from a database read, and nothing more.

open as a page

Why must your server generate a passkey ceremony's challenge itself and accept each one only once?

level: juniorimportance: must knowfreq 62%
basics
~20 s

A passkey challenge is what makes each ceremony unrepeatable. The server generates it randomly, holds it against one pending ceremony and spends it on use, so a captured response cannot be replayed. The specification requires unguessable entropy and recommends at least 16 bytes.

open as a page

On a remembered device a sign-in skips the second factor — what does the server store per device, and what is that token bound to?

level: middleimportance: must knowfreq 55%
basics
~20 s

A remembered device is its own server-side record — account, a hash of the issued value, issue time, absolute expiry — and the value it hands the browser is bound to one account and one browser profile, never to a person.

open as a page

A donor portal leaves every sign-in code it has sent valid until expiry. What does that cost the attempt cap?

level: middleimportance: must knowfreq 55%
basics
~20 s

Every simultaneously valid code multiplies an attacker's odds per guess. A cap of five guesses against one live six-digit code is about five chances in a million; twelve live codes make the same cap worth sixty in a million.

open as a page

A booking tool's account row carries one identity-provider column. What does replacing it with a separate identity table buy, and what does it cost?

level: middleimportance: must knowfreq 45%
basics
~20 s

A child identity table of (issuer, subject) rows, uniquely constrained on both columns together, lets one account be reached by several sign-in routes. It costs a lookup on every federated sign-in and a last-route rule the schema cannot enforce.

open as a page

With only an email address typed at sign-in, how do you route the person to the right brand's identity provider?

level: middleimportance: must knowfreq 48%
basics
~20 s

Take the domain from the typed address, look it up in a table of domains a tenant has verified, then follow that tenant to its identity-provider connection record and redirect. An unmatched domain falls back to local sign-in.

open as a page

Your federated sign-in tests install an already-authenticated principal in the harness — which part of the integration stays unexercised?

level: middleimportance: must knowfreq 40%
basics
~20 s

A helper-installed principal leaves the whole validation path unexercised. The test starts after the assertion would have been parsed, its signature checked, its audience and validity window enforced and its identifier recorded — so every rejection rule the service provider owns is untested.

open as a page

When you stand in for a venue operator's identity provider in tests, why must the stand-in really sign its assertions?

level: middleimportance: must knowfreq 33%
basics
~20 s

Because the checks worth testing are rejections, and a stand-in that does not sign cannot produce a message that is signed by the wrong key. Holding a test keypair lets the suite mint both the accepted message and every rejected variant of it.

open as a page

In a shared driver-hours system whose records are a legal archive, what does deleting a departed driver's account cost that deactivating it does not?

level: middleimportance: must knowfreq 55%
basics
~20 s

Deleting destroys attribution: the hours entries, corrections and approvals the driver authored can no longer be resolved to a person, and the identifier could later be handed to someone else. Deactivation keeps the identity resolvable while ending sign-in.

open as a page