Skip to content

P0-GATE: redact node TLS material from read responses - #509

Merged
athNdev merged 5 commits into
mainfrom
codex/managed-node-runtime-track
Nov 18, 2026
Merged

athNdev merged 5 commits into
mainfrom
codex/managed-node-runtime-track

Conversation

@athNdev

@athNdev athNdev commented Nov 18, 2026 •

Copy link
Copy Markdown
Owner

P0-GATE only (Track C managed-node runtime)

This PR implements the reviewer-confirmed P0 source leak fix and its harmless fixtures. It deliberately contains no agent, transport, proto, enrollment or daemon-lifecycle work.

Changes

  • internal/rpc/services/node.go: dbNodeToProto no longer copies tls_ca_cert, tls_cert or tls_key into the UI-bound proto shape. Fields stay declared for wire compatibility; the Docker client pool still reads stored TLS material from the DB, so daemon auth is unchanged.
  • UpdateNode treats an empty TLS string as unchanged, not clear. A redacted read response echoed back by an edit form can no longer destroy stored credentials or bump EndpointGeneration; a non-empty value still replaces credentials and invalidates cached pool clients.
  • Harmless fixtures with synthetic sentinels (no real credentials):
    • internal/rpc/services/node_redaction_test.go: redaction across CreateNode/GetNode/ListNodes, protojson wire output, formatted values and logs; stored bytes unchanged; no-round-trip proof including generation stability and genuine replacement.
    • internal/rpc/node_redaction_test.go: generated NodeService through the real auth interceptor with a global nodes/read principal, plus raw HTTP body inspection.
  • Scoped reset policy (ADR 0018): Replace TLS credentials (non-empty UpdateNode, nodes:update) is distinct from a named Clear TLS credentials action. The clear action requires an authenticated operator, nodes:update (not nodes:read), exact target-name and confirmation-phrase checks, a generation bump, cached-client invalidation and a redacted audit entry; it touches only one node's three TLS fields. internal/rpc/services/node_tls_reset.go plus _test.go prove ordinary edits and all refusals never clear, while the named action does.
  • docs/adr/0018-node-response-redaction.md, knowledge/decisions/adrs.md (one Track C owner), knowledge/architecture/rpc-contract.md.

Verification

  • go test ./internal/rpc/... -count=1 — pass
  • go test ./... -count=1 — pass
  • go vet ./... — pass
  • knowledge-lint -fix then plain — pass (38/38 queries), with one pre-existing unrelated invariants/data-safety re-verify warning.

Limitations / coordination

  • The companion web/carbon-panel/src/lib/components/node-settings.svelte change is owned by the frontend lane writer and is not in this PR (orchestrator coordination). The server-side contract makes an echo of redacted fields harmless even before that UI lands; the UI must still stop displaying/sending empty TLS fields as real values.
  • The named clear action is server-side only in P0-GATE; its wire-exposed RPC needs proto/generated-file work and is a coordinated follow-up with one proto owner. nodes/read stays redacted.
  • Coordinate with PR510 (node-settings.svelte, frontend lane writer): no clearing via empty TLS fields; the UI half and server half must both ship before P0-GATE is complete.
  • No live node, deployment, release or credential was used. Fixtures only.

Do not merge here: independent review and green CI required.

dbNodeToProto no longer copies tls_ca_cert, tls_cert or tls_key into the UI-bound proto shape; wire fields stay declared and the Docker pool still reads stored material. UpdateNode treats empty TLS strings as unchanged so a redacted response cannot clear credentials or bump EndpointGeneration. Adds harmless response-shape and no-round-trip fixtures, ADR 0018 and governing knowledge updates.
ADR 0018 now distinguishes Replace TLS credentials from a named Clear TLS credentials action requiring an authenticated operator, nodes:update permission, target-name and confirmation-phrase checks, generation bump, cached-client invalidation and a redacted audit entry. Adds the server-side named action plus a harmless fixture proving ordinary edits and refusals never clear. Wire exposure remains a coordinated follow-up; PR510 UI ownership unchanged.
…ntime-track

# Conflicts:
#	knowledge/decisions/adrs.md
…ntime-track

# Conflicts:
#	knowledge/decisions/adrs.md
@athNdev
athNdev marked this pull request as ready for review November 18, 2026 03:46
…ntime-track

# Conflicts:
#	knowledge/decisions/adrs.md
@athNdev
athNdev merged commit d75c31d into main Nov 18, 2026
12 checks passed
@athNdev
athNdev deleted the codex/managed-node-runtime-track branch November 18, 2026 04:03
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