Reference
Auth
Security Model

Security Model

The Auth service uses a three-layer security model that cleanly separates authentication, authorization, and resource identification.

┌─────────────────────────────────────────────────────────────────┐
│                        API Gateway                               │
│  ┌──────────────┐    ┌──────────────┐    ┌──────────────┐      │
│  │ API Key Auth │───▶│   Principal  │───▶│    Policy    │      │
│  │  (SHA256)    │    │  Extraction  │    │   Evaluator  │      │
│  └──────────────┘    └──────────────┘    └──────────────┘      │
│                                                 │                │
│                                                 ▼                │
│                                          ┌──────────────┐       │
│                                          │   Decision   │       │
│                                          │ Allow / Deny │       │
│                                          └──────────────┘       │
└─────────────────────────────────────────────────────────────────┘
LayerComponentResponsibility
AuthenticationAPI Key AuthenticatorVerify identity, extract Principal
AuthorizationPolicy EvaluatorPolicy-based access decisions
ResourcesTRNUnified resource identifiers

Principal Types

Every authenticated request is associated with a Principal — the identity performing the action. There are exactly three principal types:

User

Human operators interacting with the system through CLI, API, or Studio.

{ "type": "user", "id": "alice" }

Use cases:

  • Developers managing functions and workflows
  • Operators monitoring executions
  • Administrators configuring policies

Agent

Automated programs and bots that execute on behalf of users or systems.

{ "type": "agent", "id": "data-processor" }

Use cases:

  • CI/CD pipelines deploying functions
  • Data processing jobs
  • Scheduled automation tasks

System

Internal services and engines that are part of the AionixOne platform.

{ "type": "system", "id": "stepflow-engine" }

Use cases:

  • StepFlow engine invoking functions during workflow execution
  • Igniter triggering workflows based on events
  • Internal service-to-service communication

Action Types

Actions define what an operation does. There are exactly 8 action types, divided into three categories:

Write Operations

ActionDescriptionExample
DeclareCreate new resourcesCreate a function, deploy a workflow
UpdateModify existing resourcesUpdate config, enable/disable resources
DeleteRemove resourcesDelete functions, revoke API keys

Read Operations

ActionDescriptionExample
ReadView resourcesList items, get details, view logs

Runtime Operations

ActionDescriptionExample
ExecuteRun workflowsStart StepFlow executions
InvokeCall functionsInvoke AionixFn functions
EmitSend eventsTrigger event-driven flows
ScheduleSchedule tasksCreate cron jobs, set timers

TRN Resources

Every resource in AionixOne has a TRN (Tenant Resource Name) — a unique identifier that policies use to grant or deny access.

Format

trn:{service}:{tenant}:{path}

Auth Service TRNs

TRNDescription
trn:auth:default:key/ak_JBsp2nuFgPl4API key in default workspace
trn:auth:prod:key/ak_prod_xyzAPI key in prod workspace
trn:auth:default:policy/admin:aliceAdmin policy for alice
trn:auth:*:key/*All API keys in all workspaces

Wildcards

Policies can use wildcards to match multiple resources:

PatternMatches
trn:aionixfn:*:function/*All functions in all workspaces
trn:auth:*:key/*All API keys
trn:stepflow:prod:*All StepFlow resources in prod
trn:*Super wildcard — matches everything

API Key Authentication

API keys are the primary authentication mechanism. Each key is tied to a specific principal.

Format

ak_{keyId}_{secret}

Example: ak_JBsp2nuFgPl4_vZqNKeyoJp2qNXrZm1H2q6OQTIheeAps
         ├─────────────┤ ├────────────────────────────────┤
             Key ID              Secret (32 chars)

Usage

# Method 1: X-API-Key Header (recommended)
curl -H "X-API-Key: ak_xxx_yyy" https://api.aionixone.com/...
 
# Method 2: Authorization Bearer
curl -H "Authorization: Bearer ak_xxx_yyy" https://api.aionixone.com/...

Security Features

FeatureDescription
SHA256 Hash StoragePlaintext keys are never stored in the database
One-Time DisplayKeys shown only at creation, cannot be recovered
Instant RevocationKeys can be disabled immediately
Audit TraillastUsedAt tracking for all key usage

Decision Flow

When a request arrives, the Auth service evaluates it through this flow:

1. Extract API Key from request headers
2. Validate key format (ak_{keyId}_{secret})
3. Hash secret with SHA256
4. Lookup key by ID, compare hash
5. Extract Principal from key record
6. Build authorization context:
   - Principal: { type, id }
   - Action: The operation being performed
   - Resource: The TRN being accessed
7. Evaluate all matching policies
8. Return decision: Allow or Deny

If any step fails, the request is rejected with the appropriate HTTP status:

CodeMeaning
401Authentication failed (invalid or missing API key)
403Authorization failed (no matching allow policy)