Identity, Authentication, and Access Management Questions
Designing and operating identity and access control systems. Covers authentication protocols and standards (OAuth, SAML, OIDC, MFA), authorization models (RBAC, ABAC), identity lifecycle and privilege management, IAM architecture and automation, and access control across cloud and on-premises environments. The 'who can do what' control plane, distinct from cryptographic key management.
Design a high-level integration plan to onboard a large enterprise customer to your B2B SaaS platform, where employees access the product through a corporate portal using SSO. Outline authentication (SAML or OIDC), user provisioning (SCIM), consent flows, role mappings, reporting integration (CSV/API), and error handling. Identify key milestones, dependencies, and common pitfalls to anticipate.
Sample Answer
Direct answer
Sequence the onboarding so each piece unblocks the next: get federated authentication (SAML or OpenID Connect) working first since everything else depends on a trustworthy identity assertion, then automate provisioning (SCIM, System for Cross-domain Identity Management) for account lifecycle, then map the customer's directory groups to product roles, then wire up reporting, with error handling and a rollback plan threaded through every stage rather than bolted on at the end.
Structured elaboration
Authentication (SAML or OIDC). Let the customer's identity provider (IdP) drive the choice: Security Assertion Markup Language (SAML) 2.0 is XML-assertion based and still the default for many established enterprise IdPs, while OpenID Connect (OIDC), built on OAuth 2.0 and JSON Web Token (JWT)-based, tends to be simpler to integrate and maintain going forward, especially for anything touching mobile or API clients. Support both as first-class options rather than forcing one, since the customer's existing IdP configuration is usually a fixed constraint, not a negotiable one. Onboarding here means exchanging metadata (a SAML metadata XML document, or an OIDC discovery document), configuring the entity ID and assertion consumer service URL (SAML) or redirect URIs and client ID (OIDC), and validating that the required claims (email, name, group memberships) actually arrive signed and correctly formed before moving on.
Provisioning (SCIM). Expose a SCIM 2.0 endpoint (per RFC 7644) implementing the Users and Groups resource types, which the customer's IdP calls as a SCIM client to push create, update, and deactivate events. Match incoming resources on the IdP's own stable external identifier, never on email or username, since either can be reassigned or changed and using them as the join key silently orphans or duplicates accounts. Deactivation and deletion are different events: deactivating should immediately suspend access while keeping the account and its audit history intact; a hard delete should only happen after a defined retention window, never as the immediate response to an offboarding signal.
Consent flows. In a business-to-business context, consent is normally given once by the customer's IT administrator on behalf of the whole organization, not negotiated per employee, since individual employees don't opt out of their employer's chosen provisioning. Document exactly which attributes will be received via SCIM and let the admin review that scope explicitly during onboarding; this is distinct from any individual sign-in consent prompt a user might separately see on first login.
Role mappings. Map the customer's IdP-asserted groups or claims to the product's internal roles via an explicit, per-customer configuration table, never a hardcoded assumption that a group named "Finance-Admins" means the same thing at every customer. Default any unmapped or newly-seen group to a safe, minimum-privilege role rather than silently granting either nothing (breaks the user's day) or the broadest role available (an access-control failure). Support updating a user's effective role when their group membership changes, either via a SCIM-pushed update or a just-in-time reassignment at next login as a supplement to the SCIM push.
Reporting integration. Give the customer visibility into who has access and what role, typically through both a scheduled comma-separated-values (CSV) export for manual review and a documented application programming interface for automated ingestion into the customer's own security-reporting tooling. At minimum, include current access, role, last login, and last provisioning change, since this is exactly what enterprise buyers routinely audit for compliance.
Error handling. A failed SCIM push (a malformed payload, a missing required attribute) has to surface as a correctly-formed SCIM error response the customer's IdP admin console can actually display, not disappear silently, since a silent failure means an employee believes they have access that was never actually granted. A failed SAML or OIDC assertion validation should fail closed (deny the login) with a message that distinguishes "your identity provider configuration is wrong" from "our service is unavailable," since those require completely different next steps from the customer. Large group synchronizations should use SCIM's own bulk operations and pagination rather than a single all-or-nothing request, so a failure partway through a large directory sync doesn't require restarting from zero.
Milestones, dependencies, and pitfalls. A realistic sequence: metadata exchange and an authentication test in a sandbox tenant; SCIM endpoint validation, ideally against the IdP's own SCIM compliance test suite where one exists; the role-mapping table signed off by the customer's admin; a pilot with a small cohort of real users; full directory synchronization and reporting cutover; decommissioning of any legacy access path. The critical-path dependency is almost always the customer's own IT admin availability, not engineering effort, and the role-mapping sign-off blocks the pilot from starting. The most common pitfall is assuming a one-to-one attribute-name match will hold across every customer, which breaks the moment a second customer uses different group naming; a close second is skipping the pilot cohort and running a full-directory sync on day one, which multiplies any mapping mistake across the whole customer organization at once instead of catching it on twenty users first.
flowchart LR
IdP["Customer IdP"] -->|SAML or OIDC| Auth["Authentication"]
IdP -->|SCIM push| Prov["Provisioning service"]
Prov --> DB["App user/role store"]
Auth --> App["Product"]
DB --> App
App -->|CSV + API| Report["Customer reporting"]
Worked example
Onboarding "Acme Corp," 500 employees, via their existing Okta tenant: exchange Okta's SAML metadata and configure the assertion consumer service URL; validate that Okta's assertions carry email, displayName, and groups. Stand up the SCIM endpoint and confirm Okta's SCIM provisioning app can create, update, and deactivate a test user correctly, matching on Okta's externalId. Build the role-mapping table for Acme's actual groups, for example Acme-Finance maps to Billing Admin and Acme-IT maps to Org Admin, reviewed and approved by Acme's IT admin. Pilot with a 20-person cohort from one department for a week, watching for mapping mistakes or login failures, before pushing the full 500-person directory sync. Reporting is wired up in parallel once authentication is stable, giving Acme's security team a weekly CSV plus an API endpoint for their own audit tooling.
Trade-offs and pitfalls
Relying on just-in-time provisioning at login without SCIM is simpler to build but leaves stale accounts behind after offboarding, since it only ever creates or updates access, never proactively removes it; SCIM push alone is stronger but depends entirely on the customer's IdP connector actually firing every event correctly, which argues for a periodic reconciliation job to catch drift from a connector that silently stopped working. The admin-consent model trades individual per-user consent granularity for enterprise practicality, which is the right trade for this context but requires clear, explicit data-processing disclosure to the admin to hold up under a compliance review. Finally, resist the temptation to skip the pilot cohort under launch-date pressure: a full-directory sync on day one turns any single role-mapping mistake into an organization-wide incident instead of a twenty-user one.
Describe how you would implement SCIM-based provisioning to synchronize identities between an HR system and your IdP. Include which SCIM endpoints you'd use (Users, Groups), attribute mapping strategies, handling create/update/delete events, idempotency and retry semantics, reconciliation to correct drift, and safe deprovisioning strategies to avoid accidental account deletions or loss of audit trails.
Sample Answer
Direct answer
Implement against SCIM 2.0's two core resource types, Users and Groups (per RFC 7643 and RFC 7644, System for Cross-domain Identity Management), treat every incoming event as idempotent against an external identifier the identity provider (IdP) supplies, and treat a SCIM delete as a deactivation internally rather than an immediate hard delete, so a provisioning mistake or a bad push from the identity provider can never silently destroy an account's history.
Structured elaboration
Which SCIM endpoints. /Users creates, reads, updates, and deactivates a user resource carrying a standard schema (userName, name, emails, an active flag, and an externalId used to correlate the resource with the identity provider's own record). /Groups manages group resources, typically carrying a members list referencing user resource IDs, which is how group-membership-driven role assignment gets pushed down from the identity provider. Support filtering (GET /Users?filter=userName eq "x") since the identity provider looks up existing resources before creating new ones, and support PATCH for partial updates: RFC 7644 explicitly calls out PATCH support for Groups because a full-resource PUT to add or remove one member from a large group is wasteful.
Attribute mapping. Map identity-provider attributes to the internal user model through an explicit, centrally maintained mapping configuration, not bespoke per-integration code. Always key identity correlation on externalId, the identity provider's immutable identifier, never on userName or email, since both can change (an email changes on marriage, a username gets normalized) and using either as the join key silently orphans or duplicates the account. Store only the attributes actually consumed downstream, not the full schema by default.
Handling create, update, and delete events. Create is idempotent on externalId: a duplicate create request for an identifier that already exists should update the existing resource rather than error or create a second one. Update, whether a full PUT or a partial PATCH, applies to the resource matched by externalId; PATCH is preferred for group-membership changes at scale, since adding one member to a group of thousands via PATCH avoids retransmitting the entire membership list. Delete is intercepted and translated into a soft deactivation rather than a hard row delete, described below.
Idempotency and retry semantics. Every write must be safe to retry: sending the same request twice should produce the same end state, never a duplicate or an error, since identity providers retry on any ambiguous response such as a timeout or a 5xx status. Return the SCIM-correct status codes so the identity provider's own retry logic behaves sensibly, for example a 409 Conflict for a genuine duplicate-with-different-payload case rather than a generic server error that triggers an unbounded retry storm. A full-directory synchronization should be resumable and paginated, using SCIM's startIndex and count parameters, rather than one all-or-nothing transaction, so a failure partway through a ten-thousand-user sync doesn't force a restart from zero.
Reconciliation to correct drift. A periodic, for example nightly, diff between the identity provider's actual directory state and the locally provisioned state catches what event-driven push alone misses: a connector that silently stops firing for one customer, a dropped delete event from a network blip, or an out-of-band manual change on either side. Reconciliation should surface the diff for review before auto-correcting anything, since blindly trusting the identity provider's state as always correct can itself wrongly deprovision someone if it is actually the identity-provider-side synchronization that broke.
Safe deprovisioning. Translate a SCIM delete, or an update setting active: false, into an immediate access suspension (revoke active sessions and tokens, block new logins) while retaining the account record and its full audit history for a defined retention window, for example 90 days, before any hard delete actually happens. This protects against both an accidental delete event and a legitimate offboarding that later needs its audit trail for a post-departure investigation or a legal hold. Treating a delete event as an immediate hard delete is the single most common way this kind of integration causes real, hard-to-reverse damage.
Worked example
The identity provider sends PATCH /Users/{id} for a departing employee, external identifier hr-00456:
{
"schemas": ["urn:ietf:params:scim:api:messages:2.0:PatchOp"],
"Operations": [
{ "op": "replace", "path": "active", "value": false }
]
}
The internal handler: revokes all active sessions and tokens for the user matched by externalId = hr-00456 immediately, marks the account inactive, and schedules a hard delete for 90 days out rather than performing one now. A nightly reconciliation job separately diffs the identity provider's live group membership against the locally provisioned state and flags one user whose group membership drifted after a manual, out-of-band change on the identity-provider side, surfacing it for review rather than silently correcting it.
Trade-offs and pitfalls
The most damaging pitfall is honoring a SCIM delete as an immediate hard delete, which destroys the audit trail an offboarding or incident investigation may need later and cannot be undone. A close second is keying identity correlation on userName or email instead of the identity provider's externalId, which silently produces duplicate or orphaned accounts the moment either value changes upstream. Using full-resource PUT for every group-membership change at scale, instead of PATCH, adds unnecessary payload size and lock contention on large groups. The core trade-off in reconciliation design is between auto-correcting drift immediately, which fixes problems fast but risks trusting a broken identity-provider-side state, and surfacing the diff for manual approval first, which is safer but slower; for anything touching deprovisioning specifically, the safer, slower option is the right default.
Define permission boundaries and explain how they differ from IAM role policies and resource policies in major cloud providers. Provide an example scenario where permission boundaries can prevent privilege escalation for delegated IAM administrators who otherwise could grant too-broad permissions.
Sample Answer
Direct answer
A permission boundary is an Identity and Access Management (IAM) feature that sets the maximum permissions an identity-based policy is ever allowed to grant a specific user or role. It doesn't grant anything by itself; it caps what any policy attached to that principal can grant, which makes it fundamentally different from a role policy, which actively grants permissions, and from a resource policy, which grants access from the resource's own side.
Structured elaboration
How it differs from role policies. A role's identity-based policy is additive: it grants whatever actions and resources it lists. A permission boundary is a ceiling evaluated alongside it: for an action to actually succeed, it must be allowed by both the identity-based policy and the permission boundary at the same time. Attaching a broad identity policy to a role does nothing beyond what the boundary also independently allows, which is exactly the point of using one.
How it differs from resource policies. A resource policy attaches to and is evaluated on behalf of the resource, deciding who may touch it, potentially reaching across account boundaries. A permission boundary attaches to and caps a specific principal, regardless of which resource that principal touches. One is resource-centric, the other principal-centric, and a boundary does not grant cross-account access the way a resource policy can; it only ever narrows what the principal it's attached to can do.
Scenario preventing privilege escalation. A common real situation: a team lead is delegated the ability to create IAM roles and policies so their team can self-serve provisioning, without that delegated administrator being able to grant themselves, or any role they create, permissions the organization never intended, including full administrative access. Without a permission boundary, a principal who can create and attach IAM policies can trivially self-escalate: create a new role, attach an administrator-access policy to it, and use it. Attaching a permission boundary to every role that delegated administrator is allowed to create, enforced by a condition on their own role-creation permission requiring any new role to carry a specific boundary policy, caps whatever identity policy they attach at that boundary's ceiling; even an administrator-access policy on the new role can't exceed it, closing the self-escalation path.
Worked example
The delegated administrator's role is granted iam:CreateRole, iam:PutRolePolicy, and iam:AttachRolePolicy, but only on the condition that any role created carries iam:PermissionsBoundary equal to a specific policy, DevTeamBoundary, that allows only a defined set of development-related actions and explicitly excludes IAM and other administrative actions:
{
"Effect": "Allow",
"Action": ["iam:CreateRole", "iam:PutRolePolicy", "iam:AttachRolePolicy"],
"Resource": "*",
"Condition": {
"StringEquals": {
"iam:PermissionsBoundary": "arn:aws:iam::123456789012:policy/DevTeamBoundary"
}
}
}
If the delegated administrator creates a role with an administrator-access policy attached, and the required boundary, the role is created, but any administrator-granted action is blocked at evaluation time by the intersection with the boundary, since the boundary's own policy never included those actions in the first place. If they instead try to create a role without the required boundary attached, the iam:CreateRole call itself is denied by the condition, closing that escape route too.
Trade-offs and pitfalls
The most common early confusion is treating a permission boundary as a grant: attaching only a boundary with no identity policy at all gives a principal literally nothing, since the boundary only ever narrows, never grants. A more serious pitfall is leaving the boundary policy itself, or the condition requiring its use, editable by the delegated administrator: if they can also modify or detach the boundary, or edit the condition enforcing it, the entire control is void, so the boundary policy and the enforcing condition must live outside the delegated administrator's own permission set entirely. A boundary defined too permissively "just to be safe" can end up functionally equivalent to no ceiling at all, defeating its purpose without anyone noticing until it's tested. Finally, permission boundaries must be applied identity by identity, which is a real operational trade-off against an organization-wide guardrail like a service control policy that applies automatically to every principal in scope, including ones created tomorrow: boundaries give more per-team customization, but a missed role when delegating a new administrator is a genuine coverage gap unless attaching one is itself automated or enforced.
In a backend service, describe the difference between authentication and authorization. Provide concrete examples showing where they differ in responsibilities (who verifies identity, who enforces permissions), and explain which component(s) in a microservices architecture (API gateway, identity provider, downstream services) should own each responsibility and why.
Sample Answer
Direct answer
Authentication (often shortened to authn) answers "who is this": it verifies a claimed identity against credentials, a token, or a certificate. Authorization (authz) answers "what is this identity allowed to do": it evaluates a policy against an identity that has already been established. In a backend service these must be two distinct steps in the request pipeline: authentication happens once to establish who is calling, and authorization is evaluated against the specific resource and action being requested, often more than once as a single request fans out across services.
Structured elaboration
The reason the two live in different places is that they have different natural owners:
- Identity provider (IdP): owns authentication issuance. It verifies credentials (password plus multi-factor authentication, or a delegated login via OAuth 2.0, OpenID Connect (OIDC), or SAML (Security Assertion Markup Language)) and issues a signed token or assertion carrying identity claims (subject id, roles, tenant id, and so on). This is a single, centralizable competency: one place that is very good at proving identity.
- API gateway: owns authentication enforcement. It is the natural chokepoint for validating a token's signature, expiration, and issuer before the request goes anywhere. A gateway can also do coarse-grained authorization, such as "is this endpoint public" or "does the caller have any valid session," but it should not evaluate business-specific permission rules, because it does not have visibility into every downstream service's domain data.
- Downstream (domain) services: own fine-grained authorization. Only the service that owns an invoice, a document, or a support ticket knows whether this identity is allowed to touch that specific record, because the decision depends on data the gateway never sees (who owns the row, what tenant it belongs to, what state it's in).
This split also explains how the different auth protocols and authorization models connect: OAuth 2.0 access tokens, OIDC ID tokens, and SAML assertions are just transport for identity claims. Those claims then feed either role-based access control (RBAC, where a roles claim maps directly to a permission set) or attribute-based access control (ABAC, where arbitrary claims like department, clearance level, or tenant id feed a policy engine's rules). Which protocol carried the claims does not change who evaluates the authorization decision; it only changes what shape the claims arrive in.
The split gets sharper, not simpler, in a cloud-native multi-tenant product. A SaaS platform typically stamps a tenant_id claim onto the identity at authentication time (issued by the IdP, validated by the gateway), but every downstream service must independently re-check that tenant_id against the resource it is about to return. Assuming the gateway "already handled" tenant isolation is one of the most common root causes behind real cross-tenant data leaks, because the gateway never saw the tenant id of the specific row three services deep.
Worked example
sequenceDiagram
participant C as Client
participant G as API Gateway
participant I as Identity Provider
participant S as Downstream Service
C->>G: Request + Bearer token
G->>I: Validate token signature and expiry
I-->>G: Token valid, claims returned
G->>S: Forward request + verified claims
S->>S: Authorize: does claims.sub own resource X?
S-->>C: 200 OK or 403 Forbidden
Trace a request to view invoice #4821:
- The client sends
GET /invoices/4821with a Bearer token. - The gateway authenticates: it validates the token's signature against the identity provider's public key and checks
exp,iss, andaud. If any check fails, it returns401 Unauthorizedbefore the request reaches any business logic. - The gateway forwards the request to
invoice-service, attaching the verified claims. invoice-serviceauthorizes: it checks thatclaims.tenant_idmatches the invoice's own tenant id, and thatclaims.rolesincludesinvoices:readorclaims.subequals the invoice's owner id. If that check fails, it returns403 Forbidden.
The two failure codes are not interchangeable, and conflating them is a very common bug: an expired or invalid token is a 401 ("we don't know who you are"), while a valid, well-known identity that simply lacks permission is a 403 ("we know exactly who you are, and the answer is no"). The reverse mistake shows up constantly in production: returning 403 for an expired token sends the client toward "ask an admin for access" instead of the actual fix, which is refreshing the token.
Trade-offs and pitfalls
- Pushing fine-grained authorization into the gateway couples shared edge infrastructure to every team's business rules, so a single team's permission change forces a redeploy of code everyone depends on. Coarse gateway-level checks are a fine optimization; they are not a substitute for the domain service's own check.
- Never assume a downstream service's authorization check is redundant because "the gateway already handles auth." Confused-deputy and tenant-isolation incidents in real multi-tenant breach postmortems trace back to exactly this assumption.
- Do not conflate authentication strength with authorization correctness. A login backed by strong multi-factor authentication says nothing about whether that specific user should see this specific record; the two questions are independent and both must be answered on every request.
Design an Attribute-Based Access Control (ABAC) system for a platform that requires dynamic, context-sensitive policies. Describe: a policy language/representation, how to source attributes (user, resource, environment), policy evaluation order and conflict resolution, caching for performance, attribute freshness guarantees, and how to interoperate with an existing RBAC system for backward compatibility.
Sample Answer
Direct answer
Represent policies in a declarative attribute-matching language, either structured JSON/YAML rule documents for simple deployments or a general policy language like Rego for real branching logic, evaluated by a policy decision point that pulls attributes from three distinct sources at request time: the identity provider for subject attributes, a resource metadata service for resource attributes (including sensitivity labels), and the request itself for environment context (time, network, tenant). Bridge the existing role-based access control (RBAC) system into attribute-based access control (ABAC) by treating a user's role as one more attribute a policy can reference, rather than replacing role assignments outright, so day-one interoperation is "add context-sensitive rules on top", not "migrate every existing permission".
Structured elaboration
Policy language and representation
- Use a declarative representation, not imperative code, so policies stay auditable and independently reviewable without reading application source: either a structured rule format (
{"effect": "allow", "condition": {...}}) for simple deployments, or a general policy language like Rego for real branching. - Each rule names the attributes it reads, a condition expression, an effect (Allow/Deny), and a priority, stored versioned and separate from the evaluator's own code, since a policy is data and data needs a change history.
Attribute sourcing (user, resource, environment)
- User attributes: sourced from the identity provider or directory at authentication time and embedded in or referenced by the session (role, department, clearance level).
- Resource attributes: sourced from the resource metadata store the application already maintains, for example a document's
tenant_idanddata_sensitivitylabel, fetched by resource id or attached as tags at write time so evaluation doesn't need a fresh lookup for static attributes. - Environment attributes: computed at request time and never stored (current time, calling network, device posture); these have no freshness question by construction, since they are generated fresh on every request.
- A policy information point (PIP) layer is the architectural name for the component responsible for fetching each attribute type from its actual source and handing it to the evaluator in one uniform shape, so the evaluator itself never needs to know whether an attribute came from the identity provider or the resource store.
Policy evaluation order and conflict resolution
- Multiple rules can match the same request with conflicting effects; resolve with an explicit combining algorithm, not "whichever rule happens to be listed first". Deny-overrides (any matching Deny wins regardless of how many Allows also matched) is the safe default, since it fails closed.
- Order rules by specificity within that combining algorithm (a rule naming an exact resource id can override a broader rule naming only a resource type), and keep an explicit documented default (deny if nothing matches), so "no rule mentions this case" can never silently mean allow.
Caching for performance
- Cache resource attributes, which change far less often than the request rate, with an explicit TTL and invalidate on write (evict a document's cache entry immediately when its sensitivity label changes, rather than waiting out the TTL).
- Cache full decisions per (subject, resource, action) tuple only when environment attributes are not part of the matched policy for that tuple, since an environment-dependent decision cannot be safely cached across requests without also caching the environment inputs, which defeats the purpose.
Attribute freshness guarantees
- State a different guarantee per attribute class rather than one blanket number: environment attributes are always fresh (computed per request); resource attributes are fresh within their cache TTL or immediately on a tracked write-path invalidation; user attributes are only as fresh as the identity provider's own session refresh cadence, often the loosest guarantee in the system (a role change may not take effect until the session token is refreshed), and that gap should be a stated, known property of the design, not a surprise found in an incident review.
RBAC interoperation for backward compatibility
- Do not replace the RBAC role-assignment tables. Expose "user has role X" as one more attribute the ABAC evaluator can read, a role-as-attribute bridge, so every existing RBAC-only permission check keeps working unmodified as a degenerate ABAC policy that only inspects the role attribute.
- New context-sensitive rules layer in incrementally alongside existing role checks (a rule such as "Allow if role=analyst AND resource.tenant_id == subject.tenant_id AND resource.data_sensitivity != 'restricted'" adds tenant and sensitivity context on top of a role check that already existed), the concrete migration path: RBAC is never ripped out, ABAC grows around it.
A second concrete domain this same design generalizes to: a data lake. The same policy language, attribute-sourcing model, conflict-resolution algorithm, and caching approach apply directly to a data lake serving analytics teams and external partners, with a different attribute set in place of the SaaS example's tenant_id: team (owning team), project, data_sensitivity, and data_location (a residency/region attribute). Two things shift in emphasis for this domain:
- Attribute sourcing leans harder on tag propagation through data lineage rather than a live per-request lookup, since a data lake's resource attributes (a table's sensitivity label) are set once by an ingestion pipeline and inherited by every downstream derived table, not attached at request time the way a SaaS request's
tenant_idis. - The conflict-resolution default must make inheritance itself narrow-only: a derived table produced by joining a confidential source with a public one must inherit AT LEAST confidential, never a diluted average of its inputs, mirroring the same fail-closed instinct as the deny-overrides default described above. Concretely, a table-materialization job that joins a
raw_customerstable (data_sensitivity=confidential) with aneventstable (data_sensitivity=internal) must propagate confidential to its output by default; an engineer can explicitly re-classify the result down to internal only as a deliberate, justified, logged action, never as the automatic result of inheriting the lower of its two sources' labels.
Worked example
Concrete rules for a multi-tenant SaaS platform, using the tenant_id and data_sensitivity attributes anchoring this scenario:
[
{
"id": "deny-cross-tenant",
"effect": "Deny",
"priority": 0,
"condition": {"attr": "resource.tenant_id", "op": "neq", "value_from": "subject.tenant_id"}
},
{
"id": "allow-analyst-same-tenant-nonrestricted",
"effect": "Allow",
"priority": 10,
"condition": {
"all": [
{"attr": "subject.role", "op": "eq", "value": "analyst"},
{"attr": "resource.tenant_id", "op": "eq", "value_from": "subject.tenant_id"},
{"attr": "resource.data_sensitivity", "op": "neq", "value": "restricted"}
]
}
}
]
Combining algorithm: deny-overrides. Trace two requests by hand:
Request A: subject.role=analyst, subject.tenant_id="acme", resource.tenant_id="acme", resource.data_sensitivity="internal".
deny-cross-tenant: isresource.tenant_id("acme") not equal tosubject.tenant_id("acme")? No, they're equal, rule does not match.allow-analyst-same-tenant-nonrestricted: role is analyst (true), tenant_id matches (true), sensitivity is not restricted (true), all three hold, rule matches, Allow.- No Deny matched, one Allow matched: decision = Allow, matched rule
allow-analyst-same-tenant-nonrestricted.
Request B: subject.role=analyst, subject.tenant_id="acme", resource.tenant_id="globex", resource.data_sensitivity="internal".
deny-cross-tenant: isresource.tenant_id("globex") not equal tosubject.tenant_id("acme")? Yes, rule matches, Deny.allow-analyst-same-tenant-nonrestricted: tenant_id condition fails (globex != acme), rule does not match.- Deny-overrides: decision = Deny, matched rule
deny-cross-tenant, regardless of evaluation order.
Trade-offs and pitfalls
- Deny-overrides is the safe default but can surprise policy authors who expect "the most specific rule wins" semantics; document the combining algorithm prominently, since a policy set with only Allow rules and an implicit default-deny reads very differently in your head than one where an explicit broad Deny rule can silently veto a much more specific Allow written afterward.
- Caching full decisions for policies that reference environment attributes is a classic bug pattern: caching a time-of-day-gated Allow past the boundary it was computed against serves a decision that is now wrong but looks like a correct cache hit; only cache full decisions for attribute combinations that exclude environment attributes.
- The role-as-attribute bridge is powerful precisely because it changes nothing about RBAC, but that also means it inherits every problem RBAC already had (role sprawl, stale role assignments); ABAC context rules layered on top narrow the blast radius of a stale role assignment, they do not fix the assignment itself.
- User-attribute freshness lagging behind an identity-provider session refresh is often the quietest gap in the whole design: a just-revoked role can still pass the role-as-attribute check until the session naturally refreshes, so any high-consequence role change needs an explicit session-invalidation step, not just an identity-provider record update.
Unlock Full Question Bank
Get access to all Identity, Authentication, and Access Management interview questions and detailed answers.
Sign in to ContinueJoin thousands of developers preparing for their dream job.