Nexara Connect docs0.1.0

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:

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

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.

GateWhere
Read secret text: a sensitivity: secret Page or any Page with a <!-- secret --> block, including past versions (?at=) and diffsGET /nodes/:id, history, diff. Search and bundles leave secret text out for a session without step-up
Delete a PageDELETE /nodes/:id
Archive a whole FolderPOST /clusters/<path>/archive
Lower sensitivity, or move to a wider audiencePUT, PATCH, /move, accepting such a proposal
Grant an agent secret or raw secretsPUT /principals/:id/grants
Create an elevationPOST /elevations
Create a git tokenPOST /me/git-tokens
Apply the lifecycle jobPOST /lifecycle/run with mode: apply
Workspace lockdownPOST /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

Tokens and sessions

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.

Outbound webhooks

Webhooks tell another system that something changed; they never carry the change itself.

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.

EventMeaning
governance.refusedAn 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.heldAn agent write became a proposal, or a connected app action entered review
governance.secret_caughtThe write scanner stopped a secret before saving
governance.access_requestedSomeone requested access
governance.lockdownAn 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:

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:

IDWasNow
C1Bundle link expansion skipped authorize()Every expanded link goes through authorize() at the reader's ceiling
C2Proposal diffs carried redacted spans; patch stored unsealedDiffs 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)
H1Malformed frontmatter failed openInvalid YAML or duplicate keys are 400 bad_frontmatter on every write path, and the git pre-receive hook rejects them
H2Unverified DCR clients could get writeUnverified clients are capped at internal, read and search only
H3X-Forwarded-For trusted from anyoneHonoured only with TRUST_PROXY, rightmost hop only, and only from a socket peer in TRUSTED_PROXIES
M1Owner lockout DoSLockout is per (account, IP); owners' lock is capped at 15 minutes. Failures from one address never lock the owner out on another
M2Humans could overwrite without If-MatchIf-Match required; conflicting edits merge or become a proposal
M3Audit chain could be recomputed end to end, or its tail droppedSigned audit anchors (see Audit above), checked by verify-audit
M4Step-up by password alone; long sessionsTOTP-only step-up once enrolled, REQUIRE_TOTP on by default, sessions 30 min idle / 12 h absolute
M5ALLOWED_HOSTS off by defaultFalls back to the PUBLIC_URL host; other hosts get 421; cookie requests need a same-origin Origin
M6Sign-up open by defaultSIGNUPS=invite by default
M7Unfenced text on secondary MCP toolsSearch, tree, related and whoami output is sanitised; content is fenced
L1-L5Path error 500, thread-file paths, CSRF gaps (incl. login CSRF), health disclosure, Docker supply chainAll 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-N3Cluster archive above ceiling, cross-thread agent loops, missing headersClosed in round 5

Residual limits (by design, not open findings):

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:

IDResidual variant, now closed
C2A 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
H1sensitivity: 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
H2A 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
H3With 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.