Skip to content

OSS-385: shared enrollment boundary with atomic consume - #532

Merged
athNdev merged 3 commits into
mainfrom
codex/node-shared-enroll
Nov 18, 2026
Merged

athNdev merged 3 commits into
mainfrom
codex/node-shared-enroll

Conversation

@athNdev

@athNdev athNdev commented Nov 18, 2026

Copy link
Copy Markdown
Owner

Summary

OSS-385 (child of OSS-368), follow-up to the independent review of the PR527 OSS-376 fixture consumer. Consolidates managed-node enrollment into ONE mode-agnostic production package before any production RPC is mounted. No proto fork, no live host, no release/deployment/registry action.

1. Single shared production package

  • New internal/noderuntime/enroll owns the whole ADR 0019 scheme: digest-only enrollment state, server-stored challenge nonce, canonical SIG_CLAIM encoder, certificate issuance, rotation/revocation and the three authorization domains.
  • internal/noderuntime/native now consumes it via native.Runner and a compatibility re-export shim; no mode-local proof-of-possession, claim context, certificate policy or auth check remains. VM/LXC lanes are documented as consumers of the same package (their own lanes were not edited).
  • The test-only RPC seam fixture now delegates its claim context and certificate issuance to the shared package, so there is no second crypto implementation in fixtures.

2. MUST-FIX atomic consume (MEDIUM review finding)

  • ClaimEnrollment previously mutated NonceUsed, State, ConsumedAt, ChannelBinding, CredentialGeneration, serial counter and CertSerial before issueClientCertificate; an issuance failure returned refusal with no rollback.
  • Now the certificate is issued into a local variable first; every ownership field flips in one commit step only after issuance succeeds. There is no failure path after the commit starts.
  • Added InjectIssuanceFailure fault seam. Fixtures in internal/noderuntime/enroll and internal/rpc/node_control_enrollment_fixture_test.go assert zero state mutation (state, nonce/challenge, generation, serial, channel binding, serial counter) after an injected issuance failure and that a legitimate retry with a fresh challenge succeeds. The pre-existing InjectPreCommitFailure seam still covers verification-to-commit rollback.

3. Wired authorization domains

  • New shared Boundary enforces operator for CreateEnrollment/RevokeCredential/Rotate, bootstrap phase marker for BeginEnrollment/ClaimEnrollment, and enrolled-node domain for AuthorizeNodeOperation/AuthorizePreflight. native.Runner delegates through it. AuthorizeBootstrap and AuthorizeNodeOperation are no longer test-only helpers. Three non-crossing domains, digest-only storage, no secret in read responses.

4. ADR 0019 exact context and curve decision

  • Documented the exact SIG_CLAIM bytes: carbon-panel-enroll-v1 + single 0x00 delimiters over node/enrollment/challenge IDs, raw server nonce, expires_at as RFC3339Nano, comma-joined proto capability names and raw channel context (final field, no trailing separator).
  • Explicit: the nonce is the server-stored challenge nonce; the shared proto has no client nonce field. expires_at is the enrollment expiry (returned in the challenge response); the nonce's shorter TTL is server-only and not signed.
  • Decision: Ed25519-only, narrowing the previous "Ed25519 or P-256" allowance. P-256 CSRs are refused at registration; a second curve needs a new signing domain and ADR.
  • Recorded a known, out-of-scope divergence: the VM first-boot Python fixture still signs canonical JSON. It uses the server nonce but will not verify against this package; the VM lane must align before any production mount.

Verification

Pinned toolchain GOTOOLCHAIN=go1.26.11 (go version go1.26.11 windows/amd64):

  • go build ./internal/noderuntime/... ./cmd/carbon-node/... ./internal/rpc/... ./internal/db/... — pass
  • go vet on the same packages — pass
  • go test -count=1 on the same packages — pass (enroll, native, rpc, rpc/handlers, rpc/services, db)
  • golangci-lint run --new-from-rev=origin/main ./... (v2.13.2) — 0 issues
  • knowledge-lint -fix then final: 40/40 queries pass, 70 concepts, indexes current, second run clean

Branch merged with current main (merge base bb6fda6a) before opening so the ADR 0019 addendum already on main is preserved. No production enrollment RPC handler is mounted; fixtures use synthetic keys/owned temp material only. Do not merge without independent review and green CI.

…e (OSS-385)

- Add internal/noderuntime/enroll as the single mode-agnostic production
  package for enrollment, canonical SIG_CLAIM context, certificate issuance
  and the three authorization domains; native lane consumes it via a shim.
- Fix MUST-FIX atomicity: issue the client certificate into a local variable
  before mutating ownership state, then commit state once. Added
  InjectIssuanceFailure seam plus fixtures in enroll and the RPC test seam
  proving zero state mutation and a successful legitimate retry.
- Wire AuthorizeBootstrap and AuthorizeNodeOperation into the shared Boundary
  and native Runner; operator domain was already enforced.
- Document exact ADR0019 context encoding (server-stored nonce, no client
  nonce field, enrollment expires_at vs nonce TTL, 0x00 delimiters) and decide
  Ed25519-only; P-256 is refused at registration.
- Update knowledge concepts for the shared boundary; no ADR index edits.

No production RPC mount, live host, release or deployment action.
The VM first-boot Python fixture still signs canonical JSON rather than the
shared NUL-delimited context. It is a separate lane and was not edited here;
record the required alignment before any production mount.
@athNdev
athNdev merged commit 4ce8d33 into main Nov 18, 2026
12 checks passed
@athNdev
athNdev deleted the codex/node-shared-enroll branch November 18, 2026 09:12
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