Skip to main content

AGENTASIAN security model

Status: Ready

Truth label: Limited

Audience: System designer

Reader outcome: Read the assets, actors, trust zones, implemented controls, named gaps, deployment checklist, and incident procedures.

Last verified: 2026-09-13

Release position: the current build is suitable only for a trusted operator, trusted machines, and trusted repositories. It is not approved for confidential multi-client production or hostile code execution.

1. Assets​

AGENTASIAN protects:

  • client source code and repository history
  • client decisions, tasks, results, and learnings
  • internal rules and shared methodology
  • conversations and ingested documents
  • prompts, model responses, and raw traces
  • provider API keys and CLI credentials
  • fleet, operator, worker, and run tokens
  • project paths and host information
  • operator approvals and grades
  • execution integrity and task-state history

2. Actors​

ActorIntended trust
OperatorFully trusted
Cortex browserTrusted operator endpoint
Brain processTrusted service
Forge Central processTrusted control plane
Forge Worker processTrusted fleet service
Coding-agent CLIPartially trusted executor
Repository content and testsUntrusted input unless reviewed
Retrieved knowledgeUntrusted evidence
LLM providerExternal data processor for sent prompts
LAN peerUntrusted unless explicitly allowed
Client userNo direct access is supported

The main security mistake to avoid is treating a coding-agent child process as equivalent to the trusted worker service that launched it.

3. Trust zones​

Zone A: operator
Cortex browser and direct operator API calls

Zone B: control services
Brain and Forge Central

Zone C: fleet services
Forge Worker identity, lease watcher, outbox, and credential store

Zone D: execution child
Claude, Codex, Antigravity, test commands, and repository processes

Zone E: external providers
cloud LLM APIs, remote package and source services

Zone F: stored evidence
CPMI, Chroma, conversations, task results, and ingested documents

Zone D and Zone F must not gain Zone A or Zone B authority. Current implementation does not enforce that separation completely.

4. Implemented controls​

4.1 Network perimeter​

  • Launch scripts bind to loopback by default.
  • Without a fleet token, non-loopback API requests are rejected.
  • With a fleet token, all non-health API requests require it.
  • Browser origins have an explicit allowlist with local defaults.
  • Windows firewall scoping is part of the documented LAN procedure.

4.2 Project path control​

  • Project registration can be restricted to allowed roots.
  • Remote requests default to the configured projects directory when a fleet token is enabled and no explicit root list exists.
  • Foreign paths must be absolute and may not contain ...
  • spec_file must remain inside the project root.

4.3 Worker identity​

  • First registration mints a 32-byte random token.
  • Central stores only a SHA-256 hash.
  • Re-registration of a credentialed identity requires the token.
  • Heartbeat, worker-aware polling, claim, and task-scope resolution verify the worker token.

4.4 Run integrity​

  • Credentialed claims mint a separate run token.
  • The run token is bound to task id and fence.
  • Lease and result writes verify the run token when a row exists.
  • Terminal writes are fenced and deduplicated.
  • Stale results are recorded but cannot replace a newer attempt.

4.5 Execution authority​

  • Each task requests safe, write, or yolo.
  • The worker has an independent maximum-permission ceiling.
  • Engine adapters map the resolved permission to native flags.
  • yolo is explicit and visibly warned at worker startup.

4.6 Provider credentials​

  • Provider-key distribution is disabled by default.
  • CLI-agent execution normally uses the CLI's own local login.
  • Dynamic voice examples must be approved.
  • Cloud prompts use only voice examples marked cloud-allowed.

4.7 Retrieval trust​

  • Repository controls are read directly as trusted instructions.
  • Retrieved CPMI and knowledge are labeled as untrusted evidence.
  • Code-owned reasoning lenses and voice registers remain separate from retrieved source text.
  • Scoped CPMI and learning HTTP searches fail closed when Forge scope resolution is unavailable.

4.8 Browser rendering​

  • Model Markdown is passed through DOMPurify before insertion.
  • External marked and DOMPurify scripts use subresource-integrity hashes.
  • CORS does not allow credentials.

5. P0 control-plane authority gap​

Condition​

The same fleet bearer authorizes service traffic and most operator actions. Sensitive routes such as checkpoint approval, task deletion, project changes, rule changes, document changes, and knowledge promotion do not require a separate operator credential.

The worker loads .env into its process environment. The shared CLI executor builds _dispatch_env by copying all of os.environ and then prepending the project virtual environment. CLI and verification children therefore inherit the worker environment.

On a co-hosted deployment, a child can also reach loopback services when no fleet token is configured.

Impact​

A malicious or prompt-injected execution child can potentially:

  • call operator APIs
  • approve or reject another held task
  • cancel or delete work
  • read projects, tasks, results, and traces
  • alter rules and persistent knowledge
  • promote attacker-authored content into future retrieval
  • read inherited provider and service credentials
  • request provider keys when distribution is enabled

Required design​

  1. Define separate operator, service, worker, and run principals.
  2. Require operator authorization for every control-plane mutation and sensitive read.
  3. Keep service-to-service credentials out of execution children.
  4. Launch every CLI and verification process with an explicit minimal environment allowlist.
  5. Remove unrelated provider keys and control-plane URLs from children.
  6. Use an authenticated local proxy or capability token when an execution child legitimately needs one narrow operation.
  7. Test the boundary with a task that tries every operator route.

This is a release blocker for untrusted repositories and multi-client work.

5b. Chat attachments read files the operator picks​

POST /chat/attachments reads a file the operator names and places its content in the chat prompt as untrusted evidence. It never writes and never deletes, and clearing a conversation drops its attachments without touching disk.

The gate is the act of picking. AA_ATTACHMENT_ROOTS restricts picking to named directories when set; unset, any path the Brain process can read may be attached. Because the shared token is the effective operator credential and Brain is reachable off loopback, an unset value makes the chat API an arbitrary file-read primitive for any token holder. Set the roots on any host where the token is shared, or keep Brain on loopback.

Caps: 400 KB per file, 1.2 MB per conversation, 40 attachments, UTF-8 text only, and no path containing a dot-prefixed component.

5c. A voice pack is prompt authority, not data​

A pack supplies lens principles, register instructions, and delivery exemplars that reach the trusted region of the system prompt. A third-party pack is untrusted input and must be read in full before its directory is named in VOICE_PACK_DIR or VOICE_PACKS. There is no sandbox and there cannot be one: the content is instructions to a model by design.

What the loader enforces, replacing guarantees a Python constant gave for free:

  • Control characters, Unicode line separators, and format characters are rejected, so a value is exactly one line and cannot forge a section header.
  • A value may not begin with ** or #, which is what actually stops a forged header. The structural-token denylist is defense in depth, not the control.
  • boundaries, header, and prompt_section are load errors, so the fact-preservation sentences cannot be weakened or supplied by a pack.
  • Ids and categories are charset-checked with \A/\Z anchors; $ also matches before a trailing newline and let an id split the exemplar tag.
  • Rendered text is escaped: html.escape for attributes, </> only for bodies and prose, so an apostrophe survives.
  • A pack root cannot be ingested, and preflight rule 5 makes an overlapping content-root configuration a named error rather than a silent skip.
  • voice_examples is unreachable through the generic knowledge endpoints, including the PUT that previously wrote an unvalidated metadata dict and could flip a local-only example to cloud-allowed.
  • An exemplar carries a required privacy field and is withheld from a non-local provider. Locality is derived from the resolved host, not from the provider name, because a remote Ollama is still another machine.
  • Every pack file is hashed, and generation_settings.voice_packs records the hashes that shaped each reply. That auditability is the control that replaced a self-asserted approved = true inside the artifact it authorized.

6. P0 client-scope enforcement gap​

Intended policy​

For scope X:

  • internal requests see internal records
  • a client request sees its records plus explicitly shared internal methodology
  • all-scope requests require the operator token and are audited
  • failed scope resolution returns no records

Implemented scoped paths​

  • GET /cpmi/search
  • GET /knowledge/search for learnings
  • worker task-scope resolution through Forge

Bypass paths​

  • chat auto-retrieval directly calls CPMI and Chroma
  • LangGraph CPMI tools directly call the index
  • LangGraph knowledge tools directly call Chroma
  • direct CPMI record retrieval has no scope check
  • direct knowledge document CRUD has no scope check
  • ChatRequest has no scope field
  • Cortex has no client-scope selector

Additional weakness​

Worker task-scope resolution verifies persistent worker assignment, not the claim's run token. One worker holding or retaining assignments for two clients can resolve either task scope.

Required design​

  1. Create one retrieval gateway used by HTTP, chat, tools, and workers.
  2. Require a structured scope context on every retrieval call.
  3. Bind worker scope to task, fence, and run token.
  4. Make full-record reads recheck scope.
  5. Treat direct collection CRUD as operator-only.
  6. Add client scope to chat and Cortex.
  7. Make all visibly exceptional and record who used it.
  8. Add two-client tests for every search and record-read path.
  9. Add negative tests proving a malicious tool cannot bypass the gateway.

This is a release blocker before client number two.

7. P1 safe-execution gap​

Condition​

safe maps to an engine's plan or read-only mode, but the worker also:

  • pre-authorizes pytest commands for Claude plan mode
  • runs the configured verification command outside the engine permission mode
  • inherits repository Git configuration for git diff
  • provides no OS-level network, process, secret, or filesystem isolation

Tests and verification programs execute repository code. They can write files, read secrets, start child processes, and use the network.

Required design​

  • run safe work in a restricted OS account, container, VM, or equivalent
  • mount the project read-only for analysis
  • use a separate isolated verification runner
  • define reviewed verification capabilities instead of arbitrary executables
  • deny network access unless the task explicitly needs it
  • provide only task-scoped temporary credentials
  • kill descendant processes when the task ends or loses its lease

Until then, safe means a CLI policy request, not a proven no-side-effect boundary.

8. P1 trace privacy gap​

Task-run traces include the full task result in the indexed outcome, and the trace API returns it. This contradicts the intended manifest-only API.

Required controls:

  • remove result and error bodies from the public trace index
  • keep content in protected raw artifacts
  • authorize artifact access separately
  • add retention and deletion policy
  • test that trace APIs contain hashes, counts, provenance, and references only

9. P1 backup confidentiality and completeness gap​

The Central backup omits decision, scope-audit, candidate-resolution, worker credential, and outbox state. Archives are not encrypted and have no manifest or checksum. Remote-worker state is outside the Central data root.

Required controls:

  • separate Central and worker backup policies
  • encrypt credential, outbox, trace, and client-content archives
  • generate a signed or hashed manifest
  • validate restore automatically
  • restrict backup directory access
  • define retention and secure deletion

10. P1 knowledge-promotion gap​

The promotion route requires an operator-authored generalized summary and an acknowledgment, but it does not verify that the run id is an unresolved candidate. It also uses only the fleet bearer.

Promoted records carry shared=true, but client-scoped knowledge search does not currently return them. This is both an authorization risk and a broken contract.

Required controls:

  • operator-only authorization
  • validate the run, grade, unresolved state, and source scope
  • make promotion idempotent
  • record operator identity, timestamp, source hash, and decision
  • apply shared-methodology filtering through the central retrieval gateway
  • test that no client content is copied or automatically prefilled

11. Browser risk​

Cortex stores the fleet bearer in local storage. Any successful script execution in the origin can read it. The application sanitizes model Markdown and pins CDN resource integrity, but it does not set a visible content security policy and still depends on externally hosted JavaScript.

Recommended controls:

  • vendor static dependencies
  • set a restrictive CSP
  • separate the operator credential from the fleet bearer
  • prefer an HTTP-only same-site operator session through a local gateway
  • prevent framing
  • clear credentials on logout and browser-profile disposal

12. Server-side file access​

POST /knowledge/ingest accepts a server-side path. Conversation names are also used to construct JSON filenames. These are operator conveniences, not public upload APIs.

Protect them with operator authorization and explicit allowed roots. Treat any future customer-facing upload flow as a separate service with content limits, type validation, quarantine, and malware scanning.

13. Provider egress​

Cloud chat and cloud-backed CLI agents can receive:

  • user prompts
  • task descriptions
  • repository instructions
  • selected repository history
  • session and parent-task context
  • retrieved knowledge
  • file contents read by the engine

Current traces record prompt shape and hashes, but those records do not prove which files a third-party CLI read after launch.

Before client work:

  • document the provider and region approved for each client
  • prevent cross-client retrieval
  • restrict worker tools and paths
  • record provider, model, task, scope, and operator consent
  • apply provider retention and training opt-out requirements

14. Denial-of-service and resource controls​

The APIs are intended for a trusted operator. Several numeric and content fields have loose or inconsistent bounds. An authenticated caller can request large retrievals, ingest large directories, create many tasks, or launch costly runs.

Recommended controls:

  • request-size limits
  • per-route bounds
  • rate limits for chat, ingestion, task creation, and provider calls
  • queue and cost quotas
  • per-task disk and process limits
  • ingestion file-count and byte limits
  • alerts for unusual task, token, and cost volume

15. Security logging​

Current evidence includes:

  • worker registration and heartbeat state
  • run and chat traces
  • checkpoint decisions and grades
  • scoped-search denial counts
  • worker and supervisor logs
  • superseded and duplicate outcomes

Missing or incomplete evidence includes:

  • authenticated operator identity
  • route-level authorization decisions
  • child-process environment manifest
  • full all-scope search identity
  • artifact access logs
  • backup access and restore events
  • reliable alerts outside the Cortex browser session

Do not interpret scope_audit.jsonl as proof of no leakage. It records only calls that reached the scope filter.

16. Deployment security checklist​

Single-host pilot​

  • bind to loopback
  • use trusted repositories only
  • disable provider-key distribution
  • review worker maximum permission
  • use a dedicated browser profile
  • protect the data root with operating-system permissions
  • treat all task children as able to reach local services

Trusted LAN pilot​

  • set a random fleet bearer
  • set exact CORS origins
  • set explicit project roots
  • restrict firewall sources
  • protect traffic with a trusted private network or TLS gateway
  • keep Cortex off untrusted devices
  • verify worker credential file permissions
  • do not process confidential work from two clients

Production gate​

Production requires all of these:

  • P0 control-plane authorization closed
  • P0 retrieval-scope bypasses closed
  • run-token-bound scope proven
  • safe-execution boundary defined and tested
  • complete encrypted backups and successful restore drill
  • external health and checkpoint alerts
  • per-client provider and retention policy
  • dependency locking and security scanning
  • documented incident and credential-rotation procedures

17. Incident procedures​

Suspected fleet-token exposure​

  1. Stop remote API access at the firewall.
  2. Stop workers that may contain the token.
  3. Rotate AA_API_TOKEN on Brain, Central, Cortex, and every worker.
  4. Review tasks, projects, rules, knowledge, decisions, traces, and candidates for unauthorized changes.
  5. Rotate provider keys present in affected worker environments.
  6. Preserve logs and raw traces before cleanup.

Suspected worker-token exposure​

  1. Stop the worker.
  2. Delete its Central registration.
  3. Remove the local credential file.
  4. Re-register to mint a new credential.
  5. Review tasks assigned to that worker and all current outbox entries.

Suspected cross-client retrieval​

  1. Stop the affected chat or task workflow.
  2. Preserve the turn or run trace and source records.
  3. Identify every retrieval path used, including direct tools.
  4. Do not promote or reuse the result.
  5. Notify the operator responsible for client handling.
  6. Keep multi-client operation disabled until the bypass is fixed and tested.