Skip to content
Tech Interview Prep
Technical interview guide

Identity & Access Management (IAM) Design

Designing identity, roles, and access policies across an entire organization, not just one system.

Minutes to read
4
Practice MCQs
25
Interview Q&A
25
Edition
v5
Editorial status
Reviewed
Relevant for
Security Architect

Scope: NIST SP 800-63-4 suite (final July 2025); SCIM RFCs 7643/7644; OAuth Security BCP RFC 9700 (January 2025); OpenID Connect Core 1.0.

Interview Q&A

Treat each question like a live interview question: answer out loud first (structure, assumptions, tradeoffs), then open the model answer to spot gaps and rehearse a tighter follow-up.

Curated: · Written: · Reviewed:

25 questions

Q&A-1

Design an enterprise IAM operating model.

Answer

Assumptions first: ~5,000 employees, ~20,000 contractors and B2B partner users, hybrid Active Directory plus AWS and Azure, SOX in scope. If you are 200 people with no regulator, skip to the last section.

The model in one breath: three planes, one accountable owner each. Identity plane: HR is the authoritative source and everything downstream is derived from it. Entitlement plane: the IAM team owns the catalog and the policy engine, resource owners own the grant criteria. Enforcement plane: the resource itself decides, deny by default. Audit sits outside all three and reports to Internal Audit, not to the IAM team.

Why that split: authentication is a commodity with settled standards. OIDC Core 1.0, SAML 2.0, SCIM 2.0 (RFC 7643 for schema, RFC 7644 for protocol), so centralizing it buys one place to enforce MFA and one place to revoke. Authorization is not a commodity. The resource owner holds the context (which record, which tenant, which time of day), and a central team guessing at it produces either over-granting or a queue. Centralize authentication and provisioning; federate authorization decisions.

The trace that decides the design. HR marks a termination in Workday at 14:00.

T+EventEffect
0Workday termination—
2 minSCIM 2.0 push to Entra IDaccountEnabled=false
2 minnew sign-insblocked
up to 60 minalready-issued access tokensstill valid: Entra ID's default access token lifetime is 1 hour
~minutesCAE-enabled resources (Exchange Online, SharePoint Online, Teams, Graph)reject on the user-disable event
up to 24 happs with no SCIM, caught by reconciliationrevoked

That table is the argument for measuring revocation as two numbers, not one: time-to-block-new-sessions (target p95 ≤ 15 min) and time-to-no-valid-credential, which is bounded by token lifetime. Shorten access token lifetime to 15 minutes for privileged apps, or accept the 1-hour tail and write it into the risk register.

Trade-offs, and when not to do this.

RBAC versus ABAC: RBAC for stable job families, ABAC for context. Pure RBAC across 5,000 people produces role explosion: allow per-team roles and you get hundreds of roles nobody can review. Use RBAC as the base grant and ABAC as constraints on top (device compliance, network, data classification).

Standing versus JIT privilege: standing admin is the blast-radius driver. JIT elevation for 1–4 hours, peer approval, auto-expiry, no standing domain admin. Target under 5% of admins holding standing privilege.

Build versus buy: buy the IdP and the governance layer (Entra ID Governance, Okta, SailPoint, Saviynt); build only connectors for systems that lack SCIM.

Do not do this under ~200 people: the governance platform costs more than the risk it retires, and IdP groups plus a quarterly manual review is the right answer. Do not centralize authorization for systems with hard latency budgets or offline operation (factory floor, trading engines): federate identity, keep enforcement local.

Failure modes and how you see them.

  • Orphan accounts with no authoritative owner: weekly reconciliation diff of IdP against app accounts; target under 1%.
  • Entitlement sprawl, grants never retired: track the share of grants not reviewed in two cycles.
  • Rubber-stamp reviews: a campaign that revokes 0% is not evidence; track revocation rate per campaign.
  • Shared admin accounts: count accounts not bound to a named human; target 0, break-glass sealed and alerted on use.
  • Group nesting deeper than 3: transitive membership makes review meaningless; cap and measure depth.

Review load, honestly. 300 privileged users × 20 entitlements = 6,000 grants per quarter. At 30 seconds each that is 50 person-hours: real, and the reason you scope reviews to privileged and high-risk entitlements rather than everything.

Metrics that fund the next sprint: share of accounts with an authoritative owner, revocation p95 (both numbers above), orphan share, standing privilege share, review revocation rate, access-incident MTTR. Enrollment counts measure nothing.

Curated: · Written: · Reviewed:

Difficulty: Hard
Q&A-4

Create an enterprise role and entitlement model without role explosion.

Answer

Assumptions. An IdP (Entra ID, Okta) holds identities and groups; a policy engine evaluates at request time (AWS IAM, OPA/Rego, or a Zanzibar-style relationship store such as OpenFGA or SpiceDB); an auditor requires periodic recertification. The real question is not "how do we model roles" but "which axis is allowed to grow".

What a strong candidate says in the first 90 seconds. Use three fixed layers plus a request lane, and let only the first two be roles.

  1. Baseline - one role every employee gets: SSO, MFA enrolment, directory read, ticketing, intranet. Cardinality 1.
  2. Functional - one role per job function, defined from the resource actions that job actually performs, not from org titles. Cardinality equals the number of distinct permission sets, which is dozens in most enterprises, not thousands.
  3. Contextual - tenant, region, environment, data class, ownership, evaluated as conditions at request time. Cardinality is attribute values, not roles.
  4. Exceptional - rare or privileged access granted as a time-bound request against a functional role (Entra PIM, or a JIT broker), never as a new role.

Role count then grows with the number of distinct permission sets. Adding 1,000 users or one new region adds zero roles.

Why this is what stops explosion. Encoding (job, region, environment, data class) as roles multiplies factor cardinalities; carrying them as attributes adds them. Hypothetically: 25 job functions * 6 regions * 3 environments * 2 data classes = 900 combinations, so 900 roles if encoded, 26 roles if attributes carry the context. Same policy intent, different algebra.

A permission bundle also has a physical ceiling. AWS IAM attaches 10 managed policies to a role by default (adjustable to 20) and caps a managed policy at 6,144 characters, so you cannot dodge factoring by building one enormous role - the engine forces a split. The design choice is only where the boundary sits: in the role catalog, or in the condition. Each role also costs its owner a review every cycle. A 5,000-role catalog reviewed quarterly is 20,000 decisions a year; at one minute each that is about 330 hours, roughly eight weeks of one reviewer's time.

A decision trace. Alice is a Tier-2 support engineer in the EU; identity attributes are department=support, tier=2, region=eu. She holds baseline plus support_engineer. She requests read on customer_record 88213. The engine reads resource attributes: region=eu, data_class=pii, owner_team=support. The support_engineer role grants read on customer_record where resource.region == identity.region and resource.data_class in {public, internal}. pii is not in that set, so the decision is deny, and the engine opens a four-hour JIT grant routed to the data owner. No role named eu_support_tier2_pii exists, and none needs to.

Failure modes and how each is detected.

failuresignalresponse
god roleentitlement count per role, read from the policy storetail of the histogram; over ~200 entitlements, or one role held by more than 5% of headcount, split into functional role plus conditions
orphan roleassigned identities and policy evaluations over the last 90 dayszero assignments and zero evaluations means retire
role hierarchy cyclebuild-time cycle detection over the inheritance graph (hierarchical RBAC, INCITS 359)any cycle blocks the build; effective permissions become order-dependent
attribute sprawlattribute catalogue carrying owner and last-evaluated timestampattribute unused for 180 days and unowned gets removed
rubber-stamped recertificationapproval latency per line item in the review toolmedian under about 5 seconds on a 200-line review means bulk approve; shrink reviewer scope and pre-revoke unused entitlements before the review
stale JIT grantsactive grants past expiry in the broker's own tableany nonzero trips an alarm; reconcile grants against the IdP hourly

Trade-offs. Fewer roles means more policy logic, and that logic becomes code: versioned, tested, deployed through bundles (OPA) or XACML 3.0 policies. Attribute predicates are harder for a non-engineer reviewer to read, so name them and keep them small. Zanzibar-style relationship stores (Google, USENIX ATC 2019; OpenFGA, SpiceDB) model ownership and nesting well but add a dependency whose consistency model has to be understood before it sits on the request path.

Role mining is input, not output. Mine candidates, then measure permission utilization - the share of a role's entitlements exercised in the last 90 days. A mined role with low utilization is historical overgrant rather than a requirement. Validate the survivors with resource owners, not managers alone.

Curated: · Written: · Reviewed:

Difficulty: Hard
Q&A-2

Design joiner, mover, and leaver automation across hundreds of applications.

Answer

Assumptions I'd state first

  • HR (Workday, BambooHR) is authoritative for employment state. App owners are not.
  • "Hundreds of apps" means roughly 70–80% speak SCIM 2.0 (RFC 7643/7644), OIDC or SAML; the rest are LDAP-bound or manual.
  • Policy clock: privileged access revoked within 15 minutes of the HR event, standard access within 24 hours. NIST SP 800-53 AC-2(3) requires disabling accounts when authorization ends; the clock is yours to set.

The 90-second answer

  1. One identity record, one event log. Normalize every HR/vendor event into a record keyed by a stable worker ID: type, sponsor, org, role, start/end, confidence. Everything downstream is derived from it; nothing downstream writes back.
  2. Two speeds. Leavers take a fast path: revoke now, reconcile later. Joiners and movers take a slow path: provision, then reconcile.
  3. Idempotency by key, not by hope. Every action is keyed (workerId, appId, entitlementId, desiredState, eventVersion). Replaying an event is a no-op.
  4. Reconcile intent vs target vs effective. Hourly, compare what HR says, what the app's directory says, and what a live token actually grants. Drift opens a ticket; it does not silently self-heal.
  5. Exceptions are debt. Every manual target and every high-risk grant carries an owner and an expiry date.

Leaver revoke order

#ActionKillsResidual window
1Disable IdP account, revoke refresh tokensnew logins, token refreshalready-issued access tokens live until expiry (assume 60 min)
2Kill sessions: OIDC Back-Channel Logout, or Okta DELETE /api/v1/users/{id}/sessionsbrowser SSO sessionsapps without back-channel logout keep local sessions
3Revoke privileged elevation (PAM checkout, break-glass)standing adminAD's default Kerberos TGT lifetime is 10 hours
4SCIM PATCH active=false to app-local accountsapp-local loginapps on a slow provisioning cycle
5Transfer owned resources: mailbox, repos, groups, service accountsorphaned ownershipnone if the transfer is atomic
6Retain or delete records per policy——

Step 4 is the one people get wrong. SCIM PATCH is RFC 7644 §3.5.2:

JSON
{"schemas":["urn:ietf:params:scim:api:messages:2.0:PatchOp"],
 "Operations":[{"op":"replace","path":"active","value":false}]}

Entra ID's outbound provisioning cycles on the order of 40 minutes (Microsoft documents ~40 min between cycles), so a leaver's app access can outlive the HR termination by that long unless you push a targeted revoke rather than waiting for the cycle.

Worked trace: mover (hypothetical figures)

Engineer moves Payments → Fraud. HR event 09:00 Tuesday, effective 09:00 Wednesday.

  • Current: 19 entitlements. Fraud baseline: 12. Overlap: 7.
  • Add 5, remove 12, retain 7. Check: 19 − 12 + 5 = 12. ✓
  • SoD check finds Payments prod-write + Fraud case-read is a conflict. That one is removed at 09:00 Tuesday, not at effective time. A conflict is not a continuity risk.
  • The other 11 removals wait for the effective timestamp; the 5 additions land Tuesday so the pager and prod-read are live before the old role ends.
  • 3 apps have no SCIM. They open tickets with a 24-hour SLA and appear on the manual-debt list.

Failure modes

Target outage: queue with exponential backoff and a cap, then alert. Partial success: track state per entitlement, never per user. A user is not "provisioned" if 3 of 12 grants failed. Duplicate or late events: dedupe on event ID and order by event timestamp, not arrival time. Rescinded events: a compensating event, never a delete of history.

What would change this design

If HR is not authoritative, or events arrive late and out of order, event versioning and last-writer-wins-by-timestamp become the whole problem. If a regulator sets a 1-hour clock for privileged access, the fast path stops being optional. If more than ~30% of apps are manual, buy a credential broker or vault instead of writing more connectors.

Curated: · Written: · Reviewed:

Difficulty: Hard
Q&A-3

Design a resilient SCIM provisioning integration.

Answer

First thing I'd pin down is who owns the identity. The HR system or IdP is the source of truth for the person; the app owns nothing about the person but owns its own authorization. SCIM carries the provisioning half only: it never carries entitlements the app derives itself.

Then the wire contract. SCIM 2.0, RFC 7643 for the schema and RFC 7644 for the protocol, content type application/scim+json. One tenant per endpoint, one credential per tenant, scoped to the operations we actually use. I'd read /ServiceProviderConfig before writing any code, because it tells me whether the provider supports PATCH, ETag, filter and bulk, and what maxOperations and maxPayloadSize are. Those change the client design, not the other way round.

Identity correlation is where most integrations break. externalId is client-defined and the server isn't required to enforce uniqueness on it, so I don't use it as a lookup key unless the provider documents filter support for it. Instead I keep a local mapping table: source stable ID → SCIM resource id, populated on create. Create is POST, and only after a filter lookup on userName comes back empty. If two workers race, the loser gets 409 with scimType: uniqueness: that isn't an error, that's the correlation resolving itself. Re-read and adopt the existing resource.

Updates: PATCH with PatchOp, not PUT. PUT replaces the whole resource, so any attribute the app added gets wiped. Concurrency: if the provider returns meta.version, send If-Match on the update; on 412 re-read, re-apply, retry once. If there's no ETag support, serialize per-identity in the worker so two events for the same user never overlap.

Lifecycle. Deactivate is active: false, not DELETE. DELETE is idempotent in SCIM and a 404 means already gone, so treat it as success, but it also destroys the mapping and the audit trail, and rehire then becomes a create with a new id. So: deactivate on leave, delete only on erasure requests. Group membership is PATCH on members with add/remove ops. Nesting is provider-dependent, so I check whether the provider returns nested groups before assuming a parent group grants child membership.

Failure handling. 429: honor Retry-After exactly, and back off exponentially otherwise. 1s, 2s, 4s, capped at 60s, ±20% jitter, five attempts, then park the identity in a dead-letter queue. A timeout is not a failure: the write may have landed, so retry is a re-read plus idempotent re-apply, never a blind POST. 400 with scimType: invalidValue is a schema problem with that one payload: quarantine that identity, alert, keep processing the rest of the batch. Pagination: pin count explicitly, 100 is the common cap, and loop on startIndex until totalResults is consumed; don't trust the default.

Then reconciliation, because SCIM is eventually consistent and events get lost. A nightly job pulls the target's users and groups, diffs against source desired state, and reports drift: missing, extra, attribute mismatch, membership mismatch. That job is also the rollback path: if a bad batch goes out, the diff tells you exactly what to restore.

What I'd test before trusting it: duplicate create race, out-of-order deactivate-then-update, provider 500 mid-batch, expired credential, and a rehire. And I'd watch lag, time from source change to target convergence, alerting when p95 crosses, say, 15 minutes, plus a count of quarantined identities.

Curated: · Written: · Reviewed:

Difficulty: Hard
Q&A-13

Govern nested groups and dynamic membership rules.

Answer

Assumptions: Entra ID is the identity source of truth, security groups are the unit of access, downstream apps receive membership over SCIM, and there is a hybrid on-prem AD. If your IdP is Okta or Google, the nesting rules change: see the table.

The 90-second answer. Govern this by making effective membership computable and every edge owned. Three rules carry it: every group has an owner, a purpose and a named source of truth; nesting is bounded and acyclic, and dynamic groups are leaves; and the effective membership plus the path to each entitlement is computed and displayed, never inferred. Dynamic rules are right for broad, low-privilege populations and wrong for privileged access, because a single attribute edit silently grants or revokes.

Mechanism. An Entra ID dynamic rule evaluates attributes on the user or device object, for example:

user.department -eq "Sales" -and user.accountEnabled -eq true

The engine reads object attributes, not group membership. That is why Entra ID refuses to add a dynamic group as a member of another group: there is nothing for the rule to evaluate. Dynamic groups are therefore leaves in the nesting graph: a structural constraint you design around, not a policy you enforce through review.

Recomputation is asynchronous. Microsoft documents that a rule change can take up to 24 hours to fully settle, so a dynamic rule is not a just-in-time grant. If you need access in seconds, dynamic membership is the wrong tool.

Where platforms differ.

PlatformNestingDynamic group as a member?
Entra ID security groupyesno: rejected
Entra ID Microsoft 365 groupnon/a
Oktaflat, no nestingn/a
On-prem ADyesno native dynamic groups

Because Okta groups are flat, "nesting" there is really app assignment or a group rule; don't model a hierarchy the platform cannot express. On-prem AD has no dynamic groups at all, so a rule-driven population has to be materialized by a sync job, and that job is now a source of truth you must own.

When not to use dynamic membership. Don't put privileged groups behind a rule. A department change or a mistyped attribute grants admin with no human in the loop. Use assigned membership plus PIM and approval for anything privileged. Don't use a rule whose attribute comes from an unowned or lagging feed, if HR's termination feed is three days behind, the rule keeps granting for three days.

Failure modes and detection.

  • Stale attribute: HR terminates, the feed lags, the rule still grants. Track the last-sync timestamp of every attribute a rule depends on and alert when it exceeds your freshness budget.
  • Cycle: A→B→A makes naive recursion non-terminating and inflates group claims. Detect with a nightly graph walk that alerts on any back edge.
  • Token bloat: deep nesting inflates the group claims in a token until logon fails. Monitor claim count per user and alert before the ceiling.
  • Target truncation: a SCIM target caps or drops nested members. Source has 5,000, target has 4,200. Reconcile effective target membership against source and alert on the delta.
  • Owner loss: the owner leaves and no one can approve. Alert on groups with zero active owners.
  • Manual target grant: someone assigns access directly in the app, bypassing the group. Reconcile target entitlements against group-derived entitlements.

Worked trace. User U has department = "Sales". U matches dynamic group All Sales (rule v7). All Sales is a member of Sales App Users (assigned). Sales App Users grants app role SalesRep. Effective path: U → All Sales (dynamic, rule v7) → Sales App Users (assigned) → SalesRep. U moves to Marketing. The rule no longer matches; U drops out of All Sales and loses SalesRep, but only after recomputation, up to 24 hours later. That window is why the access review must show the transitive path and let the owner remove the correct edge, and why you retain the rule version and the resulting population for audit.

Curated: · Written: · Reviewed:

Difficulty: Hard
Q&A-5

Design an access-request and approval workflow.

Answer

Clarify before designing. Is this workforce access to internal systems behind SSO/SCIM, or customer-facing entitlement grants? I'll assume workforce: ~5,000 employees, one IdP (Okta or Entra ID) as source of truth, most targets federated via SAML/OIDC with SCIM 2.0 (RFC 7643/7644) provisioning, and a handful of legacy systems with no API. If it's customer entitlements, the approver model changes and I'd say so up front.

Assumptions that decide the design: every grant is time-bound; approvers are named humans with recorded authority, not groups that can resolve to the requester; and the IdP, not the ticketing tool, is the system of record for who has what.

The core answer. Model four separate states, because conflating them is where these systems break: decision (approval), instruction (the versioned grant), effect (provisioning), verification (effective access). Approval is a decision, not access. A request flows request → policy evaluation → approval → provisioning → verification, and only verification closes it. A grant instruction that was approved but never provisioned is a silent failure, not a success.

Policy evaluates first. Low-risk, job-aligned requests, read-only to a system already inside the requester's department, auto-approve with a 90-day expiry. Anything touching PII, production write, or a toxic combination routes to the resource owner plus a second approver outside the requester's reporting line. That second approver exists because of NIST SP 800-53 AC-5 (separation of duties): the same person must not hold both halves of a conflicting pair, e.g. "create vendor" and "approve payment."

Risk tierApproval requiredMax durationTarget decision SLA
Low (read-only, in-dept)Policy auto-approve90 daysinstant
Medium (PII read, non-prod write)Resource owner30 days1 business day
High (prod write, admin, SoD pair)Owner + independent approver8 hours, JIT4 hours
Break-glassNone pre-grant; post-hoc review4 hoursreview within 24 h

The 8-hour high-tier cap matches the default maximum activation duration in Entra ID PIM; AWS IAM Identity Center sessions default to 1 hour and cap at 12. Pick one and enforce it in the IdP, not in the request form.

Trace of one request. 09:02 requester submits "prod-write to billing-api, 4 h, incident #4412." 09:02 policy flags SoD conflict with their existing "refund-approve" entitlement and routes to owner + independent approver. 09:14 owner approves with justification; 09:31 second approver approves. 09:31 grant instruction v1 written, idempotency key = request ID. 09:32 SCIM PATCH returns 200; IdP session issued with 4 h expiry. 09:33 verification job reads effective access from the target and matches it to the instruction; request closes. 13:32 session expires; 13:35 reconciliation confirms the entitlement is gone.

Failure modes, with detection and resolution.

  • Approver absence. Detect: pending-request age exceeds the tier SLA. Resolve: time-boxed delegation to a named backup with the same authority, expiring in 7 days. Never a standing "any admin" group.
  • Target provisioning failure. Detect: SCIM returns 4xx/5xx, or the reconciliation job finds instruction ≠ effective access. Resolve: retry with backoff, alert the owner after 3 failures, and never mark the request complete on approval alone.
  • Changed employment. Detect: HRIS termination event not reflected in the IdP within 15 minutes. Resolve: reconciliation between HRIS and IdP, auto-revoke all grants on termination.
  • Break-glass. Detect: alert on any break-glass grant. Resolve: 4-hour auto-expiry plus mandatory post-hoc review within 24 hours.
  • Stale or cancelled requests. Detect: request TTL exceeded. Resolve: expire the instruction; a cancelled request must not leave a live grant.

Sizing. 5,000 employees × ~12% requesting per quarter ≈ 600 requests/quarter, ~10 per working day. If 35% need manual approval at ~12 minutes of approver time, that's ~42 minutes/day of approver load. That number is small, so don't over-invest in the approval UI; put the engineering into the reconciliation job, which is what actually catches overgrant.

What would change my answer: if most targets have no SCIM API, verification becomes a scheduled access review (quarterly for privileged, annual for standard) rather than a per-request check, and the SLA table has to reflect that.

Curated: · Written: · Reviewed:

Difficulty: Hard
Q&A-6

Build a meaningful periodic access-review program.

Answer

The 90-second answer. A periodic access review is a control, not a spreadsheet exercise. Its job is to produce evidence that someone who knows the business need looked at each entitlement, and that the ones that shouldn't exist were actually removed from the target system. So I'd build it on three things: a risk-tiered cadence, a review packet that gives the reviewer enough context to say no, and a verified revocation path with an SLA attached to it.

Assumptions I'd state before designing anything: HR is the authoritative source feeding the IdP, entitlements are discoverable from the target systems, and there's a governance tool in place. SailPoint IdentityIQ/IdentityNow, Saviynt, Okta Identity Governance, or Entra ID Access Reviews if the estate is Microsoft-only. If entitlements aren't discoverable, the first project is discovery, not review.

Cadence by tier. Reviewing everything annually is how you get rubber stamps; reviewing everything quarterly is how you get ignored.

TierExamplesCadenceReviewerRevocation SLA
Privileged / criticaldomain admin, prod AWS admin, DB superuser, break-glassquarterly (the cadence most SOX ITGC programs use)resource owner + security24 h
Regulated datacardholder-data systems, PHIat least every 6 months (PCI DSS v4.0 7.2.4)application owner72 h
Standard business appsSaaS, file sharesannualmanager5 business days
Dormantno use in 90 days (NIST SP 800-53 AC-2(3), org-defined inactivity period)auto-flagged into the next campaignsystem ownerdisable immediately

What the reviewer sees. Identity and sponsor, employment or project context, a plain-language meaning for the entitlement, the resource/data/action it grants, the owner, grant source and date, expiry, last use, with the caveat that last-use logs only cover what's actually logged, separation-of-duties conflicts, and a peer baseline ("3 of 47 people in this job code hold this").

Decisions and routing. Approve, revoke, mitigate with an expiry date (SailPoint's mitigation decision exists for exactly this), transfer ownership, or escalate. No default approve-all on the privileged tier. Route to the person who knows both the business need and the resource impact, and never let someone certify their own access: send it to their manager or a peer owner. In Entra ID Access Reviews, set "if reviewers don't respond" to remove access rather than "no change", or silence becomes consent.

Propagation, verified. A decision is not a removal. Say the certification item is marked Revoked at T0; the AD connector runs on its aggregation schedule, and if the group is also managed by a separate provisioning rule, membership can reappear at the next HR feed. So the check is a re-read of the target at T+24h, and a reopen event if the entitlement comes back. Trusting the tool's "completed" status is how you fail the audit.

Measurement. Not completion percentage. Track revocation completion rate, mean time from decision to verified removal, the share of decisions that are "approve with no change" (above 95% across two consecutive campaigns means you're collecting signatures), orphan account count and median age, the share of entitlements with a named owner and a readable description, and reopen rate.

Sampling. Auditors re-perform decisions against the ticket, the target system, and the reviewer's stated reason. For a campaign with 1,000 decisions, a 95% confidence, ±5% sample is 278. Most teams instead stratify: every privileged and external decision, plus 30–40 random standard ones.

Failure modes to name. Rubber-stamping; the resource owner approving their own team; descriptions like SAP_ROLE_4471 that nobody can evaluate; revocations recorded but never propagated; and annual-only campaigns that let a leaver's access live for eleven months. Between campaigns, feed continuous triggers: joiner/mover/leaver events, SoD violations, 90-day dormancy, new privileged grants: into micro-certifications instead of waiting for the cycle.

Curated: · Written: · Reviewed:

Difficulty: Hard
Q&A-12

Design segregation-of-duties controls across multiple applications.

Answer

What I'd clarify first. Which applications are in scope, is the driver SOX or PCI DSS, and does the business want prevention or detection? I'd assume a mid-size landscape: an ERP, a bank portal, a cloud console, an HR system, roughly 3,000 users, SOX-relevant. The IAM team owns the platform; the business process owners own the risk and sign off the rules. That split matters, because a rule nobody in the business owns will never be tuned.

The answer. Segregation of duties is a property of business outcomes, not role names. I start by enumerating the outcomes that must never sit with one person: create a vendor and approve its payment; maintain bank details and release payment; create a user and grant entitlements. Each becomes a rule with two sides.

Then I build the effective-entitlement graph. Pull every grant path: direct grants, nested groups, roles, delegated admin, service accounts, just-in-time access, and normalize each app's native permission to a canonical action: SAP XK02 (change vendor centrally), bank portal approve_payment, AWS iam:CreateUser. Store (identity, canonical action, source path, target scope, valid_from, valid_to). The source path is what makes an alert reviewable.

Prevent at request time where the mapping is reliable: evaluate the rule against the requester's current effective set plus the requested item before provisioning. Where it isn't reliable (shared accounts, batch jobs, break-glass) don't pretend. Route to a risk-based exception with an independent approver, a compensating control (the payment still needs a second release in the bank), and an expiry date. Recompute effective entitlements nightly regardless, and diff against the rules.

A toxic combination surfacing. Priya is an AP clerk with SAP role Z_AP_CLERK, which contains FK03 (display vendor): fine. Six weeks later she's added to AD group GRP-FIN-ADMIN for a project; the IAM connector maps that group to SAP role Z_VENDOR_MAINT, carrying XK02 and FK02 (change vendor). Separately the bank portal grants her approve_payment via group BANK-AP-APPROVERS.

Nightly job computes her effective set: {XK02, FK02, BANK:approve_payment}. Rule VENDOR_BANK_CHANGE fires: side A {XK02, FK02}, side B {BANK:approve_payment}. The alert carries both grant paths, so the reviewer sees why, not just that. Time-to-detect is one nightly cycle; if the bank portal only syncs weekly, that sync is the real latency and I'd say so.

Failure modes and how I catch them.

  • Rule drift. A new SAP role contains XK02 but was never linked to side A. Detection: a coverage check that flags any role holding a canonical action in a rule's side but missing from the mapping. Cost: every new role needs a risk owner to classify it. At ~50 new roles a quarter that's real, recurring work.
  • Stale exceptions. Granted for a migration, never revoked. Detection: exception-age report; anything past expiry auto-revokes and pages the owner. Track median and p90 exception age, not the count.
  • False positives. A display-only action mis-mapped, so the rule fires on 400 users. Detection: alert-to-confirmed-conflict ratio per rule; fix or retire rules below threshold, because a noisy rule trains reviewers to click through.
  • Collusion and shared credentials. Two accounts, one human. Detection: same source IP and overlapping session window on both sides of a conflict, plus badge or terminal data where available. IAM alone can't close this.
  • Emergency access. Firefighter IDs. Detection: reconcile every session log against the change it produced; an unlogged session is the finding.

What would change the decision. If an app exposes no effective permissions (no API, no connector) preventive SoD is impossible there; fall back to detective controls on transaction logs and dual control at the business action. And if the regulator cares about a handful of outcomes, build ten rules and measure them, not a 500-row matrix nobody reads.

Metrics. Active toxic combinations (identities currently holding both sides), exception age p50/p90, control-use rate, confirmed incidents. Not matrix size.

Curated: · Written: · Reviewed:

Difficulty: Hard
Q&A-19

Detect and remediate orphaned, dormant, and excessive access.

Answer

What I'd say first

Assume an authoritative identity source (HR system or IdP) and a CMDB for resource ownership. If those don't exist, building them is the first deliverable: every finding below is only as good as the join key. Then answer in three parts: define the three classes with measurable thresholds, detect them from a graph of identity → entitlement → resource plus observed activity, and remediate by risk tier with quarantine before deletion.

Definitions with numbers

  • Orphaned: no valid owner or sponsor: the account, credential or role has no live edge to an authoritative identity or a named resource owner. A service account whose owning team was dissolved; an IAM role whose trust policy points at a deleted IdP group.
  • Dormant: no observed use inside a risk-based window. CIS Controls v8 5.3 sets 45 days of inactivity as the disable threshold for dormant accounts. AWS IAM Access Analyzer's unused-access analysis uses a 90-day activity lookback for unused roles, permissions, users and access keys. Entra ID access reviews default the inactive-user recommendation to 30 days of no sign-in. Shrink the window as privilege rises: 30 days for admin-adjacent access, 90 for standard workforce, 180+ for seasonal or contractual access where a full cycle is the unit of use.
  • Excessive: authority beyond current task or policy: a role holding iam:* where the last 90 days of CloudTrail show three read calls.

Detection

Build one graph. Nodes are identities, sponsors, accounts, credentials, groups, roles, policies and resources; edges are membership, trust, ownership and observed use (CloudTrail, Entra sign-in logs, Okta System Log). Keep provenance on every edge so a finding can be defended to the owner.

Pseudo-SQL over that graph:

SQL
SELECT e.id, e.type, e.privilege_tier, MAX(a.ts) AS last_use
FROM entitlement e
LEFT JOIN activity a ON a.entitlement_id = e.id
LEFT JOIN owner o    ON o.resource_id   = e.resource_id
GROUP BY e.id, e.type, e.privilege_tier
HAVING MAX(o.owner_id) IS NULL
    OR MAX(a.ts) < now() - INTERVAL '90 days'
ORDER BY e.privilege_tier DESC, last_use ASC;

Remediation trade-offs

The deciding criterion is blast radius if the access turns out to be needed:

OptionWhenCost of being wrong
Revoke nowOrphaned privileged credential, no owner, active sessionsOutage if a hidden dependency exists
Quarantine (disable, keep the object)Dormant but owner reachableReversible; needs a tested re-enable path
Convert to JITLegitimately needed, rarely usedRequires PIM or Entitlement Management plumbing

Sequence: quarantine first, notify the owner with a deadline (14 days is workable), then delete. Break-glass accounts are never swept: exclude them by tag and alert on any sign-in instead.

Failure modes

  • SCIM deprovisioning gap. The IdP sends active=false (RFC 7644 PATCH) and the downstream app ignores it, so the account lives on. Detect by reconciling the IdP's active-account count against each app's account count nightly; a non-zero delta is the alarm.
  • Stale break-glass. Excluded from sweeps, so it drifts. Detect by alerting on any sign-in and on credential age over 365 days.
  • Absence of use is evidence, not proof. Seasonal and emergency access looks dormant. That is why quarantine, not delete, is the default for anything with a plausible seasonal owner.

Close

Track time-to-owner-response and time-to-removal, then fix the upstream source (the connector, role or exception process that created the access) or the same findings return next quarter.

Curated: · Written: · Reviewed:

Difficulty: Hard
Q&A-14

Design delegated administration without enabling self-escalation.

Answer

Core answer, first 90 seconds

Assumptions I'd state before designing: one identity provider; admin rights carried by roles ranked T1 (org/global policy), T2 (platform), T3 (app owner), T4 (helpdesk); roughly 50 delegates across support and app teams. Under those, a delegation is safe exactly when the delegate holds no write on any object the authorization decision reads.

There are five such objects: the policy or role definition, the binding or role assignment, the membership of any group a privileged binding resolves through, the credentials of a principal above the delegate's tier, and the audit sink. Practically every self-escalation reduces to one of the five. So the rule I'd design to is: resource writes can be handed out freely, but every authorization write must either be subset-checked by the authorization service at write time, or approved by someone outside the delegate's scope.

Why a subset check carries the weight. Kubernetes RBAC is the reference implementation. Creating a Role requires the caller to already hold every permission in it, or to hold the escalate verb; creating a RoleBinding requires the referenced role's permissions or the bind verb on it, otherwise the API server rejects the request with an error along the lines of "attempt to grant extra privileges". The check runs against the object being written, so a delegate cannot author a T1 role and then use it. AWS gives a weaker version: effective permissions are the intersection of the identity policy and the permissions boundary, so a policy requiring iam:PermissionsBoundary on every role a delegate creates caps the blast radius even if the delegate writes a permissive inline policy.

Escalation pathWhy it worksControl that closes it
Rewrite the ruleEdit the role you're bound to, or author a T1 role and attach itNo write on role/policy definitions for delegates; subset check; iam:PermissionsBoundary required on created roles
Edit the bindingAdd yourself or a peer to an existing T1 bindingWithhold Microsoft.Authorization/roleAssignments/write and the RBAC bind verb; membership changes approved by a non-delegate
Mint credentialsCreate an access key or login profile for a T1 principalDeny iam:CreateAccessKey, iam:CreateLoginProfile, iam:UpdateLoginProfile on out-of-scope principals; helpdesk tool targets only its own tier
Ride a nested groupYou sit in group G, someone later adds G to a T1 bindingResolve membership and tier per request, never from cache; re-validate when group membership changes
Blind the auditStop trail logging or exclude your own actionsTrail delivered to a separate log account, SCP denying cloudtrail:StopLogging, S3 Object Lock on the sink

iam:PassRole deserves its own line: a delegate who can pass a T1 role to compute gains that role's permissions without touching any policy. Scope it by resource ARN and condition, and never with a bare wildcard.

Worked trace: L2 helpdesk resetting a password. Setup: sara is a direct member of eu-sre, and eu-sre was added to platform-admins (T1) last week, after the helpdesk delegation was created.

  1. Delegate (T4) submits a reset for sara; the helpdesk service runs under a scoped role, not the delegate's own identity.
  2. Service resolves current memberships: sara -> eu-sre, oncall-eu.
  3. Expands nested groups: eu-sre -> platform-admins -> T1.
  4. Tier check: required tier T1 is above the highest tier this delegate may touch (T4), so deny.
  5. Emits delegation_denied{reason=tier_mismatch} and an audit record in the log account: actor, target, resolved chain eu-sre -> platform-admins.

Step 3 running per request is what makes the deny correct. Cache that expansion at delegation time, a tempting latency saving, and the identical request succeeds, because eu-sre was T3 back then. That cached-membership bug is the first thing I'd test.

Trade-offs. Standing delegation with subset checks is the heaviest option: it demands a maintained list of authorization-write actions per provider, re-reviewed each API release, plus approval latency on membership changes. Below roughly 20 admins or a single account, the lighter design is usually right: delegates get resource-only rights (restart a service, read config) and all identity changes go to a three-person central team through tickets. JIT-only is the third option, no standing admin, activation with a named approver, MFA and a short cap (our PIM role settings: 2-hour activation cap). That kills long-lived credential risk but not self-escalation on its own, because a requester who can edit the role settings or the approver list approves themselves.

Failure modes and detection. Mutual escalation: two T3 delegates each able to add the other to their group reach T1 together, so build the "who can add whom" graph and reject the edge that closes a cycle. Deny-list drift: a provider ships a new action that grants role assumption and your blocklist is stale, which is why the allow-list plus boundary is primary and the deny list is only a backstop. Routine break-glass use: alert on any break-glass authentication and rotate after each use. If the delegate team also operates the audit sink, no configuration fixes it, the sink has to live in another account or under another team. The deciding condition I'd flag out loud: if the provider doesn't expose authorization writes as distinct, enumerable actions, subset checking isn't available, and the defensible design is JIT plus a narrow reviewed break-glass rather than delegation.

Curated: · Written: · Reviewed:

Difficulty: Hard
Q&A-8

Design federation for a multi-tenant SaaS application.

Answer

Core answer (say this first)

Assume a B2B SaaS where each tenant brings its own IdP (Okta, Entra ID, ADFS, Google) and small tenants use a shared one. Users belong to one tenant. We need SSO, provisioning, deprovisioning, and tenant A's IdP must never authenticate into tenant B.

Three layers:

  1. Per-tenant federation config keyed by tenant_id: protocol (SAML 2.0 or OIDC), issuer/entityID, metadata or JWKS URL, client credentials, and verified email domains. Domains route discovery only: the security decision is the (issuer, subject) pair.
  2. A broker that terminates SAML/OIDC, validates, and mints a short-lived internal token scoped to (tenant_id, user_id, aud). Downstream services only ever see the internal token.
  3. Local authorization: IdP groups map to a conservative allowlist of local roles; entitlements and object ownership are evaluated against our own data.

Validation order, and why each check exists

CheckStandardAttack it stops
Signature, algorithm pinned to RS256/ES256RFC 8725 §3.1Algorithm confusion (RS256 public key used as HS256 secret), alg: none
iss exact match to the tenant's configured issuerOIDC Core 3.1.3.7 step 2Token from another tenant's IdP replayed here
aud contains our client_id; azp when multiple audiencesOIDC Core 3.1.3.7 steps 3–5Token minted for a different app
exp/iat with a small skew allowance (60 s is typical)OIDC Core 3.1.3.7 step 9Replay of an old token
nonce matches the value stored for this requestOIDC Core 3.1.3.7 step 11Login CSRF, token injection
SAML InResponseTo, Audience, NotOnOrAfterSAML 2.0 Web Browser SSO ProfileUnsolicited assertion replay

Reject unsolicited SAML responses by default; IdP-initiated SSO is a per-tenant opt-in that accepts the replay risk.

Key rollover trace

IdP rotates its signing key. Broker caches JWKS 10 min, refetches on kid miss, rate-limited to one fetch per tenant per 30 s.

  1. IdP publishes kid=K2, keeps K1 for overlap.
  2. Token arrives signed by K2; cache has only K1.
  3. kid miss → refetch → K2 found → validate → success.
  4. Refetch fails → fail closed, alert. Never fall back to "accept any key in the set".

Detect: a spike in jwks_kid_miss_total across tenants means an IdP rotated without overlap, or our TTL is too long.

JIT vs SCIM: decide it

JITSCIM 2.0 (RFC 7644)
WhenSelf-serve, < ~500 users, no HR systemEnterprise with an HR system of record
AuthorityCreates onlyAuthoritative create/update/deactivate
DeprovisioningOn next login (user may never return)Push, minutes after HR change
ConflictFallbackWins

Rule: if SCIM is configured, it is authoritative; JIT only creates users SCIM hasn't seen. On conflict, SCIM wins and we log it. Rehire: SCIM active=true reactivates the existing (iss, sub) account. Never a second account for the same subject.

Architecture choice

Per-tenant IdP is the default for enterprise; pooled (one IdP, tenant as a claim) is cheaper but one IdP compromise is every tenant's compromise. Support SAML and OIDC behind the broker: OIDC is simpler and better on mobile, SAML is what most enterprise IdPs still speak for SSO, and normalize both into one internal token so downstream services don't care.

Account linking

Key on (issuer, subject), never email. Email is mutable and not unique across IdPs: two IdPs can assert alice@example.com for different people. Unique index on the pair; an email change at the IdP doesn't break the link.

Failure modes and detection

  • Cross-tenant issuer confusion: verify domain ownership (DNS TXT) before accepting an issuer; reject any iss not in that tenant's config. Metric: issuer_mismatch_total.
  • Domain takeover: re-verify domains every 90 days and on tenant admin change.
  • IdP outage: fail closed for new logins; existing sessions run to expiry. Break-glass tenant-admin recovery, time-boxed, audited.
  • Deprovisioning lag: cap session at 8 h, refresh at 30 days with rotation; honor SCIM deactivation by revoking sessions immediately.

Sessions and audit

Internal token: 15 min access, 8 h session, rotating refresh, scoped to (tenant_id, user_id, aud). High-risk actions (billing, admin) require step-up re-auth. Audit tenant, issuer, subject, mapping decision, result, and config version: never raw tokens.

Curated: · Written: · Reviewed:

Difficulty: Hard
Q&A-9

Secure OAuth clients and API access in an enterprise platform.

Answer

What I'd say first

Assume an enterprise platform with four client shapes: server-side services, SPAs, native mobile apps, and third-party integrations, all hitting internal resource servers through one or two authorization servers. The decision that drives everything else: authorization code with PKCE for every client, no exceptions, and confidential clients prove identity with asymmetric credentials rather than a shared secret.

Core answer

Every client gets the authorization code flow with PKCE (RFC 7636). RFC 9700, the OAuth 2.0 Security BCP from January 2025, recommends PKCE for confidential clients too, not just public ones: it costs one extra hash and closes code injection. Implicit and password grants are gone. Redirect URIs are registered exactly, string match, no wildcards, no open redirectors; the client also validates the iss parameter from the authorization response (RFC 9207) so a mix-up attack can't hand the code to the wrong AS.

Confidential clients authenticate with private_key_jwt (signed assertion, key published as JWKS) or mTLS (RFC 8705). I pick private_key_jwt when the client can't get a client certificate, most CI and container workloads, and mTLS when a service mesh already issues certs, because the same cert can then bind the access token.

Access tokens: 10 minutes, audience-restricted to one API, minimal scopes. For higher-risk paths (money movement, admin) sender-constrain with DPoP (RFC 9449) or mTLS-bound tokens (RFC 8705). Refresh tokens rotate on every use with reuse detection; public clients always rotate.

Resource servers do two separate things: validate the token, then authorize locally. Validation is issuer, audience, signature, exp/nbf, token type, required claims. Authorization is resource/action/tenant: never trust a scope alone for that.

clientauth methodaccess tokenrefresh
server-side serviceprivate_key_jwt or mTLSJWT, 10 min, aud=APIrotation, 12h
SPAnone (public)JWT, 10 minrotation + reuse detection, 8h
native appnone (public)JWT, 10 minrotation, 30d sliding
third partyprivate_key_jwtJWT, 10 min, narrow scopesrotation, per contract

Trace: resource server validating a request

Request arrives with Authorization: Bearer eyJ.... Parse the JWT header, kid=abc. Look up the JWKS (cached 10 min, refetch on unknown kid). Verify the ES256 signature. Check iss equals the AS issuer exactly, aud contains this API's identifier, exp/nbf within 60s clock skew. Then map sub + scope to local policy: does this principal have write on tenant 42? If the token is opaque instead, POST to the RFC 7662 introspection endpoint and cache the result for min(exp, 60s).

Trade-offs

JWT access tokens are self-contained, no per-request call to the AS, but revocation lags until expiry, which is why 10 minutes. Introspection gives immediate revocation but adds a network hop and a hard dependency on the AS being up; cache it. DPoP is cheaper to deploy than mTLS (no PKI) but protects only the token, not client authentication. Don't sender-constrain everything: it complicates every client for no gain on a read-only internal API.

Failure modes

  • Refresh token replay: attacker uses a stolen refresh token. Rotation with reuse detection revokes the whole token family and fires an alert; symptom is a spike in invalid_grant on refresh.
  • Mix-up: client sends the code to the wrong AS. Detect via iss mismatch; without RFC 9207 you see 400s at the token endpoint.
  • Confused deputy: token for API A replayed at API B. The audience check rejects it; log aud mismatch as a security event, not a plain 401.
  • Stolen bearer token: sender-constrained tokens make it useless; a replayed DPoP jti is rejected and logged.

Governance: client ownership, key rotation (JWKS with overlapping kids), scope review, environment separation, retirement. Monitor issuance, refresh reuse, anomalous use; test key rollover, revocation, and provider outage.

Curated: · Written: · Reviewed:

Difficulty: Hard
Q&A-10

Design identity and access for non-human workloads.

Answer

What I'd say first

Assume: workloads run on Kubernetes and VMs in one cloud, plus a few SaaS integrations; a CI system deploys them; production is a separate trust boundary from staging. The goal is that no workload ever holds a credential a human could copy.

The core: give every workload a cryptographic identity derived from something the platform can attest. The pod's service account, the VM's instance identity document, the CI job's OIDC token, then exchange that for short-lived credentials scoped to one audience. Never a static key in an image or repo.

Mechanism

Four separate steps: attestation → identity → credential → authorization.

  • Identity. SPIFFE is the standard shape. A SPIFFE ID is a URI, spiffe://prod.example.com/ns/payments/sa/ledger. SPIRE issues an X.509-SVID or JWT-SVID; the SPIRE server's default SVID TTL is 3600s and the agent rotates before expiry. The identity is bound to node/pod attestation, not to a secret the workload stores.
  • Credential. For cloud APIs, OIDC federation. GitHub Actions mints a job-scoped OIDC token; AWS AssumeRoleWithWebIdentity trades it for STS credentials, default 1 hour, max 12. Kubernetes projected service-account tokens carry an audience and expirationSeconds (default 3600), and the kubelet rotates them.
  • Authorization. At the resource boundary, not the network. IAM policy conditions on the principal's subject claim, plus resource tags. Network position (IP, subnet) is a hint, never the identity.

Trade-offs

Attestation is more work than a shared secret and only pays off when you can verify the attestor. If a workload runs where no platform identity is attestable (a legacy VM, a vendor's SaaS) you fall back to a scoped static credential in a managed secret store with rotation, and accept the weaker guarantee. Federation beats static keys because the credential's lifetime is bounded by the token exchange, so a leak expires; the cost is a hard dependency on the issuer being reachable at start-up.

Failure modes and detection

  • Confused deputy. A third party assumes your role on behalf of another customer. Require an ExternalId condition and alert on AssumeRole calls whose external ID doesn't match the tenant. Blast radius is one role's permissions.
  • Replay. A captured token reused. Short TTLs plus audience binding: a token minted for payments-api fails against ledger-api. Alert on audience mismatch in auth logs.
  • Orphaned identity. Workload decommissioned, role still active. Reconcile issued identities against deployed workloads weekly; alert on identities with no matching workload for >7 days.
  • Issuer compromise. The OIDC provider or SPIRE server is the root of trust. Alert on signing-key changes and pin the issuer's JWKS; recovery is re-issuing from a new trust domain.
  • Platform outage. The attestor is down and workloads can't get credentials. Watch issuance failure rate; mitigate with a cached credential whose TTL outlives a short outage.

Worked trace: CI job to cloud API

  1. A GitHub Actions job requests an OIDC token with audience=sts.amazonaws.com; TTL is the job's remaining runtime.
  2. The job calls sts:AssumeRoleWithWebIdentity with the token and role ARN.
  3. STS validates the signature against GitHub's JWKS, checks the sub claim (e.g. repo:org/repo:ref:refs/heads/main) against the role's trust policy, and returns credentials valid 1 hour.
  4. The job calls S3; the credential's policy allows only the bucket tagged for that environment.

If step 3's trust policy used repo:org/repo:* instead of a specific branch, any branch could assume production: the confused-deputy variant to test.

Curated: · Written: · Reviewed:

Difficulty: Hard
Q&A-11

Prevent confused-deputy and delegation flaws.

Answer

Core answer

A confused deputy is a privileged component that uses its own authority to act on a caller's request without checking whether the caller was entitled to make that request. Delegation flaws are the same bug one hop later: the credential handed downstream is broader, longer-lived, or less bound than the authority the initiator actually had. The fix is one rule: the deputy's ambient identity is never the authority. Every delegated credential is bound to the initiating subject, the exact target, the action, and a short expiry, and the deputy re-checks the caller's right to ask.

Two checks, not one: (1) may this caller ask me to act? (2) may I act on that target for that caller? Systems that only do (2) are confused deputies.

Why it happens: the canonical trace

AWS STS AssumeRole with a third-party SaaS. MetricsCo (account 111122223333) has a role in every customer account trusting its account. Customer A (444455556666) owns arn:aws:iam::444455556666:role/MetricsCoRead.

  1. Attacker B tells MetricsCo: "assume arn:aws:iam::444455556666:role/MetricsCoRead for me."
  2. MetricsCo calls sts:AssumeRole with that ARN using its own credentials.
  3. STS evaluates A's trust policy: principal = MetricsCo's account. It passes. Credentials issued.
  4. MetricsCo reads A's data, believing it is serving B.

Nothing was forged. The deputy's authority was real; the request was not. The fix is sts:ExternalId: A's trust policy adds Condition: StringEquals sts:ExternalId = a7f3c9..., a per-customer value B does not know. Step 3 now returns AccessDenied.

Binding table

Claim / controlStopsWhere
aud (audience)token minted for service A replayed at BRFC 9068 JWT access tokens
sub + actlosing the original actor in a chainRFC 8693 token exchange
sts:ExternalIdcross-tenant role assumptionAWS IAM trust policy
redirect_uri exact matchcode leaked to attacker redirectOAuth 2.0, RFC 6749 §3.1.2
audience + short TTLstolen SA token replayedKubernetes bound SA tokens
DPoP / mTLS (cnf)bearer token replayRFC 9449 / RFC 8705

Trade-offs

Shared deputy + ExternalId is cheap: one identity, one rotation, no per-customer IAM quota. Its blast radius is the whole fleet: one leaked deputy credential is every customer. Per-customer deputy identities cap that at one tenant but multiply rotation work and hit IAM limits (AWS default: 5,000 roles per account). Token exchange adds a network hop (single-digit ms intra-region, more cross-region) and a new dependency: if the exchange service is down, every delegated call fails closed. Audience binding breaks shared token caches, so you pay a mint per target.

Failure modes and detection

  • Token substitution: aud mismatch → 401 at the resource; alert on the mismatch rate, it spikes during attacks.
  • Replay: same jti twice → reject; count duplicates.
  • Scope escalation: log requested vs granted scope; a gap means the deputy widened authority.
  • Nested delegation: cap act chain depth (2-3); alert beyond.
  • Deputy compromise: every token from that deputy is suspect. The act/sub chain tells you which tenants to revoke.

Test and govern

Test one tenant naming another's resource, replay of a captured token, scope escalation, nested delegation, missing claims, and deputy compromise. Resource owners publish who may delegate to them and can revoke; monitor cross-tenant and high-impact delegated use.

Curated: · Written: · Reviewed:

Difficulty: Hard
Q&A-23

Design enterprise session lifecycle and revocation.

Answer

What I'd say first

Assume an OIDC/OAuth 2.0 IdP, browser apps plus native and service clients, a mix of first-party and SaaS apps, and no assumption that every app supports logout. The design has four parts: bound session authority, short-lived credentials, an authenticated revocation channel, and verification that denial actually happened.

1. Bound authority. Every session gets an absolute lifetime and an idle lifetime set by assurance level, not by app-team preference. NIST SP 800-63B gives the floor: AAL1 reauthenticates at 30 days, AAL2 at 12 hours or 30 minutes idle, AAL3 at 12 hours or 15 minutes idle. I'd treat those as ceilings for high-risk apps and tighten: 15-minute idle, 8-hour absolute for admin consoles.

Access tokens: 10 minutes, JWT per RFC 9068, aud bound to one resource server, minimal scope. Refresh tokens: rotated on every use, single-use, with reuse detection. A replayed refresh token kills the whole family. Sender-constrain with DPoP (RFC 9449) or mTLS-bound tokens (RFC 8705) wherever the client can hold a key; that is what makes a stolen token useless rather than merely short-lived. Concurrent sessions: 1 for admin and break-glass, 5 for standard users, enforced server-side.

2. Revocation channel. Material events: termination, password or authenticator reset, role change, device compromise, incident containment: emit a signed, versioned event. OIDC Back-Channel Logout carries a logout token with iss, aud, jti, iat and sid/sub, and the RP must reject it if it contains a nonce. For continuous evaluation, OpenID SSF with the CAEP profile pushes the same events to subscribers. RFC 7009 covers explicit token revocation at the authorization server.

3. Verification. This is the part teams skip. Track per resource: event received, session terminated, next request denied. Alert when p95 propagation exceeds 60 s.

Worked trace: employee terminated at 14:00:00.

tevent
14:00:00HR deprovisions via SCIM; IdP disables the account
14:00:01IdP sends logout tokens (sid) to 6 RPs; SSF pushes session-revoked to 3 subscribers
14:00:025 RPs kill server-side sessions; the 6th, a legacy SAML app, has no back-channel support
14:00:03AS revokes the refresh family; introspection (RFC 7662) returns active: false
14:08:03legacy app's access token (issued 13:58:00, 10-min TTL) expires; next request 401s
14:08:30monitoring confirms denial at all 6; legacy app flagged as token-lifetime-bounded

That last row is the honest answer: for apps without back-channel logout, revocation latency equals access-token lifetime. That is why 10 minutes, not an hour.

Failure modes. IdP outage: fail closed for high-risk, and cap the grace window. A 15-minute cached introspection result, not indefinite. Clock skew: allow ±60 s on iat/exp validation and log rejections outside that. Duplicate and out-of-order events: make handlers idempotent on jti and ignore events older than the last applied version. Regional partition: queue events durably, then reconcile on recovery by re-querying active sessions rather than trusting the queue. SAML SLO is unreliable in practice: treat it as best-effort and let token expiry be the backstop.

What I'd measure: median and p99 time from event to effective denial, per resource; sessions still valid past their absolute lifetime (should be zero); refresh-token reuse detections per week.

Curated: · Written: · Reviewed:

Difficulty: Hard
Q&A-7

Design just-in-time privileged access across cloud and on-premises systems.

Answer

Assumptions

Hybrid environment: AWS, Azure, on‑prem Active Directory, and Linux. IdP is Entra ID. Ticketing is ServiceNow. Broker is HashiCorp Vault or Teleport. We need JIT for human admins, not service accounts.

Core design

Separate admin planes for cloud and on‑prem. Define eligible populations: users are eligible for roles, not assigned. They request activation with purpose, ticket, resource, action, duration. Approval required for high‑consequence actions. Broker issues short‑lived credentials: cloud roles with session policies, SSH certificates, database credentials. Enforce at target: IAM policies, sudoers, JEA. Monitor and alert. Revoke at expiry, role change, incident. Reconcile active sessions with target grants. Break‑glass: separate accounts, hardware MFA, alerting, tested. Metrics: standing admin reduction, activation latency, revoke latency, scope, exceptions, failed removals, blast radius.

How it works

For cloud, use AWS IAM Identity Center permission sets with session duration default 1 hour, max 12 hours. Azure PIM: default activation 1 hour, max 24 hours. GCP: IAM Conditions with temporary access. For on‑prem, manage AD groups with Entra PIM for Groups (requires hybrid identity). For Linux, Vault SSH secrets engine issues certificates with TTL (e.g., 5 minutes to 1 hour) and principals. For Windows, JEA with temporary role capabilities. Broker integrates with ServiceNow for approval. MFA is FIDO2. Monitoring to SIEM. Reconciliation: compare Vault leases with AWS IAM roles, Azure RBAC assignments, Linux authorized_keys, AD group memberships. Why token expiry alone may not stop every path: AWS session tokens can be cached by CLI, SSH keys can be copied, AD group membership might be cached by Kerberos tickets. So you need to actively revoke at target.

ToolJIT capabilityDefault/max duration
AWS IAM Identity CenterPermission sets with session durationDefault 1h, max 12h
Azure PIMEligible role activationDefault 1h, max 24h
HashiCorp VaultSSH certificates, database credsTTL 1h, max 24h
TeleportSSH/Kubernetes certsTTL 1h, max 12h

Trade‑offs

JIT adds latency (e.g., 30–60 seconds for approval) and operational overhead. For low‑risk, high‑frequency actions (e.g., reading logs), permanent just‑enough access might be better. For service accounts, use workload identity federation, not JIT. For break‑glass, permanent access with heavy monitoring is necessary. When JIT is wrong: if you have a small team with high trust and low turnover, the overhead might not be worth it. If you have legacy systems that don't support short‑lived credentials, you might need a credential vault with checkout.

Failure modes

Broker outage: need break‑glass. Approval bottleneck: need auto‑approval for low‑risk. Token not revoked at target: need reconciliation. Privilege chaining: user activates a role and then creates a new user or adds themselves to another group. Detect via monitoring for IAM changes. Scope creep: user requests more than needed. Detect via policy analysis.

Metrics

Standing admin reduction: from 100% to 5% (break‑glass only). Activation latency: p50 < 30s, p95 < 2min. Revoke latency: < 5min. Scope: number of actions per session. Exceptions: number of permanent grants. Failed removals: number of sessions not revoked. Blast radius: number of resources accessible per session.

Worked example

A user requests "Prod DB Admin" for 2 hours, ticket INC123. Broker checks eligibility, sends approval to ServiceNow. Approver approves. Broker assumes AWS role with session policy limiting to RDS actions, duration 2h. Broker issues SSH certificate for bastion with principal "dbadmin", TTL 2h. User connects to bastion, then to DB. At expiry, broker revokes role and certificate. Reconciliation job compares active sessions with AWS IAM roles and SSH certificates; if mismatch, revokes.

Arithmetic: If you have 100 engineers with standing admin, moving to JIT with 5 break‑glass accounts reduces standing privilege by 95%. If each activation takes 1 minute and you have 20 activations per day, that's 20 minutes of admin time per day, but it reduces the window of exposure from 24/7 to 40 hours per week (20 sessions × 2h).

Curated: · Written: · Reviewed:

Difficulty: Hard
Q&A-20

Design a centralized policy-based access control (PBAC/ABAC) architecture supporting fine-grained permissions and delegation at enterprise scale.

Answer

Assumptions. 100k employees, ~2,000 internal services plus SaaS, an existing OIDC IdP with SCIM provisioning, and a requirement that permissions be both fine-grained and delegable.

The 90-second answer

One Policy Decision Point, many Policy Enforcement Points, attributes resolved at decision time. PEPs sit in the API gateway, the mesh sidecar, and service middleware; each sends {subject, action, resource, context} to the PDP and enforces the returned decision plus any obligations (log, redact, step-up auth). Policies are Rego (OPA 1.x) or Cedar, stored in Git, tested in CI, and shipped to PDP replicas as signed bundles. Attribute sources: IdP claims, SCIM groups, a resource catalog holding owner and classification, device posture from MDM: are read through a short-TTL cache.

Delegation is a policy, not a separate subsystem. A delegator mints a narrowed credential with OAuth 2.0 token exchange (RFC 8693); the resulting JWT carries the delegator in the act claim, and nesting act records the full chain. The PDP re-checks the delegator's live attributes on every delegated request rather than trusting the token, and caps chain depth at 2.

Mechanism

A request for Alice (dept payments, clearance confidential) to read a resource (dept payments, classification internal, no legal hold):

REGO
package authz

default allow := false

allow if {
    input.action == "read"
    input.subject.department == input.resource.department
    clearance_ok
    not resource_locked
}

clearance_ok if {
    level[input.subject.clearance] >= level[input.resource.classification]
}

level := {"public": 0, "internal": 1, "confidential": 2, "restricted": 3}

resource_locked if input.resource.legal_hold == true

Trace: default sets allow = false. action == "read" holds. Departments match. level["confidential"] = 2 >= level["internal"] = 1, so clearance_ok is defined. legal_hold is false, so resource_locked is undefined and not succeeds. allow becomes true. Change the resource classification to confidential and clearance_ok is undefined: the body fails, allow stays false, deny. A missing clearance key behaves the same way, which is the property you want.

ConcernRBACABAC/PBAC
Grant "any doc in my dept"one role per departmentone rule, subject.dept == resource.dept
Revocation latencybounded by token lifetimebounded by attribute cache TTL
"Why was this allowed?"role membership queryneeds decision logs with the input tuple

Scaling arithmetic (hypothetical)

10,000 decisions/sec at 5 ms of PDP CPU each: Little's Law gives 10,000 × 0.005 = 50 decisions in flight. One core sustains 1/0.005 = 200 decisions/sec, so 50 cores minimum; at 2× headroom for p99 and GC, ~100 cores, e.g. 25 replicas × 4 cores. A 30-second decision cache with a 60% hit rate drops the PDP to 4,000/sec, or ~20 cores. The cache key must include the policy bundle version and the attribute versions, or a policy change won't take effect until entries expire.

Failure modes

  • Stale attributes. A deprovisioned employee keeps access until the identity cache TTL expires. Emit attribute_age_seconds per decision and alert when p99 exceeds the TTL; push SCIM deprovision events to invalidate the entry instead of waiting.
  • Policy misconfiguration. Replay the last 24h of decision requests against the new bundle in shadow mode and diff outcomes; alert on any newly-permitted (subject, resource, action) tuple. opa test in CI catches the rest.
  • PDP outage. The PEP's fail mode is per-resource, not global: fail-closed for payments, fail-open against a cached decision for a read-only wiki. Detect via PDP error rate and a circuit breaker at the PEP.
  • Delegation abuse. A delegate keeps working after the delegator loses access. Re-evaluating the delegator's live attributes on each request closes this; monitor act chain depth and delegated-token usage per delegator.

Keep the PEP→PDP hop in-region (a same-node sidecar is sub-millisecond; a remote PDP adds 1–2 ms) and hold p99 decision latency under 10 ms.

Curated: · Written: · Reviewed:

Difficulty: Hard
Q&A-16

Design contractor and partner identity lifecycle.

Answer

I'd separate contractor and partner identity from employee identity. Assume a B2B relationship, the partner has its own IdP, some contractors have no corporate IdP, and we have an IGA tool, PAM, and SIEM. The core design: an accountable internal sponsor, a verified contract, and time-boxed local entitlements. Authentication can federate from the partner IdP via OIDC or SAML, but authorization stays local. I map partner claims (sub, email, groups) to narrow local roles. I never grant access by trusting a partner group name directly. Provisioning uses SCIM if the partner supports it; otherwise a ticketed workflow. Every grant has an end date. High-risk access is JIT through a managed jump host or PAM with session recording. The enterprise keeps an independent revoke path: disable the local account, revoke refresh tokens, rotate any API keys, and block the partner subject, even if the partner IdP is down or compromised.

Why local mapping? Partner groups are controlled by the partner. A partner admin can add a contractor to an overbroad group, or a stale group can persist after a role change. Local mapping gives least privilege and an audit trail. Federation gives SSO and MFA, not authorization. SCIM automates lifecycle but does not make the sponsor accountable. End dates matter because contracts end and sponsors leave. Example policy: default 90 days, max 180 with VP approval. Inactivity 30 days triggers review; 45 days disables. JIT TTL 60 minutes, max session 4 hours, re-auth for a new resource. Managed delivery means no persistent VPN, no local admin, copy/paste controls.

Failure modes: sponsor leaves, partner IdP outage, email or subject change, contract ends, cross-tenant attempt, shared vendor account. Detection: daily reconciliation of partner roster, federation subjects, local accounts, group memberships, and effective access. Alert on orphaned accounts, missing sponsor, access past end date, JIT session outside window. Test terminated contractor, changed email, IdP outage, contract end, cross-tenant.

StageControlExample threshold
SponsorNamed internal employee, manager approvalRe-attest every 90 days
ContractVerified relationship, data classification, right-to-auditEnd date in IGA
ProvisionSCIM or ticket, local role mappingNo shared accounts
AccessJIT for high-risk, managed host60 min TTL, 4 h max
ReviewInactivity, sponsor departure, contract end30 d review, 45 d disable
RevokeLocal disable, token revoke, key rotateIndependent of partner IdP
ReconcileRoster vs subjects vs accounts vs groupsDaily

Trace: contractor requests prod DB read. Sponsor approved, contract active. IdP asserts sub=abc, email changed. Local mapping finds no active role for new email, denies. Sponsor re-approves, role granted for 2h JIT. Session recorded. At 2h, token revoked, session killed. If partner IdP is down, local disable still works.

What changes the decision: if the partner has no IdP or SCIM, I'd use managed local accounts with stronger controls. If access is low-risk and short, I might skip PAM but keep end dates and reconciliation. If the partner is strategic and high-volume, I'd invest in automated lifecycle and joint incident runbooks.

Curated: · Written: · Reviewed:

Difficulty: Hard
Q&A-15

Handle mergers, acquisitions, and multiple identity domains.

Answer

Assumptions. Two tenants: acquirer on Entra ID, acquired on Okta with an on-prem AD behind it. HR is authoritative for employment on both sides. Integration window is 6–12 months. If the acquired unit is being divested inside 18 months, or sits in a jurisdiction that forbids moving identity data across the border, stop at federation and never merge.

Core answer. Don't merge directories. Federate first, correlate second, migrate app-by-app third, and retire the acquired IdP only when its last dependent app is gone. A directory merge is effectively irreversible: collapsing two sub namespaces into one destroys the only stable key audit and incident response have for the acquired population. Federation with explicit issuer/audience and local entitlement mapping keeps that key intact while you work.

Why federation-with-mapping beats wholesale trust. If you accept the acquired IdP's groups as-is, you inherit its privilege model: including whatever admin groups it accumulated. Mapping each incoming group to a local group, in a pending state until an owner re-approves it, makes the default outcome of the integration less access, not more. That's the property you want, because over-grant is silent and under-grant generates a ticket. Nested groups break the naive version of this: a group you map to read-only can contain a nested group that grants admin, so you have to expand effective membership, not read the top level.

Worked trace. Jane exists twice: jane@a.example in the acquirer (Entra sub a1b2c3) and j.doe@b.example in the acquired Okta (sub 00u1x2y3). Email matching fails: the addresses differ, and a second "Jane Doe" in the acquired company would collide. HR's workerId=E-10422 matches on both sides, so the correlation service writes:

JSON
{
  "person_id": "p_10422",
  "identities": [
    {"iss": "https://login.microsoftonline.com/<tenant-id>/v2.0", "sub": "a1b2c3"},
    {"iss": "https://b.example/oauth2/default", "sub": "00u1x2y3"}
  ],
  "provenance": "workday:E-10422"
}

Her Okta group B-App-Admin (14 members) maps to A-App-Admin in pending state. Until an owner re-approves, those 14 get A-App-ReadOnly. Nobody silently inherits admin.

Alternatives and when not to use them.

  • Big-bang merge: cheapest to run, no rollback, highest blast radius. Only defensible under ~50 users with no regulated data.
  • Permanent federation (cross-tenant sync / B2B): namespaces stay separate and audit stays clean, but you run two IdPs forever and every app needs dual config.
  • Staged migration: federate now, move apps one at a time, retire the acquired IdP at the end. Slower, reversible, and the one I'd pick.

Failure modes and how you catch them.

  • Email-based correlation: two people merge into one identity. Detect with a report that flags any person_id with more than one workerId, or any workerId with more than one person_id.
  • Inherited admin groups: acquired Domain Admins maps to acquirer Domain Admins. Detect by diffing effective admin membership before and after federation; alert on any new admin path.
  • Orphaned accounts: contractor leaves, account stays. Detect by joining the HR termination feed against active accounts: anything active with no HR record for 30 days.
  • SID history injection during AD migration: detect by scanning for populated sIDHistory on accounts after migration; SID filtering on the trust blocks the injection.
  • Dual live sessions after cutover: detect by inventorying sessions per person_id across both tenants; anything still authenticating to the retired IdP after cutover is a missed app.

Cutover criteria. Retire the acquired IdP when zero apps authenticate against it for 30 consecutive days, zero sessions originate from it, and the emergency break-glass account is proven to work from outside both directories.

Curated: · Written: · Reviewed:

Difficulty: Hard
Q&A-17

Design customer identity at large scale with privacy and recovery.

Answer

Clarify first. "Large scale" and "privacy" pull against each other, so I'd pin down three things before designing: the highest-harm action (moving money? reading a medical record?), which regimes apply (GDPR, CCPA, PSD2 SCA), and whether accounts are pseudonymous or legally identified. I'll assume a consumer product with tens of millions of accounts and a small set of high-value actions.

The answer. Separate three planes and give each its own assurance level, using NIST SP 800-63's IAL/AAL/FAL 1–3 vocabulary so the decision is auditable rather than vibes.

  • Proofing (IAL). IAL1 is self-asserted email. IAL2 needs evidence: a government ID plus a selfie matched to it, or a verified bank account. IAL3 adds an in-person or supervised remote check. Don't buy IAL2 for a pseudonymous forum account; the data you collect becomes your breach liability.
  • Authentication (AAL). AAL1 is single-factor. AAL2 is two factors, or one phishing-resistant factor: WebAuthn/passkeys qualify. AAL3 requires a hardware-bound, non-exportable key (a FIDO2 security key). SP 800-63-4 (2024) permits syncable authenticators at AAL2 but not AAL3, which is why a synced passkey is AAL2.
  • Federation (FAL). FAL1 is a bearer assertion; FAL2 requires a signed assertion; FAL3 requires the client to hold its own key. "Sign in with Google" over OIDC is FAL2.

Why issuer-subject validation stops takeover. An OIDC sub is unique only within an issuer. Key accounts on sub alone and an attacker who controls any trusted issuer, or who gets you to trust evil.example, can mint a sub that collides with a victim's. Store the pair (iss, sub) as the federated key, pin the issuer's JWKS by URL, and never merge on email. Email is a mutable attribute, not an identifier.

Why delay mitigates SIM swap. A SIM swap hands the attacker the SMS channel, so any recovery that completes instantly over SMS is a full takeover. Insert a mandatory waiting period, 24 to 72 hours, before the new factor becomes usable, and notify the old channel immediately. The legitimate user, who still holds their device, sees the alert and cancels; the attacker can't compress the clock.

Risk-tiered table.

ActionIALAALFALRecovery
Read public docs011email link
Post pseudonymously112email + 24h delay
Change payout bank22 (WebAuthn)2in-app step-up, no SMS
Move >$10k23 (hardware key)3manual review

Failure modes and detection. Credential stuffing shows as a spike in failed logins from a few ASNs across many accounts: detect on the ASN and device fingerprint, not the account, and rate-limit per IP (say 20 attempts/15 min) and per account (5/15 min) so a shared NAT isn't locked out. Enumeration shows as a timing or response-code gap between "user exists" and "user doesn't": return identical bodies and constant-time responses. Support-agent abuse is the quiet one: audit every recovery override, require two-person approval above a threshold, and alert on agents whose recovery volume is a statistical outlier.

Privacy. Keep fraud signals in a store separate from identity attributes, set retention (e.g. 90 days for raw device signals, 7 years for KYC records where law requires), and give users a way to see and contest a recovery denial.

Curated: · Written: · Reviewed:

Difficulty: Hard
Q&A-21

Threat-model an enterprise IAM platform.

Answer

Assumptions. ~10k–100k employees, one primary IdP (Entra ID or Okta) federating to SaaS over OIDC/SAML, SCIM 2.0 (RFC 7644) provisioning, on-prem AD reached via LDAP/Kerberos, PAM for tier-0. The attacker can phish, can buy a stolen session cookie, and may be an insider holding delegated admin.

Core answer (first 90 seconds). Don't enumerate components: model the trust chain. Every IAM action is a relying party accepting an assertion, so the question at each link is: who can mint this assertion, what does the verifier actually check, and what is the blast radius if it's forged? Four links matter: enrollment (who gets an identifier), authentication (who proves it), authorization (what the token or policy grants), and enforcement (whether the target checks anything at all). In practice most IAM breaches land on enrollment or enforcement, not on the login screen: the attacker gets an identifier they shouldn't have, or a downstream app trusts a stale group cache instead of re-checking.

LinkAttack pathControlDetection
EnrollmentSelf-registration, or linking a new credential to a victim's existing identity (collision)HR feed as source of record; immutable ID (objectGUID, OIDC sub); no self-service linking without proofingTwo accounts sharing a verified email/phone; enrollment from a new ASN
AuthenticationPush bombing; helpdesk recovery reset to an attacker-controlled phoneWebAuthn/FIDO2 for admins; number matching (Entra default for Authenticator push since Feb 2023); verifier rate limiting per NIST SP 800-63B; recovery requires the same proofing as enrollmentPush denied then approved; recovery events outside business hours
Federation keysIdP signing-key compromise or malicious rollover; SAML XML signature wrapping; OIDC mix-upMetadata-pinned keys; validate iss, aud, exp, nonce; RFC 9207 iss; PKCE (RFC 7636); dual-publish new key before signing with itSignature-validation failures; an RP seeing an unknown key ID
ProvisioningStolen SCIM bearer token → mass deprovision or privilege grantPer-connector scoped tokens, IP allowlist, rotation; treat deprovision as high-riskBulk PATCH volume anomaly against baseline
AuthorizationGroup/role nesting escalation; self-approval; confused deputySeparation of duties; quorum for tier-0; policy as a signed, versioned artifactDiff of effective permissions per principal
EnforcementTarget drift: app caches group membership, or a local account bypasses SSOAuthorize at the target, not only in token claims; scheduled reconciliationEntitlement reconciliation drift report
Audit / availabilityLog tampering; IAM outage locking out the whole companyAppend-only WORM sink; break-glass accounts excluded from conditional access and rehearsedWrite-gap alerts on the audit stream

Worked trace. A relying party that verifies the ID token signature but skips aud will accept a token minted for a different client: that is the mix-up class. Add aud and iss checks and the same token is rejected at validation, before any session is created.

Trade-offs. Okta's default access-token lifetime is 1 hour; Entra ID issues 60–90 minutes randomized. Shortening that cuts the replay window but multiplies refresh traffic and couples every app to IdP availability, if the IdP is down, nothing authenticates. Number matching kills push fatigue but adds friction and breaks some phone form factors. Quorum approval for tier-0 changes costs hours of latency; reserve it for tenant-wide blast radius. A standing break-glass admin is a permanent risk you accept to avoid total lockout, so monitor it rather than pretend it's gone.

Failure modes. Mass deprovision is the loud one: one over-scoped SCIM token can deactivate thousands of accounts in a single bulk job, so cap batch size and alert on it. Silent drift is the quiet one: an app that caches group membership keeps granting access after offboarding, caught only by reconciliation. And a valid token from a compromised but legitimate account passes every check above: managed identity proves authentication, not benign intent.

Curated: · Written: · Reviewed:

Difficulty: Hard
Q&A-22

Respond to compromise of the enterprise identity provider.

Answer

First 90 seconds

Assume the IdP, Okta or Entra ID, is the issuer for OIDC/SAML SSO, SCIM provisioning and the admin console, and the attacker had super-admin or signing-key access. The trap: the IdP is also the tool you'd normally use to revoke access. So the first decision is to stop treating it as your control plane.

Core answer: get authority outside the compromised IdP, freeze issuance, re-establish trust, then rebuild and reconcile.

1. Authority outside the IdP. Use pre-provisioned break-glass accounts (Entra ID recommends two cloud-only accounts excluded from Conditional Access, credentials in a safe) plus the cloud provider's own tenant recovery path. Why it matters: every revocation you run through the IdP admin console is visible to the attacker and reversible by them, and the audit log you're reading may be theirs.

2. Contain issuance, not the whole business. Disable new app/token issuance and admin changes; leave authentication for safety-critical paths (clinical, on-call, payments) running. Killing all auth is itself an outage.

3. Re-establish trust. Rotate signing keys, revoke sessions and refresh-token families, then verify each relying party rejects old material.

4. Rebuild and reconcile. Rebuild from verified config, reset factors, diff SCIM/group/role state against baseline, and reconcile business actions taken during the window.

The trade-off that decides the incident

Hard revocation of everything is fast and safe but takes down every SSO app at once. Staged rotation is slower but keeps the business up. The split is by protocol:

  • OIDC rolls gracefully. Publish a new signing key in the JWKS alongside the old one with a distinct kid; RPs pick it up on their next JWKS refresh; new tokens validate while old ones still do. Then remove the old key.
  • SAML is a flag day. SPs that pin the IdP signing certificate break the moment you rotate, until each one consumes updated metadata. With 60 pinned SPs that's 60 coordinated updates, not one.

So: rotate OIDC keys immediately, stage SAML cert rotation with a comms plan, and accept that break-glass availability beats lockdown for the handful of paths that keep people safe.

Failure modes and how you'd catch them

  • Surviving OAuth grant. Password reset does not invalidate refresh tokens in Entra ID: you need "Revoke sessions". Detection: alert on refresh_token grant successes for (user, client_id) pairs absent from the 30-day baseline, or from new ASN/IP.
  • Rogue app or client secret. Attacker registers an app with client_credentials. Detection: diff service principals and app role assignments against baseline; alert on any new client secret or Application.ReadWrite.All grant.
  • Backdoored SCIM mapping. A provisioning connector that keeps re-creating a disabled account. Detection: alert when a SCIM POST /Users recreates an account disabled in the last 24h.
  • Rogue federation. A new federated domain or external IdP added to the tenant. Detection: audit events for domain authentication changes and new SAML IdPs.

Propagation, so you know what "revoked" means

ActionKillsTakes effect
Revoke sessions (Entra ID)refresh tokens; access tokens at expiryaccess token default 60 min; CAE near real-time
Rotate OIDC signing keyforged tokens with old kidafter RP JWKS cache TTL
Rotate SAML signing certforged assertionsflag day per pinned SP
Delete app client secretclient_credentialsimmediate

The number to hold: Entra ID access tokens default to 60 minutes, so "we revoked sessions" still leaves up to an hour of valid access tokens unless CAE is on. Say that out loud: it's the difference between containment and the appearance of it. The objective is to contain issuer compromise and re-establish trustworthy identity and access; the check is whether you can name missing, extra, stale, failed and mismapped access, not whether the IdP login page loads.

Curated: · Written: · Reviewed:

Difficulty: Hard
Q&A-18

Design identity recovery and break-glass for IAM control-plane outage.

Answer

Assumptions: one cloud (AWS) as the control plane, Entra ID for workforce SSO, SPIRE for workload identity, Okta for one legacy app. Different stack, same shape; the numbers move.

Core answer

Treat the IdP as the failure domain, not the thing that rescues you. You need two break-glass paths that share no dependency with daily auth (one for humans, one for workloads) plus a logging path that traverses neither. Humans get two cloud-only accounts in the cloud provider itself: no federation, hardware FIDO2 keys, explicitly excluded from every Conditional Access policy and SCP that could lock them out. Workloads get SPIRE-issued SVIDs with a 1-hour TTL, so a compromised IdP cannot mint them. Unseal material for both sits under a 3-of-5 Shamir split, Vault's default seal config, with shares in five separate safes or HSMs. Recovery order is fixed: revoke the compromised issuer, re-establish known-good identity and policy, then restore business access. Never the other way round.

Why quorum, and when it's wrong

A single break-glass account is one phish from total compromise and gives you no attribution under duress. A quorum costs you assembly time and buys you collusion resistance. The deciding criterion is headcount and threat model, not preference.

choiceright whenwrong when
individual accountsingle region, <10 on-call, sub-5-minute MTTR requiredregulated environment; insider threat in scope
3-of-5 quorummulti-region, >20 staff, key compromise is a named threat3-person startup: quorum becomes a self-inflicted DoS
HSM-held shareskey theft is in the threat modelshares in a password manager: one phish ends it

Independent logging

If the IdP is compromised, the attacker can revoke your access to the logs they're writing. Put the trail in a separate AWS account: an organization CloudTrail trail with log file validation (SHA-256 digest files) writing to an S3 bucket under Object Lock in compliance mode, plus a second copy to a non-cloud sink. The break-glass role's trust policy names only the recovery account, so the compromised IdP cannot assume it.

Federation key rotation

Rotating a signing cert does not restore trust by itself. Publish the new cert in the IdP metadata alongside the old one, keep the overlap longer than the longest token lifetime plus clock skew (an OIDC ID token is typically 1 hour, so overlap 90 minutes) then remove the old key from JWKS. Anything still presenting the old key after that is either stale or hostile; both should fail closed.

Activation trace

  • T+0: paged out of band (phone tree, not the IdP).
  • T+0–15: three share-holders join a bridge and unseal into the recovery host.
  • T+15: recovery host assumes the break-glass role; the CloudTrail event lands in the separate logging account.
  • T+20: revoke the IdP signing cert, rotate JWKS.
  • T+35: re-issue workload SVIDs from SPIRE against the new trust bundle.
  • T+60: restore normal policy, disable the break-glass role.

Quorum arithmetic

If each of five holders answers a page within 15 minutes with probability p, the chance you can assemble three is:

  • p = 0.7 → 10(0.343)(0.09) + 5(0.2401)(0.3) + 0.168 ≈ 0.84
  • p = 0.9 → 10(0.729)(0.01) + 5(0.6561)(0.1) + 0.590 ≈ 0.99

At 70% reachability you lose one activation in six. Fix the paging path before you add a fourth share.

Failure modes and detection

  • Break-glass used routinely. Alarm on the account's principal ARN in CloudTrail for any event outside an open incident ticket.
  • Shares lost or stale. Quarterly reconstruction drill; track last-verified date per share, alert at 120 days.
  • Logging path silently broken. Emit a canary event every 15 minutes; alarm if it doesn't arrive.
  • Recovery restores too much. Diff effective permissions before and after; alert if the break-glass role exceeds the pre-incident baseline.
  • Stale credentials. Rotate break-glass keys on the same schedule as KMS key deletion windows (7–30 days) so rotation is a rehearsed, not novel, operation.

Curated: · Written: · Reviewed:

Difficulty: Hard
Q&A-24

Migrate identity providers without account takeover or mass lockout.

Answer

The migration succeeds if you treat identity as a set of stable internal IDs, not as email addresses. Assume you have an existing IdP issuing OIDC iss/sub or SAML NameID/Issuer pairs, and a target IdP that will issue new ones. The core answer: build a correlation table that maps (old_iss, old_sub) to a new internal UUID, never link by email. Then dual-run authentication and provisioning until you can prove no account takeover and no lockout.

Here is the correlation table in SQL:

SQL
CREATE TABLE identity_correlation (
  internal_id UUID PRIMARY KEY,
  old_issuer TEXT NOT NULL,
  old_subject TEXT NOT NULL,
  new_issuer TEXT,
  new_subject TEXT,
  UNIQUE (old_issuer, old_subject),
  UNIQUE (new_issuer, new_subject)
);

On first login through the new IdP, you look up by (new_issuer, new_subject). If found, you issue a session for internal_id. If not found, you fall back to the old IdP for that user, or you require a step-up proof (e.g., existing session, recovery code) to link the new subject to the existing internal_id. Never auto-link by email because email can be reassigned or spoofed.

During dual-run, both IdPs are active. Old sessions remain valid until their TTL expires: say, 15-minute access tokens and 8-hour refresh tokens. New logins go to the new IdP. You canary by user population: 1% for a day, then 5%, 25%, 50%, 100%. With 100,000 users, 1% is 1,000 users; if your login failure rate is 0.1%, you see about 1 failure, which is safe to investigate. Monitor correlation misses, login failures, and helpdesk tickets. If the failure rate exceeds your threshold (e.g., 0.5%), roll back by routing new logins back to the old IdP.

Provisioning: use SCIM to sync users and groups from the new IdP to your applications. Shadow the SCIM mappings first: run both old and new SCIM targets in parallel, compare the resulting entitlements, and only cut over when the diff is empty. For key rollover, publish the new IdP's JWKS alongside the old one, and only remove the old keys after all tokens signed by them have expired (max token TTL).

Tradeoffs: Big-bang migration is faster but risks mass lockout if correlation is incomplete. Dual-run is safer but requires maintaining two IdPs and correlation logic. Brokering (e.g., using an identity broker) adds a layer but can simplify if you have many applications. Don't migrate if the old IdP works and the new one offers no clear benefit: migration is expensive and risky.

Failure modes: Account takeover via email relinking; mass lockout due to missing correlation entries; session fixation if you don't rotate session IDs on re-authentication; key rollover issues if you remove old keys too early. Detect by monitoring login failure rates, correlation misses, and helpdesk tickets. Keep independent break-glass accounts that don't depend on either IdP.

StrategyWhen to useRisk
Big-bangSmall user base, simple apps, no federationHigh lockout risk
Dual-runMost migrationsRequires correlation logic and two IdPs
BrokerMany apps, complex federationAdds latency and a new component

Trace: User Alice logs in via new IdP. New IdP returns iss=https://new.idp, sub=abc123. Your app looks up (https://new.idp, abc123) in identity_correlation. Found: internal_id=uuid-1. Issue session for uuid-1. If not found, redirect to old IdP. Old IdP returns iss=https://old.idp, sub=xyz789. Look up (https://old.idp, xyz789). Found: internal_id=uuid-1. Now you can link (https://new.idp, abc123) to uuid-1 after verifying the user via an existing session or recovery code. Then issue session.

Curated: · Written: · Reviewed:

Difficulty: Hard
Q&A-25

Review IAM architecture for a global enterprise.

Answer

Clarify first. "Review IAM architecture" could mean a control audit, a design review, or an incident-driven look. I'd assume the goal is to find where authority outlives the source of truth, and I'd say so before starting. Assumptions I'd state: ~120k employees, ~40k contractors and partners, customer accounts, and a few thousand workloads; Workday is the authoritative source for employees, feeding Entra ID or Okta; downstream is ~400 SaaS apps over SCIM, AWS through IAM Identity Center, and on-prem AD via Entra Connect. If any of that is wrong, the numbers move but the method doesn't.

The core answer. The deliverable is not a checklist of controls. It's a measured revocation latency per identity class, plus the list of paths where authority survives the event that should have ended it. The deciding criterion for every design choice is the same: time from "authority should end" to "authority actually ends" must sit under the business's tolerance. 15 minutes for employees, an hour for partners, effectively immediate for privileged roles.

Why it behaves this way. Authority is copied, not referenced. Every hop (HR record, IdP, SCIM, the app's local store, the session token, the target ACL) is a cache with its own TTL. Total revocation latency is the slowest path through those caches, and the token usually dominates, because a signed bearer token cannot be un-issued. Entra ID access tokens default to roughly an hour (randomized 60–90 minutes); Okta's default access token is 1 hour; an IAM Identity Center session defaults to 8 hours (configurable 1–12), and AssumeRole defaults to 1 hour with a 12-hour maximum. SCIM deprovisioning (RFC 7643/7644) typically lands in seconds to a few minutes. So disabling an account at 10:00 with default Identity Center settings leaves a working AWS session until 18:00. That gap is the finding, not a footnote.

The trade-off, and when to pick each.

ModelRevocation latencyCouplingChoose when
JIT federation, no provisioningToken lifetime only; no local account to clean upNoneLow-risk SaaS, contractors, short engagements
SCIM provisioningSeconds–minutes, plus token lifetimeIdP outage blocks new starts, not existing sessionsApps that must answer "who has access right now" for audit
Per-app local accountsDays to neverNoneLegacy only; treat as a finding

The criterion is whether the app must produce an auditable entitlement state. If it only authenticates, JIT is cheaper and has less to leak. If audit or SoD requires a queryable roster, SCIM earns its coupling cost.

Trace: a leaver at 10:00.

  • 10:00 Workday termination event fires.
  • 10:02 IdP account disabled; SCIM PATCH active=false fans out to 380 apps.
  • 10:05 372 apps acknowledge; 8 fail (no SCIM support, or connector error) and queue for reconciliation.
  • 10:02–11:00 Existing OIDC access tokens stay valid until expiry.
  • 10:03–10:17 An app caching group membership for 15 minutes keeps honoring the old groups.
  • 18:00 The AWS Identity Center session expires.

Net: SaaS access ends around 10:17; AWS access ends at 18:00 unless the session is explicitly revoked.

Failure modes and how I'd detect them.

  • Leaver drift. Nightly reconciliation of HR active vs. IdP active vs. app local accounts; alert on any account active in an app but absent from HR. Blast radius: that user's full role permissions in the app.
  • Token outliving disable. For a sample of disabled users, query CloudTrail and app logs for successful calls after the disable timestamp; report p99. Blast radius: whatever the token's scopes allow.
  • Break glass. Static credential deliberately excluded from SCIM. Detect by alerting on any authentication and requiring rotation within 24 hours. Blast radius: domain admin.
  • IdP compromise. Attacker mints tokens for any user. Detect via signing-key change and impossible-travel signals. Blast radius: everything federated. Mitigate with per-app signing keys, short token lifetimes, and hardware-bound authenticators (FIDO2/WebAuthn, NIST SP 800-63B AAL3).
  • Connector outage. SCIM queue backs up. Detect on queue depth and age of the oldest pending operation. Blast radius: joiners can't start, leavers stay active.

What I'd report. Gaps ranked by measured revocation latency times blast radius, each with an owner, a deadline, a compensating control (shorten token lifetime to 15 minutes, add a session-revocation API), and an expiry date. The claim I'd stand behind is bounded: authority is more timely, least-privileged, and auditable than before, not that every insider and workload is now trustworthy.

Curated: · Written: · Reviewed:

Difficulty: Hard