Repository navigation
OSS-385: shared enrollment boundary with atomic consume - #532
Merged
Merged
Conversation
…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.
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.
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
internal/noderuntime/enrollowns the whole ADR 0019 scheme: digest-only enrollment state, server-stored challenge nonce, canonicalSIG_CLAIMencoder, certificate issuance, rotation/revocation and the three authorization domains.internal/noderuntime/nativenow consumes it vianative.Runnerand 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).2. MUST-FIX atomic consume (MEDIUM review finding)
ClaimEnrollmentpreviously mutatedNonceUsed,State,ConsumedAt,ChannelBinding,CredentialGeneration, serial counter andCertSerialbeforeissueClientCertificate; an issuance failure returned refusal with no rollback.InjectIssuanceFailurefault seam. Fixtures ininternal/noderuntime/enrollandinternal/rpc/node_control_enrollment_fixture_test.goassert 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-existingInjectPreCommitFailureseam still covers verification-to-commit rollback.3. Wired authorization domains
Boundaryenforces operator forCreateEnrollment/RevokeCredential/Rotate, bootstrap phase marker forBeginEnrollment/ClaimEnrollment, and enrolled-node domain forAuthorizeNodeOperation/AuthorizePreflight.native.Runnerdelegates through it.AuthorizeBootstrapandAuthorizeNodeOperationare 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
SIG_CLAIMbytes:carbon-panel-enroll-v1+ single0x00delimiters over node/enrollment/challenge IDs, raw server nonce,expires_atas RFC3339Nano, comma-joined proto capability names and raw channel context (final field, no trailing separator).expires_atis the enrollment expiry (returned in the challenge response); the nonce's shorter TTL is server-only and not signed.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/...— passgo veton the same packages — passgo test -count=1on the same packages — pass (enroll,native,rpc,rpc/handlers,rpc/services,db)golangci-lint run --new-from-rev=origin/main ./...(v2.13.2) — 0 issuesknowledge-lint -fixthen final: 40/40 queries pass, 70 concepts, indexes current, second run cleanBranch merged with current
main(merge basebb6fda6a) 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.