Skip to content

feat(secrets): service-auth System-vault access + KEK rotation (rewrap_dek) on UnifiedSecretsService + API (#10436, #10437) - #10478

Merged
mrveiss merged 3 commits into
Dev_new_guifrom
issue-10436
Jun 23, 2026
Merged

mrveiss merged 3 commits into
Dev_new_guifrom
issue-10436

Conversation

@mrveiss

@mrveiss mrveiss commented Jun 22, 2026

Copy link
Copy Markdown
Owner

Thinking Path

Two unified-secrets platform prerequisites (surfaced while scoping SSO secret migration onto #10088). Both unblock #10153/#10154.

What Changed

#10436 — service/system access path to the System vault:

  • api/unified_secrets.py — added service_principal dependency (validates via validate_service_auth, the X-Service-* channel used by voice_proxy.py) + _require_system_vault guard; 5 service-auth endpoints (POST/GET/GET{id}/PUT/DELETE /system) registered before the parameterized routes.
  • services/secrets_coordinator.py — service_* methods scoped strictly to the System vault.
  • Double-fence scoping: API layer 403s any non-system vault before touching the coordinator; coordinator independently re-asserts system-vault kind (defence in depth). User auth path unchanged. Service access audit-logged.

#10437 — KEK rotation (rewrap_dek):

  • services/unified_secrets_service.py — rotate_kek(...) rewraps every grant's DEK via the existing rewrap_dek primitive (autobot_shared/secrets_envelope.py:226), rotating the wrapping KEK without touching the sealed plaintext.
  • services/secrets_coordinator.py — rotate_kek with authorization.
  • api/unified_secrets.py — POST /{secret_id}/rewrap endpoint (base64 32-byte new root key).

Verification

Model Used

Claude Opus 4.8 (senior-backend-engineer subagent).

…rewrap_dek) on UnifiedSecretsService + API (#10436, #10437)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Jun 22, 2026 •

Copy link
Copy Markdown
Contributor

✅ SSOT Configuration Compliance: Passing

🎉 No hardcoded values detected that have SSOT config equivalents!

Applied Black, isort, and autoflake to match code-quality checks.
Triggered by workflow auto-fix-formatting.yml.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
Comment thread autobot-backend/api/unified_secrets.py Fixed
Comment thread autobot-backend/api/unified_secrets.py Fixed
Comment thread autobot-backend/api/unified_secrets.py Fixed
…ve CodeQL findings (#10436, #10437)

migration-matrix: test_unified_secrets_api.py imports api.unified_secrets which
transitively imports security.service_auth (structlog-based HMAC auth); the
migration-gate pip install was missing structlog causing ModuleNotFoundError
during collection. Added structlog to the minimal install list.

CodeQL py/clear-text-logging-sensitive-data: alerts 938/939/940 flagged
service_read/rotate/delete log calls whose extra= dict used key "secret_id"
(a UUID identifier, not a secret value). CodeQL data-flow analysis followed
the uuid.UUID path parameter named secret_id to the logger. Renamed the log
key from "secret_id" to "entry_id" in all three calls — semantic equivalence
preserved, false-positive pattern eliminated.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
coordinator: SecretsCoordinator = Depends(get_coordinator),
) -> SecretValue:
"""Read a system-vault secret value via service identity."""
logger.info("service CRUD: read system secret", extra={"service_id": service_id, "entry_id": str(secret_id)})
coordinator: SecretsCoordinator = Depends(get_coordinator),
) -> SecretMetadata:
"""Rotate a system-vault secret value (re-seal with new DEK) via service identity."""
logger.info("service CRUD: rotate system secret", extra={"service_id": service_id, "entry_id": str(secret_id)})
coordinator: SecretsCoordinator = Depends(get_coordinator),
) -> None:
"""Delete a system-vault secret via service identity."""
logger.info("service CRUD: delete system secret", extra={"service_id": service_id, "entry_id": str(secret_id)})
@mrveiss
mrveiss merged commit 0aa3e2e into Dev_new_gui Jun 23, 2026
30 of 31 checks passed
@mrveiss
mrveiss deleted the issue-10436 branch June 23, 2026 13:46
mrveiss added a commit that referenced this pull request Jun 25, 2026
… logs (#10436) (#10490)

CodeQL py/clear-text-logging-sensitive-data flagged the read/rotate/delete
system-route audit logs (alerts 938/939/940). The taint is the VALUE
str(secret_id) — the uuid.UUID path parameter named secret_id flows into the
logger; CodeQL's heuristic treats secret_id-named data as sensitive. The
earlier remediation renamed the dict KEY (secret_id->entry_id) which did not
break the value taint, so the alerts persisted into base after #10478 merged.

Drop the secret-id value from the three logs, leaving action + service_id.
This matches the canonical pattern: the list-system route logs service_id
only (not flagged), and the user-principal read/rotate/delete routes log
nothing. Operational visibility (which service did what) is preserved; the
secret UUID identifier is omitted. No behaviour change.

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.

2 participants