Secrets and access
How secrets are created, versioned and retired, and how roles and scoped policies decide who can read or change them.
Secret types and fields
A secret is created inside an environment with a JSON body:
{
"name": "database-password",
"type": "database",
"value": "…",
"description": "Primary database credential",
"tags": ["payments", "prod"],
"expires_at": "2027-06-30T00:00:00Z"
}
| Field | Required | Notes |
|---|---|---|
name | yes | Validated and unique within the environment. |
type | yes | generic, database, api_key, password, certificate or json. |
value | yes | Up to 1 MiB. For json it must parse as JSON. Sent only in a request body. |
description | no | Free text metadata. |
tags | no | Validated labels. |
expires_at | no | Expiration metadata. Expired secrets fail closed on read. |
The certificate type stores certificate or key material as an ordinary secret. Rivergate does not issue certificates.
The secret lifecycle
| Action | Effect |
|---|---|
| Create | Creates the secret and immutable version 1. Returns metadata only. |
| Update | Replaces metadata and value and appends a new immutable version. |
| Read metadata | Returns the record and its current version number. No value. |
| Read value | Decrypts and returns the current value, or a chosen version. Authorized and audited first. |
| List versions | Version numbers, creator and timestamps. Paginated with before and limit. No values. |
| Rollback | Re-encrypts a chosen historical value as a new current version. History is not rewound or overwritten. |
| Delete | Soft-deletes the secret. Retained versions stay in PostgreSQL but are unavailable through the API. |
- Lists are cursor-paginated:
limitis capped at 100 andcursoris the last secret ID returned. - Value responses carry
Cache-Control: no-store. - Rolling back needs both value-read and write permission, because it reads the old value and writes a new version.
- Deleting a project or environment soft-deletes everything beneath it.
Soft deletion keeps encrypted history. Rivergate does not purge historical ciphertext automatically; plan retention as part of your backup policy.
Roles and permissions
Authorization is default-deny. A role is a fixed set of actions; if a role does not list an action, it cannot perform it.
| Role | Read metadata | Read value | Write secrets | Manage policy | Read audit | Manage keys | Manage org |
|---|---|---|---|---|---|---|---|
owner | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
admin | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | |
developer | ✓ | ✓ | |||||
secret_reader | ✓ | ✓ | |||||
auditor | ✓ | ✓ | |||||
operator | ✓ | ||||||
machine | Membership marker only. Grants no action; needs a scoped policy. | ||||||
system_admin | Identity and platform administration only. No secret access. | ||||||
Note that developer can write a secret but not read its value back, and only owner and admin can manage policy.
Memberships and scoped policies
Access has two layers.
- Organization membership gives a person an organization-wide role.
- Scoped policy bindings grant a role at a narrower scope: a
project, anenvironmentor a singlesecret.
Bindings inherit downward: a project binding applies to its environments and secrets; an environment binding applies to its secrets; a secret binding applies only to that secret. There is no way to bind a role across organizations.
// POST /api/v1/organizations/{organization}/members
{ "principal_id": "PRINCIPAL_ID", "role": "developer" }
// POST /api/v1/organizations/{organization}/policies
{ "principal_id": "PRINCIPAL_ID", "scope_type": "environment", "scope_id": "ENVIRONMENT_ID", "role": "secret_reader" }
- A principal must already be an active organization member before a scoped policy can be bound.
- Only organization
ownerandadminroles can manage members and policies. - Removing a member suspends them and revokes all of their policy bindings. The last active owner cannot be removed.
- Revoking a binding takes effect on the next request, including for API tokens.
Machine principals
Workloads such as the Kubernetes Operator authenticate as machine principals. A machine joins an organization with the machine role, which grants nothing by itself; you then give it the narrowest scoped policy that does the job, ideally secret_reader on one secret. Machine principals cannot receive organization-wide bindings and can never become system administrators. See workload identity.
Least-privilege patterns
- Give humans
developerto write secrets without being able to read production values back. - Give an application or pipeline
secret_readeron the exact secret it needs. - Use
auditorfor people who review activity but should not see values. - Keep
ownerto a small group; it is the only role that can manage keys.