Repository navigation
fix(state-machine): reconcile abandoned TLS provisioning identities - #3046
Rashika-Rajaraman wants to merge 5 commits into
Conversation
35c3429 to
798bf05
Compare
There was a problem hiding this comment.
🟡 Changes recommended
Cleanup can reject valid Microsoft CA or intermediate-issued certificates and delete certificates or keys belonging to another live activation for the same UUID.
2 open issues
What changed in this PR
Adds recovery handling for TLS identities left by interrupted Intel AMT provisioning, addressing #3045 through the existing activation and unconfiguration state machines.
Changes:
- Records pending certificates before installation using conditional Vault writes.
- Adds inventory-driven cleanup after replacement persistence and verification, deleting abandoned certificates before their keys.
- Expands recovery regression tests and shares certificate decoding across supported encodings.
| File | Description |
|---|---|
src/utils/certHelpers.ts |
Extracts shared PEM and base64 DER certificate decoding. |
src/stateMachines/unconfiguration.ts |
Adds targeted TLS reconciliation and shared deletion helpers. |
src/stateMachines/unconfiguration.test.ts |
Tests interrupted provisioning, protected objects, pagination, and recovery failures. |
src/stateMachines/tlsProvisioningJournal.ts |
Adds durable certificate ownership journal operations. |
src/stateMachines/tls.ts |
Separates certificate preparation, ownership recording, and installation. |
src/stateMachines/tls.test.ts |
Updates tests for the new provisioning states. |
src/stateMachines/activation.ts |
Integrates reconciliation and reports persistence or cleanup failures without deactivation. |
src/stateMachines/activation.test.ts |
Tests reconciliation routing and failure handling. |
src/secrets/vault/index.ts |
Implements conditional journal writes using Vault versions. |
src/secrets/vault/index.test.ts |
Verifies conditional-write request options. |
src/interfaces/ISecretManagerService.ts |
Defines journal data and optional conditional-write support. |
Review effort: Balanced
a704693 to
034663c
Compare
There was a problem hiding this comment.
🟡 Changes recommended
The cleanup inventory can delete certificates and keys still used by wired 802.1X, and retained journals can cause false activation errors after successful non-TLS provisioning.
3 open issues
1 resolved since last review
Review effort: Balanced
7511f90 to
d2ecd4c
Compare
There was a problem hiding this comment.
🟡 Changes recommended
UUID casing mismatches can leave abandoned certificates and keys behind during recovery, and unhandled WS-Man 401 challenges can abort reconciliation despite valid credentials.
2 open issues
3 resolved since last review
Review effort: Balanced


Changes
Interrupted TLS provisioning can install a certificate and key on AMT before RPS saves the issued identity. A later activation can recover successfully while leaving those objects behind. This change records ownership before certificate installation and removes confirmed abandoned objects after the replacement identity is persisted and verified.
unconfiguration.ts, sharing certificate/key deletion helpers with ordinary unconfiguration.TLS/<profile>, including intermediate CAs. Microsoft CA roots need not be installed on AMT. Without a trusted chain, preserve abandoned objects; invalid signatures block cleanup.--tls-tunnelpreserves the pending journal even if its profile has a TLS mode configured and deactivation removed device credentials. TLS flows still require a persisted replacement.Closes #3045.
Validation
npm run test:cion Node 22 and Node 24.22.3. Coverage includes interrupted provisioning/recovery, protected associations and shared keys, pagination, failed/lost deletion responses, persistence failures, Microsoft CA and intermediate chains, invalid signatures, non-TLS activation with a TLS-enabled profile, missing persisted identities on TLS routes, mixed-case UUID recovery, digest challenges during paginated inventory/deletion, bounded authentication failure/recovery, and provider compatibility.git diff --checkpassed.Review notes
This is PR 2 of 2, stacked on #3047: serialize provisioning per device UUID. Review #3047 first; this diff contains only the additional orphan-cleanup changes and capability checks. Coordination is required so cleanup cannot select credentials belonging to another live activation.
Cleanup requires conditional ownership writes and the prerequisite's per-UUID serialization. Providers lacking either capability continue ordinary provisioning and preserve pending objects. Untracked objects and keys created before ownership recording are preserved. Vault requires read/create/update access to
tls-provisioning/<lowercase-uuid>.The PR remains draft for review and hardware testing. Alternate firmware/provisioning routes and interruption between certificate/key deletion remain hardware integration checks. Raw logs and credentials are not included. Nothing has been deployed.
PR Checklist