Repository navigation
feat: add workspace secrets table, queries, and RBAC - #30248
Merged
Merged
Conversation
Member
Author
This was referenced Oct 1, 2026
Emyrk
commented
Oct 1, 2026
Emyrk
force-pushed
the
steven/ws-secrets/db
branch
from
October 1, 2026 14:52
87d458e to
e66489e
Compare
Emyrk
force-pushed
the
steven/ws-secrets/db
branch
3 times, most recently
from
October 2, 2026 14:27
23c9372 to
e4c9015
Compare
Emyrk
commented
Oct 5, 2026
Emyrk
force-pushed
the
steven/ws-secrets/db
branch
from
October 5, 2026 19:43
e4c9015 to
192d209
Compare
Emyrk
force-pushed
the
steven/ws-secrets/db
branch
from
October 6, 2026 01:53
a7199ed to
89ea493
Compare
Emyrk
marked this pull request as ready for review
October 6, 2026 18:13
This was referenced Oct 6, 2026
Open
Emyrk
force-pushed
the
steven/ws-secrets/db
branch
from
October 7, 2026 22:33
e1c97c8 to
8e4631d
Compare
Emyrk
force-pushed
the
steven/ws-secrets/db
branch
from
October 8, 2026 15:52
8e4631d to
6ddd097
Compare
dylanhuff-at-coder
approved these changes
Oct 12, 2026
dylanhuff-at-coder
left a comment
Collaborator
There was a problem hiding this comment.
my comments have been addressed, lgtm
Adds the workspace_secrets table with per-build caps, the workspace_secret RBAC resource and API key scopes, the AsWorkspaceSecretManager actor, and the queries used by later changes to set, carry forward, clear, list, and re-encrypt secrets on workspace builds.
Emyrk
force-pushed
the
steven/ws-secrets/db
branch
from
October 15, 2026 17:44
9a091b9 to
f2c82bf
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Adds the database table, queries, and permissions for workspace secrets: secrets set on a workspace build and delivered to the agent, never to Terraform. First PR in the stack for RELAY-7. Supersedes #30200.
Stack
workspace_secretRBAC resource. Owners, org admins, and members with workspace access can set, view, and clear secrets, but nobody can read values through the API.Nothing calls these queries yet.
Implementation details
000614_workspace_secrets. Columns mirroruser_secrets(value,value_key_id,env_name,file_path), plusephemeral,cleared_at, andsource(requestorcarry_forward).cleared_at), never both.BEFORE INSERTtrigger enforces the per-build limits. Like user secrets it counts stored bytes, which are ciphertext when encryption is on (tracked in Secret byte limits measure ciphertext, which breaks near-cap secrets when dbcrypt is enabled #30441).InsertWorkspaceSecret,ListActiveWorkspaceSecretsClearWorkspaceSecretsBeforeBuildclears only builds with a lower build number, so a late clear can't wipe a newer build.ClearWorkspaceSecretsByWorkspaceIDruns on workspace delete.GetWorkspaceSecretsHistoryis metadata only, optionally filtered to one build.GetWorkspaceSecrets(paged byid) andUpdateEncryptedWorkspaceSecretValueare for key rotation.create,read(metadata),update(clear, remove, re-encrypt), andread_secret. No user role hasread_secret, and the generalsystemactor has no workspace secret grants.AsWorkspaceSecretManagerholds everyworkspace_secretaction.create, clear needsupdate, and history needsreadon the workspace owner and org. Any query that returns values needsread_secret.workspace_secret:create, and the migration adds theapi_key_scopeenum values.Design decisions (whole stack)
secretsstill carries the set forward. Copying and clearing run asAsWorkspaceSecretManager, so autostart, the build orchestrator, and prebuilds need no secret permissions.value = NULL,value_key_id = NULL, andcleared_at = now(). Metadata is kept.secretson the create workspace and create build requests. Setting needsworkspace_secret:createon the workspace owner."value": nulldrops the secret and needsworkspace_secret:update. An empty string is a real value.env_nameorfile_pathsupersedes that secret entirely, even if the new one is ephemeral. Needs onlycreate.read_secret, held only byAsWorkspaceSecretManager. History and the build listing are metadata only.env_nameorfile_path.requestorcarry_forward, for debugging and the build audit entry.Created by Coder Agents on behalf of @Emyrk.