Skip to main content

ABAC Conditions

ABAC (Attribute-Based Access Control) conditions let you add fine-grained rules to any policy. A condition compares attributes from the subject, resource, or request context at evaluation time.

A policy with conditions only grants access when all conditions pass. If any condition fails, the policy does not match — even if the subject, action, and resource match.

Condition structure

Each condition has three parts:

FieldDescription
attribute_pathThe left-hand attribute to check (e.g., subject.attributes.department)
operatorThe comparison operator (e.g., equals, in, greater_than)
valueThe right-hand value — either a literal or another attribute path

Attribute paths

Attribute paths use dot notation to reference values from the authorization request:

PrefixSourceExample
subject.attributes.*Subject attributessubject.attributes.department
resource.attributes.*Resource attributesresource.attributes.classification
context.*Request contextcontext.ip_address

Nested attributes are supported via dot-path traversal. For example, if a subject has attributes.manager.region, you can reference it as subject.attributes.manager.region.

Operators

OperatorDescriptionExample
equalsExact matchdepartment equals "engineering"
not_equalsNot equalstatus not_equals "suspended"
inValue is in a listrole in ["admin", "editor"]
not_inValue is not in a listdepartment not_in ["finance"]
containsString/array containstags contains "sensitive"
greater_thanNumeric comparisonlevel greater_than 3
less_thanNumeric comparisonclearance less_than 5
greater_than_or_equalNumeric comparisonage greater_than_or_equal 18
less_than_or_equalNumeric comparisonpriority less_than_or_equal 100

Value types

The right-hand value can be:

Literal value

A static value to compare against:

{
"attribute_path": "subject.attributes.department",
"operator": "equals",
"value": "engineering"
}

Attribute reference

Compare against another attribute in the request — useful for matching subject attributes to resource attributes:

{
"attribute_path": "subject.attributes.department",
"operator": "equals",
"value": {
"type": "attribute",
"path": "resource.attributes.department"
}
}

This condition passes only when the subject's department matches the resource's department.

Examples

Department-scoped access

Allow users to read documents only in their own department:

{
"name": "department-scoped-read",
"effect": "ALLOW",
"actions": ["read"],
"conditions": [
{
"attribute_path": "subject.attributes.department",
"operator": "equals",
"value": {
"type": "attribute",
"path": "resource.attributes.department"
}
}
]
}

Classification-based restriction

Only allow access to classified documents for users with sufficient clearance:

{
"conditions": [
{
"attribute_path": "subject.attributes.clearance_level",
"operator": "greater_than_or_equal",
"value": {
"type": "attribute",
"path": "resource.attributes.required_clearance"
}
}
]
}

IP-based access control

Restrict write access to requests from the corporate network:

{
"conditions": [
{
"attribute_path": "context.network",
"operator": "equals",
"value": "corporate"
}
]
}

Multiple conditions (all must pass)

Allow admin access only for senior engineers in the platform team:

{
"conditions": [
{
"attribute_path": "subject.attributes.level",
"operator": "greater_than_or_equal",
"value": 5
},
{
"attribute_path": "subject.attributes.team",
"operator": "equals",
"value": "platform"
}
]
}

Terraform example

resource "authzx_policy" "dept_scoped_read" {
application_id = authzx_application.crm.id
name = "department-scoped-read"
effect = "ALLOW"
priority = 50

resources = [{
resource_id = authzx_resource_type.document.id
actions = ["read"]
}]

conditions = [
{
attribute_path = "subject.attributes.department"
operator = "equals"
value = jsonencode({
type = "attribute"
path = "resource.attributes.department"
})
}
]
}

In the evaluate request

For conditions to work, include the properties in your authorization request:

{
"subject": {
"id": "user-123",
"type": "user",
"properties": {
"department": "engineering",
"level": 5
}
},
"resource": {
"type": "document",
"name": "Engineering Wiki",
"properties": {
"department": "engineering",
"classification": "internal"
}
},
"action": { "name": "read" },
"context": {
"ip_address": "10.0.0.42",
"network": "corporate"
}
}

Properties provided in the request are merged with stored properties. If the same key exists in both, the request value takes precedence. attributes is accepted as an alias for properties. See Context & Trust Model for the trust hierarchy.