Repository navigation
feat(secrets): service-auth System-vault access + KEK rotation (rewrap_dek) on UnifiedSecretsService + API (#10436, #10437) - #10478
Merged
Merged
Conversation
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>
…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)}) |
This was referenced Jun 23, 2026
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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— addedservice_principaldependency (validates viavalidate_service_auth, theX-Service-*channel used byvoice_proxy.py) +_require_system_vaultguard; 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.#10437 — KEK rotation (rewrap_dek):
services/unified_secrets_service.py—rotate_kek(...)rewraps every grant's DEK via the existingrewrap_dekprimitive (autobot_shared/secrets_envelope.py:226), rotating the wrapping KEK without touching the sealed plaintext.services/secrets_coordinator.py—rotate_kekwith authorization.api/unified_secrets.py—POST /{secret_id}/rewrapendpoint (base64 32-byte new root key).Verification
py_compile+ line-length clean on all 5 files.migration_gate+requires_postgres(run in CI's migration-gate). Covers: service CRUD on system vault, 403 on user vault, same-plaintext-decrypts-after-KEK-rotation, old-key-fails, unauthorized-403.Model Used
Claude Opus 4.8 (senior-backend-engineer subagent).