feat(teams): rotate secret values, with per-entry rotation instructions (CLI 0.9.0) (#260)

`credentials rotate` only re-keys a vault: values stay the same, so it does
nothing after a value leaks. This adds value rotation that agents can run.

- `teams rotation <team> [project] [env]`: per value, the method (random,
  ssh-keygen, command, manual), where the instructions come from, how many
  vaults hold it, and since when. --format json carries the steps for agents.
- `teams rotation-set <team> <project> <env> <KEY>`: store instructions as an
  encrypted `__ROTATE__<KEY>` entry. The team provider hides that prefix
  from sync, so it never lands in a .env and a push never deletes it.
- `teams rotate-keys <team> [project] [env] [--key] [--approve]`: dry run by
  default. random/ssh-keygen/command values are minted and written to EVERY
  vault holding the same value (by fingerprint); manual ones come back as
  steps. `--set-from-stdin` stores a hand-rotated value everywhere the old
  one lives. Values never print.
- Built-in catalog by key name: wallet keys and data-encryption keys are
  never automatic; provider keys point at the provider's dashboard; only
  secrets we mint ourselves are random (META_APP_SECRET etc. are not).
- Empty values (one shared fingerprint) are never planned or overwritten.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Anthony Ettinger 2026-10-28 07:31:21 -07:00 • committed by GitHub
parent ced6c5ac20
commit a8d185bfc0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 923 additions and 2 deletions

View file

@ -55,6 +55,7 @@ export {
githubSecretsProvider,
sshProvider,
teamProvider,
ROTATION_ENTRY_PREFIX,
parseEnv,
applyEnv,
classifySshFile,

View file

@ -25,6 +25,7 @@ export function listCredentialProviderManifests(): CredentialProviderManifest[]
}
export { envProvider, dopplerProvider, railwayProvider, githubSecretsProvider, sh1ptProvider, sshProvider, teamProvider };
export { ROTATION_ENTRY_PREFIX } from "./team.js";
export { parseEnv, applyEnv } from "./env.js";
export {
classifySshFile,

View file

@ -1,4 +1,7 @@
import { fingerprintValue } from "../fingerprint.js";
/** Vault entries holding a secret's rotation instructions: `__ROTATE__<KEY>`. */
export const ROTATION_ENTRY_PREFIX = "__ROTATE__";
import { TeamClient, TeamApiError, type RemoteSecret } from "../client.js";
import { requireAuth, defaultApiUrl } from "../identity.js";
import { generateVaultKey, wrapVaultKey, unwrapVaultKey, encryptValue, decryptValue } from "../crypto.js";
@ -112,7 +115,10 @@ export const teamProvider: CredentialProvider = {
provider: "team",
endpoint,
valuesReadable,
// Rotation instructions ride along in the vault but are not app config:
// never pulled into a .env, never deleted by a push that lacks them.
keys: secrets
.filter((s: RemoteSecret) => !s.name.startsWith(ROTATION_ENTRY_PREFIX))
.map((s: RemoteSecret) => ({ name: s.name, present: true, fingerprint: s.fingerprint, lastModifiedAt: s.updatedAt }))
.sort((a, b) => a.name.localeCompare(b.name)),
inspectedAt: new Date().toISOString()