---
title: "Security model"
sidebar:
  icon: shield
  label: "Security model"
description: "How varsafe stores, transmits and controls access to your secrets."
---


<PageMeta />

This page answers the questions a security review asks about varsafe, in the order it usually asks them. The [last section](#what-varsafe-does-not-do-yet) lists what varsafe does not do yet.

## At a glance

| Question | Answer |
| --- | --- |
| Can varsafe read my secrets? | The service can, as any server-side secrets manager must: it reads values from the vault, over an encrypted connection, to answer requests that pass its permission checks, and logs each of those reads. The vault stores them encrypted. [Details](#the-access-model) |
| Where are values stored? | In a dedicated secrets vault (Scaleway Secret Manager) in the EU, separate from the application database. |
| How are teams kept apart? | Application checks on every request, plus PostgreSQL row-level security on the main team tables: secret references, API tokens, agent grants, invites, SSO settings and the audit log. [Details](#tenant-isolation) |
| Who can change production? | Owners and admins: production is a protected environment by default. An API token can change it only when it was created for production. [Details](#who-can-read-and-change-what) |
| Is access logged? | Every value read and every change, with who did it, the client and the IP address. [Details](#audit-trail) |
| What happens when someone leaves? | Removing a member immediately ends their access to the team: their CLI logins lose the team, and their agent grants and the API tokens they created are revoked. [Details](#removing-access) |
| How do agents get access? | Over MCP, in one of two ways: through an OAuth consent screen, with the scopes the person approved, capped by that person's role, per team; or with an API token, which keeps its own scope. |
| Certifications? | None yet. No SOC 2 report. |

## How a request is handled

<Layers
  title="The layers a secret passes through"
  bands={[
    {
      label: 'Clients',
      items: [
        { name: 'CLI', detail: 'Signed in from the browser' },
        { name: 'Dashboard', detail: 'A browser session' },
        { name: 'AI agents', detail: 'MCP, with an OAuth 2.1 grant or an API token' },
        { name: 'Pipelines', detail: 'A scoped API token' },
      ],
    },
    {
      label: 'varsafe API',
      items: [
        { name: 'Authenticate', detail: 'The session, CLI login, grant or token is verified and must still be live' },
        { name: 'Authorize', detail: 'Team membership, role, environment protection and token scope' },
        { name: 'Audit', detail: 'Every value read and change is recorded' },
      ],
    },
    {
      label: 'Storage',
      items: [
        { name: 'PostgreSQL', detail: 'Keys, vault references, metadata and the audit log; row-level security on the main team tables' },
        { name: 'Secrets vault', detail: 'The values, versioned: Scaleway Secret Manager in the EU, encrypted at rest', accent: true },
      ],
    },
  ]}
  links={['TLS', 'references and metadata to PostgreSQL, values to the vault']}
/>

1. **TLS** on every connection to varsafe: dashboard, CLI, agents and pipelines.
2. **Authenticate.** The credential is checked against its store and must not be expired or revoked.
3. **Authorize.** The actor's team membership, role, environment protection and, for a token or grant, its scope are checked against the project and environment.
4. **Audit.** Reads of values and every change are recorded.
5. **Store.** Names and metadata go to the database; values go to the vault.

## Where secrets are stored

### Where secret values live

Secret values live in a dedicated secrets vault, Scaleway Secret Manager in the EU, which encrypts them at rest. Only varsafe's own infrastructure holds the credential to reach it. Each environment keeps its last 10 saved versions, so a bad change can be rolled back; deleting all of an environment's secrets at once can also delete that history.

The application database holds:

- secret names, and values only in encrypted form, in the record of a write (see below)
- vault references and version numbers
- the team, project and environment each secret belongs to
- the keys for encrypted `.env` files, with the private keys encrypted
- the audit log

The database is backed up, encrypted. Anything deleted from it stays in those backups for a few weeks, until they expire.

Outside the vault, values are also kept, encrypted:

- **In a short-lived cache**, for a few minutes, so reads are fast. Right after a change, a read can still return the previous value for those few minutes.
- **In the record of a write in progress.** Each write goes to both the vault and the database; this record lets a write interrupted by a crash be finished or undone. Its copy is cleared when the write completes, and kept if the write ultimately fails.

### Encrypted `.env` files

`varsafe export` writes an [encrypted `.env`](/guides/encrypted-env) by default. Each environment has an X25519 keypair. Each value is sealed with HKDF-SHA256 and AES-256-GCM under a fresh ephemeral key, and bound to its variable name and the environment's key, so it cannot be renamed or moved to another environment unnoticed. A sealed file can be committed: it shows variable names, the length of each value and which key sealed it, not the values.

The environment keys are managed by varsafe, not by you. The private keys are stored on varsafe's servers, encrypted by a key-management service, and no route hands them out. `varsafe run --env-file` sends a file's encrypted values to the API, which opens them for a caller allowed to read the environment's values, under the same rule as `varsafe run`, and records the read as `environment.sealed_values_opened`, by variable name. If any sealed value was edited, the whole file is refused.

Access is checked each time a file is opened, so someone who loses access to the environment can no longer open its files through varsafe, even copies they kept. A sealed file is still a snapshot: anyone allowed to read the environment can open it, including values since changed or deleted, for as long as the key that sealed it exists. Deleting the environment's keys is what stops such files from opening.

A sealed file keeps values from being read, not from being swapped. Sealing only needs the environment's public key, which anyone who can read the environment can get, so a value can be replaced by a newly sealed one, and a removed line or an older copy put back still opens.

## The access model

varsafe is a **server-side secrets manager, not an end-to-end encrypted system**. The varsafe API reads secret values to serve authorized requests, which is what makes `varsafe run` work. Your secrets are protected by layered access control, not by keys only you hold: {/* claim-lint-ok — denies the E2E claim; the rule matches the phrase regardless of negation */}

- only varsafe's own infrastructure can reach the vault
- every read is authenticated, checked against your [role](/reference/roles) or the token's scope, and audited
- values are encrypted in transit (TLS) and at rest (the vault)

## Who can read and change what

Access is checked by the API on every request. The dashboard hides what you cannot do, but it does not enforce anything.

**Members** get access from their role. There are six: owner, admin, developer, operator, viewer and billing. A **protected environment** accepts changes from owners and admins only. Developers and operators can still read it; viewers and billing members cannot. Production is protected by default in every new project, and an environment with the slug `production` is closed to viewers even if someone removes its protection. The full matrix is in [Roles and permissions](/reference/roles).

**API tokens** belong to one team. They can be narrowed to projects and environments, and to read-only. A token is not a member and has no role, so its scope stands in for one: **a write token changes a protected environment only when it was created for that environment**, which an owner or admin chose when creating it. A token for all environments reads protected environments but cannot change them. A token keeps that access if its environment is protected later. See [API tokens](/reference/api-tokens#protected-environments).

**AI agents** connect over MCP in one of two ways. Through OAuth, a person approves the connection on a consent screen, and the agent gets only the scopes approved there, capped by that person's role. Each team named on the consent screen is its own grant, and a tool call runs under one team. A viewer cannot grant an agent any secret scope. Protected-environment rules apply against the approving member's current role. A grant expires after 90 days without use, and you can revoke it at any time. With an API token there is no consent screen: the agent has the token's scope and follows the token's rules. See the [MCP guide](/guides/mcp).

**Environment keys** (for encrypted `.env` files) are created by an environment's first export, under the same access as reading its values, or by an owner or admin. Rotating or deleting them takes an interactive owner or admin session; tokens, CLI logins and agents are refused. No one can download a private key.

## Tenant isolation

Teams are isolated twice:

1. **In the application.** Every request is scoped to the team the actor is acting for, and ownership is checked before any read or write. The few operations that must run before the team is known, or across teams, such as checking an API token or the nightly expiry sweep, each use a narrow, dedicated database function.
2. **In the database.** PostgreSQL row-level security limits the tables listed below to the request's team, and the audit log to the teams the reader belongs to. The API refuses to report ready if its database role could bypass those policies.

<div class="vs-cols" data-cols="2">

<div>

**Covered by row-level security**

<div class="vs-checks" data-tone="yes">

- Secret references
- Secret dependencies
- Environment keypairs
- API tokens and their environment scopes
- Agent grants
- Team invites
- SSO providers
- The audit log

</div>

</div>

<div>

**Not covered by row-level security**

<div class="vs-checks" data-tone="no">

- Projects, environments and teams, and their settings
- Alert rules and destinations
- Team membership and billing
- Accounts and what belongs to a person rather than a team: sessions, sign-in methods, CLI logins and agent refresh tokens
- The internal queues that background work reads across teams: secret writes and project deletions

</div>

These rely on the application checks only. None of them holds your secret values in readable form: the secret-write queue keeps them encrypted.

</div>

</div>

<Hierarchy isolation />

Composed secrets cannot reference another environment, project or team, so a composed value never pulls data from outside the tenant the reader was already authorized for.

## Authentication

### Signing in

| Method | Notes |
| --- | --- |
| Email and password | Optional TOTP two-factor (RFC 6238) with 10 single-use backup codes |
| GitHub, GitLab, Google, Bitbucket | OAuth. A provider sign-in is not silently linked to an existing account with the same email; a signed-in account with a confirmed email connects one explicitly, from its profile |
| Passkeys | WebAuthn, bound to the varsafe domain |
| SAML 2.0 and OIDC single sign-on | Team plan. The email domain must be verified by a DNS record first |

Setup is in [Authentication](/reference/authentication).

### Sessions

- **Lifetime:** 7 days after the last renewal. Activity renews a session at most once an hour, so an idle session expires within a week.
- **Cookies:** session cookies are `HttpOnly`, `Secure` and `SameSite=Lax`.
- **Revocation:** sign-out, per-session revoke from your profile, and password reset. A revoked session stops working on its next request.
- **Password reset** revokes every session and also the account's CLI logins, agent refresh tokens and API tokens, and cancels any `varsafe login` the account approved that had not finished. A request already under way on an old session is refused, or what it created is revoked with the rest.

### Unusual access

Every browser session is checked for unusual access, and the checks cannot be turned off. A browser is recognized by a random cookie, and varsafe remembers the devices and networks an account has verified, for 90 days of activity. A new device triggers an email alert. A session must be confirmed again when a new device also comes from an unfamiliar network or country, after recent failed verification attempts, or when an existing session's device or browser changes. Until then it cannot read, export or change secrets, approve CLI or agent access, or change security settings. The alert includes a link to report the access and revoke that session. Screens and emails show an approximate region and country, never a city, and the location is looked up on varsafe's servers, without calling an outside service.

These checks have limits. IP-based location is approximate, and a verified device can appear in another country without a challenge, to allow for VPNs. A stolen session can look legitimate. The checks cover browser sessions only: CLI logins, API tokens and agent grants are separate credentials, so after a suspected compromise, review and revoke those too. What users see is described in [Authentication](/reference/authentication#unusual-access-protection).

### CLI logins

The CLI signs in through the browser: the password never reaches the terminal. A CLI login is its own credential, separate from the browser session. It ends after 90 days without use, is created for at most 180 days, and can be revoked from the dashboard. On the machine it is stored encrypted (AES-256-GCM), with the key in the operating system keychain. On a machine with no keychain, a login falls back to a **machine token**, stored unencrypted in a directory only the user can read, and bounded instead: the teams, projects and environments approved, re-checked against the person's current access on every request, and at most 30 days.

### API tokens

API tokens (`vs_at_` prefix) are stored only as a salted SHA-256 hash and shown once. Every token expires: a token is created for at most 90 days on Developer and 365 days on Team. Revocation applies to the next request.

## Removing access

| Event | What happens |
| --- | --- |
| A member is removed, or leaves | As part of the removal, their CLI logins lose access to the team, and their agent grants and the API tokens they created are revoked. An agent grant that also covered other teams is revoked whole; they reconnect to keep those |
| A member's role changes | The same revocation runs, so their tokens and grants do not outlive the old role. Transferring ownership is the exception: it stops both members' agent grants, but their API tokens and CLI logins stay |
| A member is deactivated | Scheduled with a 7-day grace period. Their access and the API tokens they created keep working until it ends, then stop. Their agent grants stop immediately |
| A password is reset | Every session, CLI login, agent refresh token and API token of that account is revoked |

## Audit trail

Every value read and every change is recorded with who did it, the team, the target, and, for requests, the IP address and user agent. An agent's actions are recorded under the person who approved it, or the API token it used, and marked as agent actions; the record does not say which agent.

- **Append-only for the application.** It can add audit records but cannot edit or delete them directly. Two processes change history, and each is recorded: the retention cleanup deletes events past the retention window, and deleting an account anonymizes it in every event that names it, while the events stay. The address an invitation was sent to stays: it names an address, not an account.
- **Retention.** Events are visible for 7 days on Developer and 90 days on Team. Events older than 90 days are deleted from the live database, for every team. Export what you need to keep longer.
- **Stored events.** Events pass through a delivery queue that keeps a copy of each for a limited time. Deleting an account also erases it from the copies already in that queue.
- **Exports.** On the Team plan, owners and admins can export a team's audit log for a period of up to a year, and at most 50,000 events, built on the server from every event of the period, as CSV or JSON for compliance reviews; the GDPR version leaves out IP addresses. They can also generate a member access review. See [Compliance exports](/reference/operations#compliance-exports).

### Composed secrets

Reading one composed secret reveals every secret it embeds, so the audit event records the full **closure**: reading `DATABASE_URL` is logged as access to `DATABASE_URL`, `DB_USER` and `DB_PASS`, not only the key requested. A review that saw only the requested key would clear a credential that in fact leaked.

- **Read access to a composed secret is, in effect, read access to its inputs.** Composition reduces duplication, not disclosure.
- **The closure is always recorded in full.** A requested key can resolve to a limited number of secrets, well within what one audit record holds, and a larger composition is refused. A bulk read of more than 1,000 secrets records the first 1,000 names and the exact total.

See [Operations](/reference/operations#audit-log-management) for the event catalog.

## Machines and pipelines

- **`varsafe run` writes no readable values to disk.** Values go into the command's environment and are gone when it exits.
- **The CLI's own token does not leak into the child.** `run` removes `VARSAFE_API_TOKEN` and `VARSAFE_TOKEN` from the command's environment unless you pass `--pass-credential`. A command running as the same user can still call `varsafe` with that user's stored login; the CLI cannot prevent that.
- **Known code-loading variables are refused.** `run` refuses to inject variables known to control how a program loads or launches code, such as `PATH`, `LD_PRELOAD`, `DYLD_INSERT_LIBRARIES`, `NODE_OPTIONS` and `GIT_SSH_COMMAND`, so that write access to one secret is harder to turn into code execution on the machines that read it. No list can cover every program's own settings, so treat write access to secrets as sensitive.
- **Plaintext `.env` files are opt-in.** `varsafe export` encrypts the `.env` format by default; a plaintext `.env` needs `--plain`. The other formats (JSON, YAML and Docker) are always plaintext.
- **No secret in argv.** The CLI refuses an API token passed as a command-line value, which would show in shell history and `ps`.

## Network and rate limits

All traffic uses TLS. Sign-in endpoints are limited per IP address, separately for each endpoint:

| Endpoint | Limit |
| --- | --- |
| Sign-in | 10 per minute |
| Sign-up | 10 per minute |
| Password reset request | 5 per 5 minutes |
| Two-factor | 10 per minute |
| Resend verification email | 3 per 5 minutes |
| Other sign-in routes | 100 per minute, or stricter |

The rest of the API is throttled for each endpoint over three windows. The agent endpoint has its own limits, and some endpoints set stricter ones.

| Window | Per IP, without a credential | Per signed-in user or token |
| --- | --- | --- |
| 1 second | 10 requests | 50 requests |
| 10 seconds | 50 requests | 250 requests |
| 1 minute | 200 requests | 1,000 requests |

## Where data lives

varsafe is hosted in the EU. Every company that processes data for varsafe, what it does and where, is listed on the [service providers page](https://varsafe.dev/subprocessors).

## Compliance

varsafe is **designed to support** compliance programs. It does not certify you, and this page makes no certification claim.

| Framework | What varsafe provides |
| --- | --- |
| **SOC 2** | An audit trail of every value read and change, role-based access control, encryption in transit and at rest, member access reviews |
| **GDPR** | EU hosting, audit exports without IP addresses, and account deletion that anonymizes the audit log |
| **HIPAA** | Access controls, per-access audit logging, an access export with IP addresses |
| **PCI DSS** | Centralized secrets management with access logging |

## What varsafe does not do yet

- **No SOC 2 report.** varsafe has not been through a SOC 2 audit.
- **Not end-to-end encrypted.** The API reads values to serve them (see [above](#the-access-model)). {/* claim-lint-ok — denies the E2E claim */}
- **No hardware-based device attestation.** Browser recognition uses a random cookie. Use two-factor or passkeys for stronger proof.
- **No alert delivery** to Slack, Microsoft Teams or PagerDuty, and no outbound webhooks. Feed audit exports to your SIEM instead.
- **No enforced SSO.** Configuring SSO for a domain does not disable password or OAuth sign-in for its users.

## If something leaks

1. **Rotate** the secret: dashboard, or `varsafe set` from a script.
2. **Revoke** the leaked session, CLI login, agent grant or API token.
3. **Review** the audit log for what that credential read. An agent's reads appear under the person who approved it, or under the API token it used.
4. **Record** the incident for your compliance program.

Step-by-step runbooks: [Operations → Incident response](/reference/operations#incident-response).

## Reporting security issues

Report vulnerabilities privately through the **[contact form](https://varsafe.dev/contact)**, category "Security Issue".

Please do not disclose a vulnerability publicly before it is fixed, and do not test against production systems without authorization. We aim to acknowledge reports within 24 hours and to ship fixes within 90 days.
