Skip to content

feat(rotation): rotation policies, expiry reminders, rotation flags (rotation-expiry-policies) - #76

Merged
rubenvdlinde merged 1 commit into
developmentfrom
feat/apply-rotation-expiry-policies
Jul 18, 2026
Merged

rubenvdlinde merged 1 commit into
developmentfrom
feat/apply-rotation-expiry-policies

Conversation

@rubenvdlinde

Copy link
Copy Markdown
Contributor

Implements the rotation-expiry-policies OpenSpec change.

What

  • Migration 22: nullable expires_at on doriath_secrets; new doriath_expiry_policies (unique owner/scope/scope_id) and doriath_rotation_flags (unique secret_id) tables.
  • RotationPolicyService: effective-expiry resolution = earliest of per-secret expiry, applicable type/folder policies (key age + max_age_days, created_at fallback), per-user override, admin default — server-visible fields only, no decryption. Policy CRUD, idempotent one-open-flag-per-secret, markRotated closes ONLY on a proven key_updated_at advance (else re-request path), dismiss, compromise auto-flag.
  • ScanExpiringSecretsJob (daily TimedJob): reminder notifications at exact day thresholds (naturally deduped by daily cadence), overdue secrets get a policy_expiry flag + one notification per episode. Gated on notify_security.
  • RotationController + routes: expiry get/set (PUT /api/v1/secrets/{id}/expiry), expiry-policies CRUD, rotation-flags list/batch (IDs only — no breach verdicts/digests persisted)/rotated/dismiss.
  • Audit: five new event types with ids/reasons-only whitelists.
  • Frontend: RotationPanel on secret detail (expiry editor, status chips, mark-rotated/dismiss/flag), health-report rotation category + breached batch-flag button, dashboard rotation-due KPI (stat widget bound to rotation_due_count), admin Rotation & expiry settings section.
  • Tests: 11 new PHPUnit tests. Also fixes pre-existing phpcs/phpstan issues encountered (setInterval named param, docblocks, inline ifs).

Gates

  • PHPUnit 619 passed / 1 documented skip
  • vitest 343 passed
  • phpcs 0 errors, psalm/phpstan: only pre-existing sibling-class (OpenRegister AppHost) analysis-env errors remain
  • eslint clean on touched files; webpack build OK

🤖 Generated with Claude Code

…otation flags

Implements openspec change rotation-expiry-policies:
- Migration 22: secrets.expires_at + doriath_expiry_policies + doriath_rotation_flags
- RotationPolicyService: effective-expiry resolution (earliest of per-secret,
  type/folder policies, user override, admin default; server-visible fields only),
  policy CRUD, idempotent one-open-flag-per-secret lifecycle, mark-rotated only
  on a proven key_updated_at advance, dismiss, compromise auto-flag
- SecretService.setExpiry (owner-only, never touches ciphertext/key age) + flag
  delete cascade; SuiteCompromiseListener raises suite_compromise flags
- ScanExpiringSecretsJob (daily): threshold reminders + overdue policy_expiry
  flags, notify_security-gated notifications (secret_expiring/secret_rotation_due)
- RotationController + routes (expiry get/set, policies, flags, batch-flag IDs-only)
- Audit events: secret.expiry_set/rotation_flagged/rotated/rotation_dismissed,
  policy.expiry_changed (ids/reasons only)
- Frontend: RotationPanel on secret detail (expiry editor + chips + flag actions),
  rotation category + breached batch-flag in health report, dashboard
  rotation-due KPI, admin Rotation & expiry settings section
- Tests: 11 new PHPUnit tests (resolution precedence, proven-advance, batch scope,
  job threshold/overdue dedupe); fixes pre-existing phpcs/phpstan issues encountered
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant