---
url: /handbook/trust/security-and-data.md
description: >-
  What the code does to keep companies apart, check permissions, store secrets,
  limit what reaches AI providers and retain data, and what is not in place yet.
---

# Security and data handling

This page describes what DutyGraph's code does today. It does not promise more. Where a control is missing, the last section says so.

## Isolation: tenant, company and participant

DutyGraph keeps data apart at three levels.

| Level | What it is | How it is kept apart |
| --- | --- | --- |
| **Tenant** | An advisor's workspace or firm | Forced row-level security on every business table, keyed by tenant |
| **Company** | A client company inside a tenant | Composite tenant and company keys. References are checked against the same company inside the transaction. |
| **Participant** | A team member who answers asks | Bound to one company and one person. They see only their own assigned asks and the fields shown to them. |

* **Forced row-level security.** The tables force the tenant policy, so it applies even to the role that owns them.
* **Restricted runtime role.** The application connects as a role that is not a superuser, cannot bypass row-level security and does not own the tables. The server sets the tenant for each transaction from the signed-in user, never from the browser.
* **Another firm's company** returns "not found", not "forbidden".
* **A few fixed server functions read across tenants on purpose**, for example the Living DutyGraph scheduler, the advisor notification queue and the platform-wide unsubscribe list. An unsubscribe check tells no firm about another firm's contacts.

## Append-only history

The application role cannot change or delete the history DutyGraph keeps. The database grants are re-applied after every migration, so a broad grant never re-opens a protected table.

* **No update or delete:** record versions, audit events, Repo file Notes, fill-loop observations and decisions, governance packs, the [ledger](../governance/ledger.md) and agent activity.
* **Revoked, never deleted:** memberships and invitations, MCP access tokens, agent credentials, client access, report links and shared agent plans.

::: warning
A database administrator with owner access can still change data outside the application. DutyGraph has no external checkpoint for its history today.
:::

## Permissions are checked on the server

* Every signed-in write needs a CSRF token. Commands also need an `Idempotency-Key`. Pages opened from a private link work without a session, and each action on them is limited to that one link.
* A person who was given shared access to one company can call only the routes listed for their role. The server checks their current role inside the same transaction, so removing someone blocks their next request.
* Each DutyGraph Agent mode, each governance decision and each export has its own permission. A decision route refuses a call that comes from an MCP chat.
* The browser hides buttons a role cannot use, but the server makes the decision.

## Sign-in, tokens and secrets

* **Passwords** are stored as salted scrypt hashes.
* **Advisor sessions** use an HttpOnly, SameSite=Strict cookie, Secure on HTTPS. A session ends after 12 hours without activity.
* **Tokens are stored only as hashes:** sessions, invitations, private links (outreach, proposals, status pages, reports and agent plans), MCP access tokens, agent gateway credentials and Companion phone tokens.
* **MCP access keys are shown once.** DutyGraph stores only a hash of each key. **Revoke** stops a key at once. See [Sign-in and tokens](/build/authentication).
* **Private links are shown once.** Saved command receipts and stored drafts never hold the link itself.
* **Provider keys** (AI, research, email, graph) are encrypted with AES-256-GCM. The server reads a key just before a call and does not store it in a receipt or a usage row.

## Encryption

* **In transit.** The hosted service is served over HTTPS. Neon accepts only connections encrypted with TLS ([Neon security overview](https://neon.com/docs/security/security-overview)).
* **At rest, by the providers.** Vercel states that it encrypts data at rest with AES-256 ([Vercel security and compliance](https://vercel.com/docs/security/compliance)). Neon states that it encrypts stored data at rest with AES-256 ([Neon security overview](https://neon.com/docs/security/security-overview)). These are the providers' own controls. DutyGraph has not had them checked independently.
* **In the application.** Provider keys are also encrypted with AES-256-GCM before they are stored. See [Sign-in, tokens and secrets](#sign-in-tokens-and-secrets).

## What DutyGraph does not store

* **Employees' own logins to business systems.** DutyGraph does not connect to a company's identity or access system. Access comes from an access export that someone uploads. See [Holdings](../governance/holdings.md).
* **Holdings in the Repo.** The Company Repo compiler does not read holdings, so they never appear in a Repo file and never reach DutyGraph Agent.
* **People's raw words in Repo files.** A person's own words stay as evidence. Repo files show the answer as the person confirmed it, after the advisor accepts it.
* **Card numbers.** Card payments run on Stripe's hosted pages.

## What reaches an AI provider

* **Which AI key is used depends on the feature.** DutyGraph Agent, the fill loop, Strategy and "Here's what we heard" use the company's approved connection (Claude first). Pitch to Package and the Onboarding session use the company's approved connection, then the firm's own workspace key (Settings › Keys) if that call fails. A key saved for one company is never used for another company. Research extraction and voice interviews use the company's approved OpenAI connection. Some older OpenAI features use the firm's workspace OpenAI key when a firm advisor starts them. See [How DutyGraph uses AI](../architecture/how-dutygraph-uses-ai.md) for the full table.
* **Sample companies.** A key saved on a sample company is never used. DutyGraph Agent, Pitch to Package and the Onboarding session on a sample use the firm's own workspace key, and only the sample's fictional text is sent. With no workspace key they make no AI call. Research and Route refresh make no AI call on a sample. Some older OpenAI features do not check for samples yet; see the Limits on [How DutyGraph uses AI](../architecture/how-dutygraph-uses-ai.md).
* **Accepted values first.** The [DutyGraph Agent](../advisors/repo-copilot.md) sends accepted file content. Proposed readings and waiting answers are left out of Repo files, and quoted spans are left out of Edit and Draft an ask. When you ask about one returned answer, DutyGraph Agent sees that person's words. On a Pitch to Package step it sees the pitch so far, including short quotes from the call. Email addresses are masked.
* **No stored prompt text.** DutyGraph Agent usage rows hold counts and sizes, never the message, files, answer or key. DutyGraph Agent calls to OpenAI set `store: false`.
* **AI training.** DutyGraph does not train or fine-tune AI models. It sends each call to the provider's API. OpenAI states that API data is not used to train its models unless the account owner opts in ([OpenAI data controls](https://developers.openai.com/api/docs/guides/your-data)). Anthropic states that it does not train on inputs or outputs from its commercial API by default ([Anthropic privacy center](https://privacy.claude.com/en/articles/7996868-is-my-data-used-for-model-training)). When the key is the company's or the firm's own, that account's settings apply.
* **Team analysis** sends the selected answer text so it can cite it exactly. The stored run keeps only ids, versions and a hash of that text.
* **Hourly AI input retention.** Stored Strategy runs keep short quotes from Repo files. When a quoted file changes or leaves the Repo, a job that runs at most once an hour replaces the quote with withheld text. The same job removes evidence text from older framework runs and team analyses.
* **Company research** sends a public company name and website domain to the research provider, never workspace evidence.

## Retention

Raw audio, kickoff documents, unengaged contacts, link snapshots, unconverted website requests and expired sessions are removed on fixed schedules. **Erase person** removes one address everywhere it appears. [Data retention](data-retention.md) lists every default and what is not built yet.

## Changes to the code

Every pull request runs the automated tests, the type check, the build and a dependency audit that fails on any high or critical advisory, apart from a short list of dated, reviewed exceptions.

## Hosting

The hosted service runs on Vercel, with a dedicated Neon PostgreSQL database in the US East (IAD1) region. PostgreSQL is the authoritative store. An optional Neo4j Aura graph is a derived copy of graph metadata, scoped by tenant and company, without evidence bodies, audio or credentials. Removing that connection stops later access but does not delete copies already in Aura. API responses are marked not to be cached. The outside services DutyGraph uses are listed on [Subprocessors](subprocessors.md).

## What is not in place

* **Enterprise single sign-on (SSO) and multi-factor sign-in (MFA):** Planned. Sign-in today is email and password.
* **Session limits:** no maximum lifetime for a session that stays active, and no device list or remote sign-out for advisors.
* **Certifications:** DutyGraph has no SOC 2 report and claims no security certification, and no independent penetration test is recorded. See [SOC 2 status](soc-2-status.md).
* **Link possession is not identity.** A private link proves only that someone has the link.
* **Uploads** are not scanned for malware.
* **Full erasure and legal hold** across every record are not built.
* **Secrets** are not in a managed secret store with rotation.
* **Abuse limits** are per process or per IP address, not a distributed service.

## Report a security concern

Email <hello@dutygraph.com> with what you found, the steps to see it and the affected page or feature. Use only your own account and data, and stop as soon as you see data that is not yours.

::: info
**Status.** **Built**: tenant, company and participant isolation with forced row-level security, the restricted runtime role, append-only grants, server-side permission checks, hashed tokens, encrypted provider keys, AI input rules and hourly retention, the retention defaults on [Data retention](data-retention.md) and **Erase person**. Provider-level encryption at rest is the hosting and database providers' own control. **Simulated**: none on this page. **Planned**: enterprise SSO and MFA. Not built: a SOC 2 report or any certification, malware scanning, full erasure and legal hold, and a managed secret store.
:::
