Skip to content

feat: add secret types#801

Merged
nimish-ks merged 19 commits intomainfrom
feat--secret-types
Mar 24, 2026
Merged

feat: add secret types#801
nimish-ks merged 19 commits intomainfrom
feat--secret-types

Conversation

@rohan-chaturvedi
Copy link
Copy Markdown
Member

Summary

  • Adds a type field to secrets with three options: Secret (default), Sealed, and Config
  • Sealed secrets have their values redacted server-side — once saved, the plaintext is never returned to the client, the value cannot be revealed or edited, and the type cannot be changed
  • Config variables are non-sensitive values that are revealed by default and skip masking in the UI
  • Full UX support across both the single-environment editor and the cross-environment editor, including an animated TypeSelector toggle, type badges, and creation via SplitButton dropdown

Changes

Backend

  • Migration (0118_secret_type_field.py): Adds type CharField with choices secret, sealed, config (default: secret)
  • Model (models.py): SecretTypeChoices enum and type field on Secret
  • API views (views/secrets.py): resolve_value returns empty string for sealed secrets so ciphertext is never sent to the client
  • GraphQL (types.py, mutations/environment.py): Exposes type on SecretType, accepts type in SecretInput for create/update mutations

Frontend

  • TypeSelector (TypeSelector.tsx): New animated segmented toggle component with sliding indicator that transitions between Secret/Sealed/Config states
  • Single-env editor (page.tsx, SecretRow.tsx): Type selector in key action menu, type badges, sealed enforcement (locked value, blocked reveal, disabled editing), config auto-reveal, type included in save mutation and unsaved changes detection
  • Cross-env editor (AppSecrets.tsx, AppSecretRow.tsx): Type selector propagates changes to all environment values, type badges, sealed/config behavior per-env, SplitButton for creating Config and Sealed secrets, "Add value" inherits type from sibling env secrets
  • Decryption (environments.ts): Skips decryptAsymmetric for sealed secrets (server returns empty string, not valid ciphertext)
  • GraphQL queries (getSecrets.gql, getAppSecrets.gql): Added type field
  • Memo comparators: Updated areAppSecretRowEqual, areEnvSecretEqual to include type so React re-renders on type changes

Key design decisions

  • isSealedAndSaved checks the server type (not client type), so users can freely toggle types before saving — the seal only locks once persisted
  • Sealed enforcement is server-side: resolve_value strips the ciphertext, so even if the client is compromised, sealed values cannot be exfiltrated

Preview

Screenshot From 2026-03-11 13-17-21 Screenshot From 2026-03-11 13-15-43
Screencast.From.2026-03-11.13-18-45.mp4

Test plan

  • Create a new secret with default type — verify it saves and behaves as before
  • Create a sealed secret — verify value is editable before first save, then locked after save (cannot reveal, edit, or change type)
  • Create a config variable — verify value is revealed by default and not masked
  • Toggle a secret's type before saving — verify TypeSelector animates, amber highlight appears, discard restores original type
  • In cross-env editor: toggle type — verify it propagates to all environments
  • In cross-env editor: use "Add value" on a sealed secret's missing env — verify the new value inherits the sealed type
  • Verify sealed secrets return empty values from the API (no ciphertext leakage)

Signed-off-by: rohan <rohan.chaturvedi@protonmail.com>
@rohan-chaturvedi rohan-chaturvedi added enhancement New feature or request frontend Change in frontend code backend updates migrations This PR adds new migrations that update the database schema labels Mar 11, 2026
Signed-off-by: rohan <rohan.chaturvedi@protonmail.com>
Signed-off-by: rohan <rohan.chaturvedi@protonmail.com>
rohan-chaturvedi and others added 3 commits March 11, 2026 19:48
Signed-off-by: rohan <rohan.chaturvedi@protonmail.com>
Resolve conflicts in SecretPropertyDiffs.tsx and SecretRow.tsx:
- Keep secret type display and sealed value handling from feature branch
- Incorporate UI density/sizing changes from main
- Hide type badge by default, only show TypeSelector on hover
- Fix Tab key in secret key input skipping to value field
- Fix z-index for sticky toolbar and GenericDialog
- Remove Config/Sealed from new secret dropdown menus
@nimish-ks nimish-ks force-pushed the feat--secret-types branch from cdc6883 to eea2352 Compare March 17, 2026 05:50
nimish-ks and others added 13 commits March 17, 2026 13:54
- Change default secret type from Secret to Config
- Reorder TypeSelector: Config, Secret, Sealed
- Change sealed value placeholder from "Sealed" to "Sealed secret"
Signed-off-by: rohan <rohan.chaturvedi@protonmail.com>
Signed-off-by: rohan <rohan.chaturvedi@protonmail.com>
Signed-off-by: rohan <rohan.chaturvedi@protonmail.com>
Signed-off-by: rohan <rohan.chaturvedi@protonmail.com>
Signed-off-by: rohan <rohan.chaturvedi@protonmail.com>
Signed-off-by: rohan <rohan.chaturvedi@protonmail.com>
Signed-off-by: rohan <rohan.chaturvedi@protonmail.com>
fix: secret type UX and z-index improvements
Signed-off-by: rohan <rohan.chaturvedi@protonmail.com>
@nimish-ks nimish-ks merged commit a56d5c8 into main Mar 24, 2026
7 checks passed
@nimish-ks nimish-ks deleted the feat--secret-types branch March 24, 2026 06:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backend enhancement New feature or request frontend Change in frontend code updates migrations This PR adds new migrations that update the database schema

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants