coloa

Security: threat model, review status, pentest brief

What Coloa protects, against whom, what has been checked, and what an external penetration test should focus on. Keep this current when a finding is fixed or a design changes.

What Coloa promises

  1. Secrets never reach code. Functions, services and agents hold placeholders. The gateway inserts real values only for each secret’s hosts, and only in headers and URLs unless a human allows bodies.
  2. Data access is decided by the database. schema.coloa rules compile to Postgres row-level security, so a bug in app code can’t widen access.
  3. Agents can’t change production or their own permissions. Promotions, approvals, secrets, egress, budgets and the sandbox requirement are human-only. Agents run in the sandbox, where their identity comes from a session token.
  4. Every decision is recorded in a hash-chained audit log, anchored outside the project.
  5. Spending stops at the cap. LLM and egress traffic is metered at the gateway.

Who we defend against

Attacker Example In scope
A prompt-injected or careless agent Sends a key to a pastebin, drops a column, loosens a rule Yes, the main case
Malicious app code (written by an agent) Exfiltrates data through allowed hosts, forges audit labels Yes
An app’s end users Reads other users’ rows or files, CSRF, session theft Yes
Another app on the same coloa server Reaches another app’s database, files, console or previews Yes
A person with a valid human token who isn’t an owner Promotes an app they don’t own Yes (org policy)
Software on the host running as the same OS user Reads ~/.coloa/master.key No. Use a separate OS account or machine.
Root on the host, or access to the Docker socket Anything No

Trust boundaries

Internal review (2026-11-30)

An independent reviewer read the code adversarially, without being told our conclusions. Status:

# Finding Severity Status
1 A preview named after the app captured the production hostname Critical Fixed: previews only at exactly <env>.<app>.<domain>
2 Database names were ambiguous (shop+x-prod = shop-x+prod), so a preview could take over another app’s production database Critical Fixed: coloa_<app>__<env>, no -- in names, owner tag on each database, adoption of foreign databases refused
3 An agent’s push changed the code that production services run, without approval High Fixed: services run a snapshot made by a human push or a promotion
4 Previews reached production service containers with preview identities High Fixed: previews don’t reach services
5 Sibling apps and previews are the same site, so cross-site requests carried cookies and sessions could be planted High Fixed: __Host- cookie over HTTPS; cookie-authenticated state changes need Sec-Fetch-Site: same-origin or a matching Origin
6 Each session lookup opened a superuser connection, and Argon2 floods weren’t limited Medium-high Fixed: pooled auth connections (4), at most 4 password hashes at once
7 ./.coloa in a pushed tarball got past the filter Medium Fixed
8 like and sorting on @sensitive columns leaked values bit by bit Medium Fixed: only exact matches and null checks. Masking still only catches exact values (see below)
9 A secret could be stored on an allowed host and read back in pieces Medium Mitigated: secrets in headers and URLs only unless in_body: true; Range is dropped when a secret is injected
10 IPv6 forms with an embedded IPv4 address skipped the private-address filter Low-medium Fixed
11 A function fetch buffered the whole response before checking its size Medium (DoS) Fixed
12 Console log viewer path traversal Low Fixed. Who may read other apps’ audit, logs and cost was decided with roles (#21)
13 Function code could relabel itself through proxy headers Low Fixed for functions. Services can still set their own label (attribution only, no extra rights)
14 Services shared the agent sandbox’s Docker network, so a sandboxed agent could call a production service directly with a forged x-coloa-user header and act as any end user (found after the review, reproduced in e2e) High Fixed: services run on their own internal network and relay; e2e probes from the sandbox network and must find them unreachable
15 No time limit for request headers or TLS handshakes, and a failed accept (e.g. out of file descriptors) stopped the listener: a few hundred slow connections could take down the app server, gateway or console Medium-high (DoS) Fixed: 10 s header and handshake timeouts, at most 4096 connections per listener, accept errors retried; a unit test sends half a request and must be cut off
16 Per-address request limits used a fixed window, so twice the limit fit across a minute boundary Low Fixed: sliding window
17 Services ran as root inside their containers, with no memory or CPU limit unless configured Medium Fixed: the code’s owner or nobody, 512 MB without extra swap, 1 CPU by default
18 App queries had no time limit: a slow query kept running (holding a connection and CPU) after its function had timed out Medium (DoS) Fixed: statement_timeout 5 s and lock_timeout 2 s per query; the Postgres suite stops a 300k-row scan under a 1 ms limit
19 Function logs had no size limit: a function logging in a loop could fill the disk (shared by every app on a server) Medium (DoS) Fixed: 200 lines per request, rotation at 50 MB
20 Design check for the start-up snapshot (no flaw shipped): a snapshot shared by all requests must not carry a random seed, time or request data — Guarded: imports trap during snapshotting (this caught Boa’s clock and std’s hash seed before release); a test checks globals don’t leak and Math.random/Date.now differ per request
21 On a shared server every person with a token could read every app’s audit, logs and cost, and could manage any app without declared owners Medium (confidentiality on shared servers) Fixed: roles (admin, auditor, owner, developer, viewer). Once an admin exists, people see only apps they have a role on; refusals are audited; the last admin can’t be removed
23 App users could only sign in with passwords: open to credential stuffing (now automated by agents at scale) and phishing, and in a cluster the login limits counted per replica High Fixed: passkeys (WebAuthn, user verification required, bound to the app’s host so a phishing site gets nothing usable, one-time challenges), auth: { passwords: false } for passkey-only apps, and login limits shared by every replica
24 A stolen account or token could read everything it was allowed to see, as fast as it liked, and nothing signalled an intruder exploring High Mitigated: hourly read caps per identity (rows and bytes; alert, optionally block), decoy tables, accounts and server tokens that raise an alert on first touch (a decoy table also signs the user out everywhere), alerts to the audit log and a webhook
25 The management API and console answered on the same public address as the apps, so anyone could find them and try stolen or guessed tokens Medium-high Fixed (opt-in): --admin-listen keeps them on a private listener and hides them from the public one; COLOA_ADMIN_ALLOW limits them to listed addresses
22 No backup of a server: losing the machine lost every app’s data, audit trail, roles and the key to their secrets High (availability) Fixed: encrypted, authenticated backups (ChaCha20-Poly1305, truncation-proof chunks) of files, databases and the machine key; restore verifies every audit chain and never silently overwrites a database. The backup key must be kept off the machine: whoever has a backup and its key has all the data

The fixes are covered by tests/e2e.sh (163 checks), tests/e2e-server.sh (209), tests/e2e-cluster.sh (25) and the unit tests.

Known remaining risks

Brief for an external penetration test

Goal: break promises 1–5 above, as the attackers listed in scope.

Environment to provide: a coloa server with HTTPS and SSO against a test identity provider, two apps (shop and taskboard examples), one with a Python service. Accounts:

Plus a sandboxed agent session (coloa run --sandbox docker).

Priorities:

  1. Cross-app isolation on one server (database, files, console, previews, cookies).
  2. Getting a real secret out: gateway injection, leak scanning, redirects, encodings, DNS rebinding, IPv6.
  3. Bypassing row-level security through the query API, files API, connectors or migrations.
  4. Agent privilege escalation: changing policy, promoting, approving, leaving the sandbox, forging identity.
  5. Audit integrity: changing or truncating the log without verify noticing.
  6. Denial of service that affects other apps.

Out of scope: the host OS and Docker daemon, the identity provider itself, and volumetric DDoS.

Code and tests to hand over: this repository; tests/attacks.sh (side-by-side demo, results in attack-demo-results.md); tests/e2e*.sh.