Menu ▾ ▴

#34 [Feature]: Add environment locking and inheritance

open
nobody
2026-10-24
2026-09-11
Anonymous
No

Originally created by: thomijasir
Originally owned by: thomijasir

Feature description

Let administrators protect an environment from changes and optionally inherit secrets from one parent environment.

Current behavior

Every environment owns an independent secret set. Project managers can change any environment they manage, and there is no parent relationship or lock state.

Why we need this

Production environments need an explicit guard against accidental edits. Related environments may also need a shared baseline without copying the same secrets into each environment.

Proposed CLI interface

  • dopbase env lock ENVIRONMENT
  • dopbase env unlock ENVIRONMENT
  • dopbase env parent ENVIRONMENT PARENT_ENVIRONMENT
  • dopbase env parent ENVIRONMENT --clear
  • dopbase env show ENVIRONMENT

Expected behavior

  • A locked environment rejects secret set, delete, import, replacement, rename, token creation, and parent changes until it is unlocked.
  • Lock and unlock require project-manager authorization, recent authentication, and confirmation unless --yes is present.
  • A child inherits parent secrets and overrides them with its own keys.
  • Parent and child must belong to the same project.
  • Reject self-parenting and cycles before saving the relationship.
  • Runtime, export, and template rendering use the resolved set. Metadata listings identify each key as local or inherited.
  • Deleting or renaming a parent must report dependent children and require an explicit resolution.
  • Changing a parent secret affects children immediately and creates audit events that identify affected environments.
  • env show includes lock state, parent, and child count in human and JSON output.

Security and compatibility

  • Enforce locks and inheritance on the server for every mutation path, including direct API calls.
  • Apply authorization to both parent and child before exposing resolved metadata or values.
  • Do not duplicate inherited plaintext into child rows.
  • Include parent identity and resolution revision in authenticated encryption or response validation where needed.

Out of scope

  • Inheritance across projects or servers.
  • More than one direct parent.
  • Partial key namespaces.
  • Automatic parent selection based on environment names.

Acceptance criteria

  • [ ] Locked environments reject every defined mutation path.
  • [ ] Unlocking restores normal behavior.
  • [ ] A child receives parent keys and its local values win on collision.
  • [ ] Cycles, cross-project parents, and unauthorized relationships are rejected.
  • [ ] Parent updates appear in child runtime results without copying rows.
  • [ ] Deletion behavior cannot orphan a child silently.
  • [ ] Audit, backup, restore, and CLI status include the new state.

Test scenarios

  • Add model, migration, authorization, secret resolution, audit, backup, API, and CLI tests.
  • Cover all locked mutations, unlock, inheritance, overrides, cycles, cross-project attempts, deletion, concurrency, runtime and export resolution, runner scope, audit events, and backup round trips.

Documentation

Document lock coverage, inheritance precedence, parent deletion, authorization, runtime behavior, and recovery steps.

Dependencies

Requires product approval of lock coverage and inheritance rules, followed by schema, service, API, audit, and backup changes. The CLI should be implemented after those contracts are stable.

Discussion

  • Anonymous

    Anonymous - 2026-09-11
     

Log in to post a comment.