Implement policy-based runtime capsule issuance#1485
Open
WillEastbury wants to merge 2 commits intomainfrom
Open
Implement policy-based runtime capsule issuance#1485WillEastbury wants to merge 2 commits intomainfrom
WillEastbury wants to merge 2 commits intomainfrom
Conversation
Add GET /api/runtime/capsule/{nodeId} endpoint with multi-stage policy:
1. Identity verification: Bearer token auth + node existence check
2. Status check: reject revoked/disabled nodes
3. Fingerprint verification: compare device fingerprint header
4. Telemetry behaviour: detect abrupt stops (unclean shutdown + recent telemetry)
5. Network policy: risk scoring (IP +20, ASN +40, region +50, abrupt stop +80)
Nodes scoring >=80 auto-quarantined
6. HKDF key derivation: per-node runtime key from cluster master
7. Capsule envelope: capsuleId, runtimeKey, HMAC-SHA256 signature, 24h expiry
8. Node state update: IP/ASN/region/capsule timestamp persisted
Extended DeploymentNode with policy fields. Added capsule models.
Closes #1430
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Replace string.Equals with CryptographicOperations.FixedTimeEquals for bearer token validation (prevents timing side-channel) - Make WriteCapsuleDenied async and await all 7 call sites - Cache HKDF master key at startup instead of reading /etc/machine-id on every request (eliminates file I/O on hot path) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.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.
Summary
Implements GET /api/runtime/capsule/{nodeId} — a policy-gated endpoint that controls whether a deployment node receives a runtime capsule (encryption key + signed envelope) needed to start BMW.
Policy Pipeline (8 stages)
Changes
Denial Responses
{"denied":true,"reason":"NODE_REVOKED"} {"denied":true,"reason":"NETWORK_POLICY_VIOLATION","riskScore":90}Closes #1430