Skip to content

Feat/key vault#8

Open
CPrutean wants to merge 31 commits into
mainfrom
feat/key_vault
Open

Feat/key vault#8
CPrutean wants to merge 31 commits into
mainfrom
feat/key_vault

Conversation

@CPrutean
Copy link
Copy Markdown
Member

@CPrutean CPrutean commented Jun 5, 2026

What changed

Created the API key vault

Why

Sharing API keys at trickfire has been a really bad practice, this alleviates that.

Type of change

  • Feature (feat/)
  • Bug fix (fix/)
  • Chore / infra (chore/)
  • Docs (docs/)
  • Refactor (refactor/)

Checklist

  • pnpm lint passes
  • pnpm format:check passes
  • If schema.ts was changed - migration generated (pnpm db:generate) and committed alongside the schema
  • PR is focused on one concern

CPrutean added 30 commits June 4, 2026 15:37
Encrypts vault secrets at rest. Resolves the key from VAULT_ENCRYPTION_KEY,
falling back to an auto-generated, persisted db/vault.key in development.
api_key secrets are no longer revealed in-browser. GET /api/vault/[id]/key
returns the decrypted key only to admins or users holding a per-entry grant
(canReadVaultKey). The reveal endpoint now rejects api_key entries.
POST/DELETE /api/admin/vault/[id]/access let admins grant or revoke a user's
access to an api_key entry. Only applies to api_key entries.
- Hide api_key secrets in the table; show the fetch endpoint instead
- Add a Manage access dialog to grant/revoke users per api_key entry
- Hide the copy-behavior field for api_key entries in the editor
- Truncate long entry names (click to expand) and wrap long secrets
The easy-to-copy vs restricted distinction wasn't needed. Login secrets are
now always revealable and copyable; drop the easy_copy column, its schema,
validation, API handling, the editor field, and the table's Copy column.
…sers

Add Cache-Control: no-store so decrypted secrets aren't written to browser or
shared caches, and reject deactivated accounts (which keep a valid cookie and
aren't covered by the middleware matcher for /api/vault/*).
Login secrets now require a per-entry grant to reveal, the same model as
api_key entries - the global Vault-access toggle only controls page
visibility. Generalize canReadVaultKey -> canReadVaultEntry, drop the
api_key-only restriction on the access route, and show Manage access on
every row.
@CPrutean CPrutean requested a review from matejstastny June 5, 2026 18:39
@CPrutean CPrutean self-assigned this Jun 5, 2026
@CPrutean CPrutean added the enhancement New feature or request label Jun 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant