View Source

Policy Structure

Overview

This document defines the structure and configuration options for the Autheona Policy Engine rules. Policies are JSON-based rule sets evaluated by the AST-based engine to determine actions (allow, block, ignore) based on email, domain, and IP intelligence data.

Policy Structure

A Policy is the root container for all rules. It defines the schema version, the top-level rule set, and execution behavior.

{
  "version": "1.0",
  "stop_on_block": true,
  "parent_rules": [
    {
      "field": "domain_disposable",
      "operator": "==",
      "target": {
        "bool": true
      },
      "action": "block"
    }
  ]
}

Policy Fields

FieldTypeRequiredDescription
versionStringYesSchema version identifier for the policy.
stop_on_blockBooleanNoIf true, evaluation stops immediately when any rule with block action matches. Default is false.
parent_rulesArrayYesArray of top-level rules executed concurrently. Each rule is evaluated in a separate worker thread.

Rule Structure

A Rule is a single evaluation unit within the policy tree. Every rule acts as either a Logical Branch (grouping other rules) or a Leaf Condition (performing a comparison).

Leaf Condition Structure

{
  "field": "email_deliverable",
  "operator": "==",
  "target": {
    "bool": false
  },
  "action": "block"
}

Logical Branch Structures

AND Branch (all children must match):

{
  "and_rules": [
    {
      "field": "domain_valid_tld",
      "operator": "==",
      "target": {
        "bool": true
      },
      "action": "allow"
    },
    {
      "field": "email_deliverable",
      "operator": "==",
      "target": {
        "bool": true
      },
      "action": "allow"
    }
  ]
}

OR Branch (any child must match):

{
  "or_rules": [
    {
      "field": "domain_disposable",
      "operator": "==",
      "target": {
        "bool": true
      },
      "action": "block"
    },
    {
      "field": "domain_typo",
      "operator": "==",
      "target": {
        "bool": true
      },
      "action": "block"
    }
  ]
}

NOT Branch (negates the child rule):

{
  "not_rule": {
    "field": "domain_valid_tld",
    "operator": "==",
    "target": {
      "bool": true
    },
    "action": "block"
  }
}

Rule Fields

FieldTypeRequiredDescription
fieldStringYes (for leaf)The data point to inspect. See Available Fields.
operatorStringYes (for leaf)Comparison operator. See Operators.
targetObjectYes (for leaf)Expected value for comparison. Contains bool, number, or string property.
actionStringYes (for leaf)Action to take if the condition matches: allow, block, or ignore.
paramsObjectNoAdditional parameters for specific field evaluations.
and_rulesArrayYes (for branch)Array of rules where ALL must match.
or_rulesArrayYes (for branch)Array of rules where ANY must match.
not_ruleObjectYes (for branch)Single rule to negate.

Actions

Actions define the verdict applied when a rule condition matches.

ActionBehavior
allowPermits the request. Lowest priority; overridden by block.
blockBlocks the request. Highest priority in the security hierarchy.
ignoreEvaluates the rule but produces no action. Used for shadow mode testing.

Action Resolution Hierarchy

The engine uses a Fail-Closed security posture. When multiple actions are triggered:

  1. block (highest priority)
  2. allow (lowest priority)

If any rule triggers a block, it overrides all permissive rules.

Operators

Operators define how the field value is compared against the target.

Boolean Operators

OperatorDescription
==Equal to
!=Not equal to

Numeric Operators

OperatorDescription
==Equal to
!=Not equal to
<Less than
>Greater than
<=Less than or equal to
>=Greater than or equal to

List Operator

OperatorDescription
listChecks if the field value exists within a referenced named list.

Available Fields

Fields are categorized by their target value type and the supported operators.

Boolean Fields

These fields evaluate to true or false. Supported operators: ==, !=.

Email Boolean Fields

FieldDescription
domain_businessDomain is classified as business type.
domain_disposableDomain is a known disposable email provider.
domain_educationalDomain is an educational institution.
domain_freeDomain is a free email provider (e.g., gmail.com).
domain_governmentDomain is a government entity.
domain_ipv4_addressDomain resolves to an IPv4 address.
domain_ipv6_addressDomain resolves to an IPv6 address.
domain_numeric_onlyDomain consists of numeric characters only.
domain_punycodeEmail uses punycode encoding.
domain_single_labelDomain has only one label (no dots).
domain_typoDomain is a common typo of a legitimate domain.
domain_valid_tldDomain has a valid Top-Level Domain.
domain_websiteDomain is a registered website.
email_deliverableEmail address is deliverable (MX record exists).
local_dot_variationsLocal part has dot variations (e.g., j.doe vs jdoe).
local_fraud_patternLocal part matches known fraud patterns.
local_hyphenLocal part contains hyphens.
local_mixed_scriptEmail contains mixed Unicode scripts.
local_numericLocal part contains numeric characters.
local_plus_addressingLocal part uses plus addressing (e.g., +tag).
local_quotedLocal part is quoted.
local_role_basedLocal part is a role address (e.g., admin@).
local_special_charsLocal part contains special characters.
local_underscoreLocal part contains underscores.
subdomain_hyphenatedSubdomain contains hyphens.
subdomain_numeric_onlySubdomain is numeric only.
subdomain_uuid_hashSubdomain resembles a UUID or hash.
subdomain_wildcardSubdomain is a wildcard record.

Numeric Fields

These fields evaluate to a number. Supported operators: ==, !=, <, >, <=, >=.

Email Numeric Fields

FieldDescriptionMinimum ValueMaximum Value
domain_age_daysAge of the domain registration in days.11024
email_velocityFrequency/volume of emails from this address.11024
subdomain_countNumber of subdomains for the domain.132

String List Fields

These fields check if a value exists within a user-defined list. Supported operator: list.

Email String List Fields

FieldDescriptionTarget Format
domain_custom_domainsChecks against a custom domain list.List UUID string
domain_custom_tldsChecks against a custom TLD list.List UUID string
local_custom_rolesChecks against a custom role-based local part list.List UUID string

Target Configuration

The target object specifies the expected value for comparison. Only include the field matching the rule's data type.

Boolean Target

{
  "target": {
    "bool": true
  }
}

{
  "target": {
    "bool": false
  }
}

Numeric Target

{
  "target": {
    "number": 30
  }
}

{
  "target": {
    "number": 5.5
  }
}

String Target (for List Operator)

{
  "target": {
    "string": "reference-key"
  }
}

Example Policies

Block Disposable Emails

Blocks any email from a disposable email provider.

{
  "version": "1.0",
  "stop_on_block": true,
  "parent_rules": [
    {
      "field": "domain_disposable",
      "operator": "==",
      "target": {
        "bool": true
      },
      "action": "block"
    }
  ]
}

Block Undeliverable and Fraudulent Emails

Uses an OR branch to check multiple conditions.

{
  "version": "1.0",
  "stop_on_block": false,
  "parent_rules": [
    {
      "or_rules": [
        {
          "field": "email_deliverable",
          "operator": "==",
          "target": {
            "bool": false
          },
          "action": "block"
        },
        {
          "field": "local_fraud_pattern",
          "operator": "==",
          "target": {
            "bool": true
          },
          "action": "block"
        }
      ]
    }
  ]
}

Allow Only Corporate Domains

Uses the list operator to check against a custom domain whitelist.

{
  "version": "1.0",
  "stop_on_block": true,
  "parent_rules": [
    {
      "field": "domain_custom_domains",
      "operator": "list",
      "target": {
        "string": "reference-key"
      },
      "action": "allow"
    },
    {
      "field": "domain_custom_domains",
      "operator": "list",
      "target": {
        "string": "reference-key"
      },
      "action": "block"
    }
  ]
}

Complex Multi-Condition Policy

Combines AND and OR logic with short-circuit evaluation.

{
  "version": "1.0",
  "stop_on_block": true,
  "parent_rules": [
    {
      "and_rules": [
        {
          "field": "domain_valid_tld",
          "operator": "==",
          "target": {
            "bool": true
          },
          "action": "ignore"
        },
        {
          "or_rules": [
            {
              "field": "domain_age_days",
              "operator": "<",
              "target": {
                "number": 30
              },
              "action": "block"
            },
            {
              "field": "subdomain_count",
              "operator": ">",
              "target": {
                "number": 10
              },
              "action": "allow"
            }
          ]
        }
      ]
    }
  ]
}