Bite-sized, standalone interview questions and answers for Security. Read 5-10 per sitting. Each answer is 2-4 sentences max and stands on its own.

78 questions shown. Filter by keyword or difficulty below.

Topic: JWKS discovery and key rotation (Order 0)

Baking keys into config creates a rotation nightmare — rotating a compromised or aging signing key means redeploying every independent verifier simultaneously, which is impossible once there are more than a handful. JWKS discovery lets verifiers fetch keys from a well-known endpoint (/.well-known/jwks.json) on demand, so the issuer can rotate keys by adding a new one to the published set without touching any verifier’s configuration.

Hydra’s AddKeySet only inserts new rows — the old key’s public half stays in the published JWKS so tokens signed with the old kid still verify. If you delete the old key before every token it signed has expired, those live tokens immediately fail verification even though they’re still within their validity window. Rotation is a two-step, time-boxed process: add first, delete later only after all tokens signed by the old key have naturally expired.

An attacker crafts a token with alg: HS256 in the header, targeting a verifier that expects RS256. If the verifier naively uses whatever alg the token claims and reuses its RSA public key as an HMAC secret, the attacker can forge a validly-signed token because public keys are public by definition. Prevention: the verifier must pin the expected algorithm server-side and never trust the token’s own alg header — only verify using the algorithm the verifier was configured to use.