Security model
Nexara Connect assumes agents are useful but not trustworthy: they can be prompt-injected, they leak what they see, and they make mistakes at machine speed. The model is built so that an agent only sees what its grant allows, can only change what its grant allows, and can never approve its own escalation.
One gate: authorize()
Every read, write, search, bundle, thread post, lifecycle action and git push goes through one function in server/src/acl.ts. For an agent, access is allowed only when all of these hold:
- the token is valid, unrevoked, unexpired and from the current workspace token epoch;
- a grant (or an active elevation) covers the Project, the Folder glob and the action;
- the agent's creator still holds that action through their workspace role;
- the content's sensitivity is at or below the lowest of: the grant level, the agent ceiling, the token ceiling, the creator's role ceiling, the OAuth client cap, and the standing cap of
confidential; - the Page is active, or archived content was explicitly asked for.
Redaction happens per block, so one Page can be partly visible. Content above the ceiling becomes [REDACTED: <level>, ask owner]; a Page above the ceiling is not found at all.
What agents can never do
- Hold standing access to
secret. Secret is only reachable through a time-boxed elevation that an owner creates with step-up. - Satisfy a step-up gate. Gates are for humans in a live session.
- Lower the sensitivity of a Page or block, or move content to a wider audience. The change becomes a proposal.
- Write instruction-bearing files:
index.md,CLAUDE.md,AGENTS.md,.gitattributes, or anything under askills/folder. Those become proposals. - Manage agents, grants, tokens, members or invites. Those routes are human-only.
- Grant more than their creator has. Demoting the creator shrinks every agent they made on its next request.
- Use a git token on the API or MCP, or an API key on git.
- Silently overwrite another principal's edit when a base is given: a conflict returns 409 and keeps the losing write as a proposal.
- Flood threads: rate limits, duplicate suppression, max 5 mentions, no
@all, human hand-off after 4 agent hops, lock after 20 agent messages in 10 minutes.
Step-up gates
These need a human who re-authenticated within the last 5 minutes (POST /api/auth/stepup; a TOTP code once TOTP is enrolled, the password only for accounts without TOTP). The API answers 403 step_up_required otherwise.
| Gate | Where |
|---|---|
Read secret text: a sensitivity: secret Page or any Page with a <!-- secret --> block, including past versions (?at=) and diffs | GET /nodes/:id, history, diff. Search and bundles leave secret text out for a session without step-up |
| Delete a Page | DELETE /nodes/:id |
| Archive a whole Folder | POST /clusters/<path>/archive |
| Lower sensitivity, or move to a wider audience | PUT, PATCH, /move, accepting such a proposal |
Grant an agent secret or raw secrets | PUT /principals/:id/grants |
| Create an elevation | POST /elevations |
| Create a git token | POST /me/git-tokens |
| Apply the lifecycle job | POST /lifecycle/run with mode: apply |
| Workspace lockdown | POST /workspaces/:ws/lockdown |
Content is data, not instructions
context_get, context_bundle and the load_project_context prompt wrap every section in a <context nonce=...> fence with a random per-response nonce, and start with a preamble telling the model the content is data. Stored text cannot close the fence because it does not know the nonce. Invisible Unicode (tag characters, bidi controls, zero-width characters) is stripped on write.
Secrets at rest
<!-- secret -->blocks and the bodies ofsensitivity: secretPages are sealed with AES-256-GCM before they are committed. The key is derived with HKDF fromMASTER_KEYper workspace. Git history, clones and backups only holdnxc-sealed:v1:ciphertext.- Secret text is never put in the full-text index or the embedding index.
- Files on a Secret Page are sealed the same way: the same per-workspace key and cipher, behind an
nxc-sealed-file:v1marker, stored assecret-<id>.<ext>with the real file name sealed in.nexara/files.json. They are never indexed or embedded, only a person with a fresh step-up may add or open one, and an agent or a skill is never given one, whatever grant it holds (it sees the same 404 as a missing file). - Proposal content, base and diff are sealed in
core.dbwith a per-workspace key. TOTP seeds are sealed too. - Titles, summaries, tags and links shown to every reader of a Page come only from text at the Page's own level; a heading or
[[link]]inside a higher block never surfaces in the tree, search or related lists. - Writes and pushes containing raw credentials are rejected by a secret scanner.
- Vault items (the Secrets screen) are changed in the app only. A git push that creates, edits, moves or deletes one is refused, whatever the token's clearance; the message names the rule, not the item, and the refusal is in the audit log (
deny.git.push, a count, never a name).
Tokens and sessions
- Tokens are opaque random strings with a prefix (
nxc_,nxg_,nxa_,nxr_,nxi_,nxk_) and are stored only as HMAC-SHA256 hashes with a pepper derived fromMASTER_KEY. Keys are shown once. - Revocation is immediate.
POST /api/v1/workspaces/:ws/lockdownbumps the token epoch, which invalidates every key, OAuth token and other session in the workspace at once. It also takes every agent off every vault key and revokes pending and approved vault requests; none of that comes back on its own, so an owner adds agents to a key again on the Secrets screen. - OAuth: PKCE S256 only, single-use codes (a replayed code revokes what it issued), audience-bound access tokens (an
nxa_token works only on the MCP resource it was issued for:/mcp, or/w/<workspace>/mcpwhen the client asked for that resource, and is refused on/api/v1with401 token not valid for this resource; agent keysnxc_work on both), rotating refresh tokens with reuse detection that revokes the whole family. Redirect URIs must be on the allowlist (Claude, ChatGPT, loopback,OAUTH_EXTRA_REDIRECTS). - Web sessions use
__Host-cookies over HTTPS,HttpOnly,SameSite=Lax, plus a double-submit CSRF token on every unsafe request. Sessions end after 30 minutes idle or 12 hours. Passwords are hashed with argon2id. Five failed logins from one IP lock that account for that IP for a growing interval (at most 15 minutes for owners), so an attacker cannot lock the owner out from elsewhere. Login refuses cross-site requests (Origin,Sec-Fetch-Site), and the HTML login form carries its own CSRF token. - Headers:
Content-Security-Policy(no inline scripts except the SPA bootstrap, by hash;frame-ancestors 'none'),Strict-Transport-Securityon HTTPS,X-Frame-Options: DENY,X-Content-Type-Options: nosniff,Referrer-Policy: same-origin(no referrer leaves the site; our own form posts keep theirOrigin),Cross-Origin-Opener-Policy: same-origin,Permissions-Policy, andCache-Control: no-storeon/apiand/oauth.
Capture keys
A capture key (nxk_...) lets a phone shortcut, CI job, form or Zapier step drop notes into the vault without any read access.
- Created by a workspace owner (or an agent with an
admingrant) withPOST /api/v1/admin/capture-keys{name, space, path_prefix, sensitivity}. The token is shown once and stored only as a peppered HMAC;GETlists keys without it;DELETE .../capture-keys/:idrevokes at once. Lockdown kills every capture key too. - A key is bound to one Project and one folder prefix (default
inbox).path_prefixis relative to the Project:..,., absolute paths,.mdnames and owner-only folders such asskills/are refused, and a prefix that already starts with the Project name is stripped of that leading segment so notes never land inacme/acme/.... - The key works on exactly one route,
POST /api/v1/capture, and that route accepts nothing else. Everywhere else, including/api/v1/whoami,/mcpand/git, annxk_token is a 401. Insideauthorize()a capture actor holds a single grant with the actioncapture, which no other route checks, so it cannot read, search, list, propose or write. - The server picks the path (
<space>/<prefix>/<ulid>-<slug>.md), stampssource: capture/<key name>andtype: capture, and sets sensitivity to the lower of the key's level and the requested one. Caller frontmatter other than tags and sensitivity is dropped. The secret scanner applies, guarded blocks above the key's level are refused, the body is limited to 256 KB and each key to 30 captures per minute. - The response is
{id, path}only. A key also stops working when its creator is no longer an owner (or the creating agent losesadmin).
Outbound webhooks
Webhooks tell another system that something changed; they never carry the change itself.
- Ids and metadata only. A payload is
{id, type, created_at, workspace, data}wheredataholds ids, path, Project, sensitivity, the kind of change and who made it. Page text, summaries, sealed spans, thread messages and proposal content are never included: the receiver fetches what it needs with its own key, throughauthorize(). - Two filters. A page-change event is delivered only if its page is at or below the endpoint's
max_sensitivity(defaultinternal, never above the creator's read ceiling) and the endpoint creator can still read it. Both are checked when the event is queued and again just before each attempt, against the page's current location and level. If the creator loses admin or leaves, queued deliveries are skipped and the endpoint is disabled. Lockdown cancels old page-change deliveries; human administrators can still receive governance alerts. For a proposal that creates a new page, the level is unknown without opening the sealed content, so it is treated assecret. - Signing.
Nexara-Signature: t=<unix seconds>,v1=<hex HMAC-SHA256(secret, "<t>.<raw body>")>. Receivers must compare in constant time and refuse atmore than 5 minutes from their clock, which stops replay. Thewhsec_secret is sealed with AES-256-GCM (HKDF(MASTER_KEY, "webhook", workspace)), shown once, and replaced withPOST /api/v1/admin/webhooks/:id/rotate. - SSRF. Target URLs must be https, without credentials, and not
localhost,.localor.internal. At registration and before every attempt the host is resolved again; if any address is loopback, private, link-local, CGNAT, multicast or reserved the attempt fails, and the connection is pinned to the checked address so DNS cannot change between the check and the connect. Redirects are never followed. - Limits. 10 s timeout, response body discarded, 60 deliveries per minute per endpoint, 1000 queued per endpoint, 7 attempts with backoff, disabled after 20 consecutive failures or an HTTP 410. The delivery log stores status, attempts, response code and error; the payload is deleted once a delivery finishes and is never returned by the API. Admin changes are audited without the URL or secret.
Governance alerts
On Team and above, open Settings > Connections > Webhooks. The Governance alerts group can tell your accountable people when an action is refused, an agent write is held for review, a secret is caught, access is requested, or the workspace is locked down. A trial counts as Team while it runs, and legacy self-hosted workspaces always have it.
| Event | Meaning |
|---|---|
governance.refused | An agent read exceeded clearance or Secret rules, an agent reached into a project it is not scoped to, a write or trust rule refused an action, or a connected app call was denied |
governance.held | An agent write became a proposal, or a connected app action entered review |
governance.secret_caught | The write scanner stopped a secret before saving |
governance.access_requested | Someone requested access |
governance.lockdown | An administrator locked down the workspace |
The signed JSON envelope is {id, type, created_at, workspace, data}. Governance data contains actor: {id, name, kind} (agent or person), a fixed reason code and count. A node_id and the project it happened in (space: {id, name}) are included only when the endpoint creator can read the page at delivery time and its current lock is within the endpoint ceiling; both ride that one check, so an alert that cannot name the page cannot name the project either. No page titles, paths, bodies, proposal text, secret spans or caught secret values are sent. A refusal can therefore arrive without identifying the page. Governance alerts are about a principal, not a page, and most of them (a caught secret, a trust refusal, a lockdown) have no page at all, so they reach an endpoint scoped to one Project as well: the Project scope and the endpoint ceiling decide only whether the node_id and project name are included.
Identical actor, event type, reason and page events in a fixed 60-second window produce one delivery with a count, scheduled at the end of that minute. Receiver failures use the existing retry policy; delivery cannot be guaranteed while the receiver is unavailable or the queue is rate limited. Governance deliveries are recorded as Governance alert sent in Audit.
For Slack, paste a Slack incoming-webhook URL and choose Slack format. The body is {text} with a plain summary. The Nexara-Signature header still signs the exact body; Slack itself does not verify Nexara signatures. Slack credential paths are hidden in endpoint views.
Owners and admins can turn on Email me governance alerts for themselves. It starts off, includes no page content or page IDs, uses a designed HTML email with a text twin, and links to Audit. The first batch is eligible within a minute; later batches are limited to one attempt every five minutes per person, across workspaces. Turning it off clears waiting items and needs no step-up, including after a downgrade to Free. Membership, role and plan are checked again before sending. Without a mail provider, the development mail sink records the message and no email is sent.
Email-in
Mail routes (<token>@MAIL_IN_DOMAIN) are capture keys delivered by email: the same write-only actor, one Project and folder, sensitivity forced to the route level, no read path back. The provider webhook is verified before anything is parsed (Resend Svix HMAC with a 5 minute window, Postmark Basic secret), each webhook id is accepted once, and the reply never says which addresses exist. Mail text is stored as inert data: < is escaped so sensitivity markers, sealed blocks and HTML cannot be injected, caller frontmatter is never read, and only small plain-text attachments are inlined. The route token in the address is the only credential. allowed_senders matches the forgeable From header and is a convenience filter, not access control: SPF/DKIM are not checked, so anyone holding the address can file into the route as any sender. Revoke and recreate a route whose address leaked. Rate limits per route and per sender; audit holds ids only. Details in self-hosting, Email-in.
Audit
An append-only, hash-chained log in core.db records ids, actions, outcomes, sensitivity and IP for every read, write, denial, token and grant change, never content. The chain alone only proves that rows were not edited one at a time: someone with write access to core.db could drop the triggers and recompute every hash. Signed anchors close that gap.
Allowed by. Every allowed read or write carries the approval behind it: the role or grant that matched, and the event that put it there (who gave the invite, changed the role, or approved a Secret grant, and when, with step-up or not). For an agent, that is who created it and who last set its trust and grants. The Audit screen shows it as an "Allowed by" link; clicking it filters the log to everything that approval has allowed, and it is exported in the CSV too. Rows from before this shipped say "not recorded" rather than guess. A can_audit-scoped reader never sees an approval for a project outside their scope, the same rule as every other row.
Signed audit anchors. The server signs the head of the chain, {ws, seq, head_hash, ts}, with an Ed25519 key and appends the result as one line to $DATA_DIR/audit-anchors.jsonl, outside core.db:
- When: at startup, every
AUDIT_ANCHOR_MINUTES(default 60, skipped when nothing changed), on graceful shutdown, and before every backup. Each backup archive carriesaudit-anchors.jsonlandaudit-anchor.pub(the public key). - Key: HKDF from
MASTER_KEYby default, orAUDIT_SIGNING_KEY(an Ed25519 private key in PEM, or any secret a seed is derived from). It is never stored incore.db. - Each anchor also carries the hash of the previous anchor line, so removing or reordering an anchor in the file is detected.
- The latest anchor is shown at
GET /api/v1/audit/anchor(with the public key) to anyone who may read the log, and to any authenticated caller in/readyz(audit_anchor).
Access review. GET /api/v1/spaces/<project>/access-review assembles the review a compliance team files each quarter, as JSON or CSV: every person and agent that can reach the project and through which role, scope or grant, every temporary Secret approval with who approved it, why, when it expires and how many uses are left, what was taken back in the window, and every read and refusal of the project's pages over the last 90 days (?days=). It carries ids, names, paths, times and outcomes, never page text, and the download is audited (access.review).
Who may read the log. Owners and Admins always may, for the whole workspace. For anyone else it is a flag on their membership: in Settings > Members, an Owner ticks "Can read the audit log" for one named person, which opens GET /api/v1/audit, /audit/anchor, /audit/export and /spaces/:s/access-review, scoped to the projects that person can open themselves. A row about a project they cannot read, and any project id inside it, never appears; an access review for a project they cannot read answers 404. Giving or taking the flag away is itself logged (member.audit_access), and so is every export (audit.export). Agents never read the log.
npm run verify-audit (in the image: node server/dist/cli/verify-audit.js) walks the hash chain, then checks every anchor: its signature, its link to the previous anchor, and that the chain still holds the anchored row with the anchored hash. It exits 1 when the chain was edited, truncated below an anchored row, or rewritten and recomputed, when an anchor was forged or edited, or when there is no anchor at all (--allow-unanchored to accept that). Options: --anchors <file> (repeatable, for example the anchor file from an older off-host backup), --public-key <base64url or file> (verify without the private key), --db <file>.
Known gaps and review status
Every finding from the security reviews is closed in the current code (docs/REVIEW-round2-security.md lists the original findings, docs/REVIEW-round7-fixes.md maps each one to its fix and its regression test). The table summarises what was fixed:
| ID | Was | Now |
|---|---|---|
| C1 | Bundle link expansion skipped authorize() | Every expanded link goes through authorize() at the reader's ceiling |
| C2 | Proposal diffs carried redacted spans; patch stored unsealed | Diffs are built per viewer from redacted views; proposal content, base and patch are sealed in core.db (no plaintext canary in core.db after proposals) |
| H1 | Malformed frontmatter failed open | Invalid YAML or duplicate keys are 400 bad_frontmatter on every write path, and the git pre-receive hook rejects them |
| H2 | Unverified DCR clients could get write | Unverified clients are capped at internal, read and search only |
| H3 | X-Forwarded-For trusted from anyone | Honoured only with TRUST_PROXY, rightmost hop only, and only from a socket peer in TRUSTED_PROXIES |
| M1 | Owner lockout DoS | Lockout is per (account, IP); owners' lock is capped at 15 minutes. Failures from one address never lock the owner out on another |
| M2 | Humans could overwrite without If-Match | If-Match required; conflicting edits merge or become a proposal |
| M3 | Audit chain could be recomputed end to end, or its tail dropped | Signed audit anchors (see Audit above), checked by verify-audit |
| M4 | Step-up by password alone; long sessions | TOTP-only step-up once enrolled, REQUIRE_TOTP on by default, sessions 30 min idle / 12 h absolute |
| M5 | ALLOWED_HOSTS off by default | Falls back to the PUBLIC_URL host; other hosts get 421; cookie requests need a same-origin Origin |
| M6 | Sign-up open by default | SIGNUPS=invite by default |
| M7 | Unfenced text on secondary MCP tools | Search, tree, related and whoami output is sanitised; content is fenced |
| L1-L5 | Path error 500, thread-file paths, CSRF gaps (incl. login CSRF), health disclosure, Docker supply chain | All closed: 400 on bad paths, thread paths refused, CSRF + Origin on every auth route and the login form, anonymous health returns {ok:true} only, base image pinned by digest and npm ci --ignore-scripts |
| N1-N3 | Cluster archive above ceiling, cross-thread agent loops, missing headers | Closed in round 5 |
Residual limits (by design, not open findings):
- Anchor window. Audit rows written after the last anchor are protected only by the hash chain until the next anchor (default hourly, plus every backup and graceful shutdown). An attacker with write access to
core.dband the data volume can still delete the tail of the chain written since the last anchor, or deleteaudit-anchors.jsonltogether with the chain. Keep backups (each carries the anchor file) and the anchor key off the host to detect that, and verify against an older copy withverify-audit --anchors <copy>. - Anchor key and
MASTER_KEY. By default the anchor key is derived fromMASTER_KEY. Someone who holdsMASTER_KEYcan sign new anchors. SetAUDIT_SIGNING_KEYto a separate Ed25519 key, and verify with the public key only (--public-key), if the people who run the server should not be able to re-sign. - Agents never get secret text without a time-boxed elevation, and humans need a fresh step-up. A human web session without step-up sees
secretcontent nowhere: not in pages, history, diffs, search or bundles.
Phase 1 (docs/REVIEW-phase1-security.md) closed the variants that survived round 3, each with a regression test in server/test/phase1.test.ts:
| ID | Residual variant, now closed |
|---|---|
| C2 | A proposal showed the proposer the old page at their propose ceiling, which can be higher than their read ceiling; a blind proposal over an unreadable page returned its body in the diff. Patches are now always computed at the viewer's read ceiling, and the old side is empty unless the viewer may read the page |
| H1 | sensitivity: Secret (any case) was treated as internal and left unsealed, and a typo such as confidental fell back to internal. Values are now case-normalised, and anything other than the four levels is rejected on write (400 bad_frontmatter) and treated as secret on read. The git hook reads frontmatter with the same YAML parser as the app, so a trailing # comment or quotes no longer change the level |
| H2 | A DCR client that registered a loopback redirect and a Claude or ChatGPT callback got the hosted-connector cap (confidential, with write). The cap is now confidential only when every registered redirect is a hosted callback, and it is re-checked whenever an OAuth agent's token is used |
| H3 | With TRUST_PROXY on, any client that reached the container directly could still set X-Forwarded-For. Forwarding headers are now believed only from peers in TRUSTED_PROXIES (default: loopback and private networks) |
Still open: humans without If-Match on old clients get 428 rather than a merge (by design), and AGE backup keys live on the backup host until moved.
Reporting a problem
Email support@nexara.ac rather than opening a public issue. Include the request, the response and the commit shown by /readyz.