MCQ-14`billing-api` verifies JWTs by reading `alg` and `kid` from the header, loading the matching key from the IdP's JWKS, and calling the library's verify function with that key and the header's `alg`. For `HS256`, the library uses the key's PEM bytes as the HMAC secret. A pen test sends a token with `alg: HS256`, the IdP's real `kid`, and a signature that is HMAC-SHA256 over the signing input keyed with the IdP's public key PEM; `billing-api` accepts it. Which change rejects this token?⌄
MCQ-23A pen test of a multi-tenant SaaS API found that a tester holding a valid token for one tenant could read another tenant's records by changing the id in the URL path. The team can add one assertion per endpoint to CI. Which assertion catches this class of bug?⌄
MCQ-1A multi-tenant billing API exposes `GET /api/v2/invoices/{invoice_id}`. The handler verifies the JWT (signature and expiry) and then runs `SELECT * FROM invoices WHERE id = ?` with the path parameter. A tester holding a valid token for tenant 7 requests `/api/v2/invoices/8842` and gets HTTP 200 with the full body of an invoice belonging to tenant 9; the same request for `/api/v2/invoices/999999` returns 404. Which change closes this finding?⌄
MCQ-19A service registers POST /v1/admin/jobs/rebuild-index, an admin-only operation that rebuilds every tenant's search index. The single guard in front of the route verifies the bearer token's signature, expiry, issuer and audience, then calls the handler. In staging, a trial account's genuine token - role claim "user", no admin scope - starts a full rebuild. Which flaw does the route have?⌄
MCQ-2A payments service validates bearer JWTs at its edge against the issuer's JWKS. A request arrives for `POST /v1/refunds` carrying `Authorization: Bearer eyJ...`; the signature verifies, `exp` is 25 minutes in the future, and the `scope` claim is `payments:read`. The route requires `payments:write` and appears in the service's public OpenAPI spec. Which response should the service return?⌄
MCQ-22A 900-person company runs one RBAC deployment shared by every environment and tenant. Users can hold several roles at once, roles are edited in place when a permission changes, permissions are bundled into coarse job-function grants rather than one per endpoint, and the org chart has been stable for two years. Over eighteen months the role count grew from 40 to 310, and most of the new roles differ from an existing role by exactly one permission. Which mechanism accounts for the growth?⌄
MCQ-18A document service lets users share folders with individuals and with teams. Folders nest, and a share on a folder must cover every document inside it, including ones added later. Removing someone from a team must revoke their access to everything that team was shared with, without editing each document's permission record. Which access control model fits this requirement?⌄
MCQ-24When an API endpoint is protected and a client attempts to access a resource that does not exist, which HTTP status code choice, 404 Not Found versus 403 Forbidden, is typically made to prevent information disclosure, and what is the resulting trade-off?⌄
MCQ-6A team issues 15-minute RS256 access tokens that 40 services validate offline using a cached public key. Support disables a compromised account at 10:00:00; the token issued at 09:58:00 is still accepted by every service until 10:13:00. Which property of the design produces that window?⌄
MCQ-21An API issues 15-minute access tokens as JWTs validated by signature alone, no per-request lookup against a session store, plus 30-day refresh tokens held server-side. A user logs in at 09:52. At 10:00 an attacker copies the user's access token out of a misconfigured request log. At 10:05 the team notices and deletes the user's refresh token record. Until when can the attacker keep calling the API with the copied token?⌄
MCQ-25A SaaS product issues session tokens as HS256 JWTs carrying a 24-hour `exp` and a unique `jti`. The API validates the signature and `exp` on each request and never reads the `sessions` table. At 09:00 a user's laptop is stolen; support deletes that user's row from `sessions` at 09:05, but the attacker's requests keep succeeding until the token expires at 08:00 the next morning. The team needs revocation to take effect on the attacker's next request without logging out any other user. Which change does that?⌄
MCQ-15A team's authorization server issues one access token per user session, and the client sends that same token to the profile, billing and admin APIs, which all sit behind one resource server and one audience. A token leaked from a crash log and was replayed against the admin API. The team cannot shorten token lifetime, add client authentication, or force every user to sign in again. Which change to how the token is issued actually bounds what the leaked token can do?⌄
MCQ-10A single-page app authenticates users against an OIDC provider and calls `https://api.example.com`. The API verifies each bearer token's signature against the provider's JWKS and requires `aud` to equal `https://api.example.com`; the team wants that check unchanged. The SPA sends the token from the `id_token` field of the token response as `Authorization: Bearer <token>`. Every call returns 401, and the API's logs show the audience check rejecting the token. Which change makes the calls succeed?⌄
MCQ-13A nightly reconciliation job runs unattended on a server with no browser and no human available. It must call a partner's API to read the company's own settlement records, not any end user's data. The partner's authorization server supports the authorization code, device authorization, client credentials and refresh token grants. Which grant should the job use to obtain its access token?⌄
MCQ-16A crash-reporting SDK in your iOS app uploaded a request body containing a user's plaintext password to a third-party service. The app signs users in by POSTing their username and password to your /token endpoint with grant_type=password, and users must stay signed in for weeks without re-entering credentials. Which change removes the password from the app's process and keeps that long-lived session?⌄
MCQ-3A scheduling app syncs each user's Google Calendar every 15 minutes, including overnight when the user is offline. Today it asks for the user's Google password, stores it, and calls the Calendar API with it. A security review blocks the launch: a breach would expose each user's entire Google account, and a user cannot revoke just this app. Which change fixes that and keeps the background sync running?⌄
MCQ-4A native app uses authorization code flow with PKCE (S256). Its code_verifier is a constant string compiled into the app, identical on every install. A malicious app on the same device extracts that string from the app package, registers the app's custom redirect scheme, and captures the authorization code when the user signs in. It POSTs the code, the same client_id and redirect_uri, and the extracted verifier to the token endpoint before the legitimate app redeems it. What does the token endpoint return?⌄
MCQ-5A single-page app at https://app.example.com runs the authorization code flow with PKCE and is registered as a public client with no secret. Its entry module executes `const verifier = randomVerifier()` at module scope, derives `challenge = BASE64URL(SHA-256(verifier))`, and redirects the browser to the authorization server with `code_challenge=challenge&code_challenge_method=S256`. The server issues codes with a 60-second lifetime and redirects back to `https://app.example.com/callback?code=...&state=...`, which loads the app document again. The app then POSTs `grant_type=authorization_code&code=...&code_verifier=verifier` to the token endpoint and gets HTTP 400 `{"error":"invalid_grant"}`. The verifier is 64 characters, the code is 15 seconds old, and the redirect URI matches the registered value exactly. What explains the error?⌄
MCQ-9A server-rendered page is served at `https://app.example.com/orders?access_token=<opaque>`. The page loads `https://app.example.com/assets/app.js`. The request for `app.js` has the target `/assets/app.js` with no query string, no `Authorization` header and no cookie, and the page's HTML contains no token. The site sets no `Referrer⌄
MCQ-12A multi-tenant Postgres 15 API serves `GET /invoices/{id}`. RLS is enabled on `invoices` with `USING (tenant_id = current_setting('app.tenant_id')::uuid)`. A middleware runs `SET app.tenant_id = '<uuid>'` for the authenticated caller, then the handler opens its own transaction and runs `SELECT * FROM invoices WHERE id = $1`. Connections come from a pgbouncer pool in transaction mode, size 20. Under load about 1 request in 20 returns another tenant's invoice; the same traffic against a pool of one connection never does. What explains the leak, and what fixes it?⌄