Raxol.Agent.Authorization.Server (Raxol Agent v2.6.0)

Copy Markdown View Source

Per-workflow authorization engine as a GenServer.

Holds the ordered policy list and the engine State (labels, approvals), and serializes evaluate/approve so concurrent phases never race the label state. ALLOW and DENY decisions commit their labels immediately; ASK decisions commit the prior-ALLOW labels but hold their own writes in escrow until approve/2.

Pending ASKs are keyed by evaluation route, so a spawn tree (one root route) has at most one outstanding approval, and approve/2 releases it for the whole tree.

Summary

Functions

Approve the pending ASK for route: release escrow and remember it.

Returns a specification to start this module under a supervisor.

Evaluate the policies at phase. Returns a Engine.Decision.

The current label snapshot.

Reject the pending ASK for route (drops it; no label change).

Start the engine.

Types

server()

@type server() :: GenServer.server()

Functions

approve(server, route \\ :default)

@spec approve(server(), term()) :: :ok | {:error, :no_pending}

Approve the pending ASK for route: release escrow and remember it.

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

evaluate(server, phase, context, opts \\ [])

Evaluate the policies at phase. Returns a Engine.Decision.

labels(server)

@spec labels(server()) :: map()

The current label snapshot.

reject(server, route \\ :default)

@spec reject(server(), term()) :: :ok | {:error, :no_pending}

Reject the pending ASK for route (drops it; no label change).

start_link(opts \\ [])

@spec start_link(keyword()) :: GenServer.on_start()

Start the engine.

Options: :policies (ordered list), :labels, :monotonic, :name.