fix(secrets): describe --show-values resolves through the backend driver
Some checks failed
CI/CD / lint (push) Successful in 55s
CI/CD / test (push) Failing after 1m5s
CI/CD / typecheck (push) Has started running
CI/CD / smoke (push) Has been cancelled
CI/CD / build (push) Has been cancelled
CI/CD / publish (push) Has been cancelled

Post-migration, every Secret on a non-plaintext backend has empty `Secret.data`
(the actual value lives in the backend; only externalRef is on the row).
`describe secret --show-values` was reading the raw row, so the user saw
"Data: (empty)" for every migrated secret.

- Route GET /api/v1/secrets/:id accepts ?reveal=true; when set, resolves the
  value via SecretService.resolveData() so the response carries the actual
  data dispatched through the right driver.
- CLI --show-values flips that query param. Without --show-values the route
  returns the raw row exactly as before (no leak risk).

Caught running the wizard end-to-end on the live cluster after the
ClusterMesh fix on the kubernetes-deployment side made bao reachable.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Michal
2026-04-24 00:46:54 +01:00
parent bf312850b5
commit faccbb58e7
2 changed files with 28 additions and 4 deletions

View File

@@ -928,7 +928,15 @@ export function createDescribeCommand(deps: DescribeCommandDeps): Command {
}
}
const item = await deps.fetchResource(resource, id) as Record<string, unknown>;
let item: Record<string, unknown>;
if (resource === 'secrets' && opts.showValues === true) {
// --show-values needs the resolved data (the raw row's `data` is
// empty for non-plaintext backends — values live in the backend).
// Use ?reveal=true so mcpd dispatches through the backing driver.
item = await deps.client.get<Record<string, unknown>>(`/api/v1/secrets/${id}?reveal=true`);
} else {
item = await deps.fetchResource(resource, id) as Record<string, unknown>;
}
// Enrich instances with container inspect data
let inspect: Record<string, unknown> | undefined;