Repository navigation
Fix Cloud Hypervisor enclave session-log permissions - #11275
Conversation
Co-authored-by: lpcox <[email protected]>
There was a problem hiding this comment.
🟡 Changes recommended
Both diagnostic collectors discard session permission metadata, and append-open failures lose the preflight record, leaving required diagnostic evidence unavailable.
1 open issue
What changed in this PR
This PR addresses shared session-log preflight failures in Cloud Hypervisor agent enclaves by separating trusted transcript writing from unprivileged engine execution.
Changes:
- Move transcripts to root-owned
/session-statestorage with narrowly scoped root-preserving identity translation. - Align preflight and append operations with the trusted writer’s identity while permanently dropping engine privileges.
- Add permission and isolation regressions across Copilot, Codex, and Claude using deterministic engine doubles; live VM/provider behavior remains unverified.
| File | Description |
|---|---|
src/enclave/invocation-staging.ts |
Makes transcript location, ownership, and mode configurable. |
src/enclave/invocation-staging.test.ts |
Checks private transcript staging for all three engines. |
src/cloud-hypervisor/virtiofsd.ts |
Preserves root translation only for the trusted transcript export. |
src/cloud-hypervisor/virtiofsd.test.ts |
Tests exact-source restrictions on root translation. |
src/cloud-hypervisor/trusted-enclave-storage.ts |
Supplies the trusted transcript source to virtiofsd. |
src/cloud-hypervisor/host-enclave-executor.test.ts |
Updates transcript fixtures to use session-state. |
src/cloud-hypervisor/enclave-session-diagnostics.ts |
Reads transcripts from root-owned session-state storage. |
src/cloud-hypervisor/enclave-session-diagnostics.test.ts |
Updates diagnostic fixtures for the new storage path. |
src/cloud-hypervisor/enclave-invocation-staging.ts |
Stages root-owned transcript storage with restrictive permissions. |
guest/microvm-supervisor/session_log_linux_test.go |
Adds staging, launcher, permission, and engine-isolation probes. |
guest/microvm-supervisor/runtime_linux.go |
Reserves supervisor identity for the fixed trusted entrypoint. |
guest/microvm-supervisor/runtime_linux_test.go |
Verifies rejection of arbitrary privileged agent commands. |
guest/microvm-supervisor/resources_linux.go |
Points the transcript compatibility link to /session-state. |
guest/microvm-supervisor/resources_linux_test.go |
Updates the expected transcript link target. |
guest/microvm-supervisor/guest_probe_linux_test.go |
Integrates transcript probes into the guest boundary harness. |
docs/cloud-hypervisor-foundation.md |
Documents trusted-writer identity and transcript protection. |
containers/enclave/agent-entrypoint.py |
Adds identity-scoped transcript access, stricter preflight, and engine privilege dropping. |
Review effort: Max (auto)
| "uid": path_stat.st_uid, | ||
| "gid": path_stat.st_gid, | ||
| "mode": stat.S_IMODE(path_stat.st_mode), | ||
| "writerUid": os.geteuid(), | ||
| "writerGid": os.getegid(), |
|
@copilot address review feedback |
Co-authored-by: lpcox <[email protected]>
Implemented and pushed as |
|
✅ Copilot review passed with no inline comments. @copilot Add the |
Documentation PreviewDocumentation has been built for this PR. To view locally:
Built from commit 5dd98f4 |
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
|
@copilot merge main and resolve conflicts |
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
|
| Metric | Base | PR | Delta |
|---|---|---|---|
| Lines | 93.78% | 93.77% | 📉 -0.01% |
| Statements | 92.32% | 92.30% | 📉 -0.02% |
| Functions | 93.02% | 93.02% | ➡️ +0.00% |
| Branches | 86.58% | 86.57% | 📉 -0.01% |
📁 Per-file Coverage Changes (5 files)
| File | Lines (Before → After) | Statements (Before → After) |
|---|---|---|
src/nvx/one-shot-process.ts |
84.0% → 81.5% (-2.47%) | 76.8% → 74.7% (-2.11%) |
src/commands/main-action.ts |
92.0% → 91.7% (-0.25%) | 91.7% → 91.4% (-0.24%) |
src/enclave/invocation-staging.ts |
97.1% → 97.0% (-0.09%) | 97.3% → 97.2% (-0.07%) |
src/enclave/host-executor-server.ts |
91.2% → 91.2% (+0.00%) | 90.1% → 89.8% (-0.29%) |
src/cloud-hypervisor/virtiofsd.ts |
83.9% → 84.2% (+0.34%) | 82.8% → 83.2% (+0.34%) |
Coverage comparison generated by scripts/ci/compare-coverage.ts
…ession-log-permissions Co-authored-by: lpcox <[email protected]>
Merged |
|
| Metric | Base | PR | Delta |
|---|---|---|---|
| Lines | 93.77% | 93.77% | ➡️ +0.00% |
| Statements | 92.31% | 92.31% | ➡️ +0.00% |
| Functions | 93.02% | 93.00% | 📉 -0.02% |
| Branches | 86.57% | 86.56% | ➡️ -0.01% |
📁 Per-file Coverage Changes (7 files)
| File | Lines (Before → After) | Statements (Before → After) |
|---|---|---|
src/commands/main-action.ts |
92.0% → 91.7% (-0.25%) | 91.7% → 91.4% (-0.24%) |
src/enclave/docker-host-executor.ts |
95.0% → 94.8% (-0.18%) | 89.5% → 89.4% (-0.10%) |
src/enclave/invocation-staging.ts |
97.1% → 97.0% (-0.09%) | 97.3% → 97.2% (-0.07%) |
src/enclave/host-executor-server.ts |
91.2% → 91.2% (+0.00%) | 89.8% → 90.1% (+0.29%) |
src/enclave/public-debug-artifacts.ts |
94.7% → 94.7% (+0.07%) | 93.2% → 93.3% (+0.07%) |
src/enclave/docker-host-recovery.ts |
94.4% → 94.5% (+0.08%) | 88.8% → 89.0% (+0.19%) |
src/cloud-hypervisor/virtiofsd.ts |
83.9% → 84.2% (+0.34%) | 82.8% → 83.2% (+0.34%) |
Coverage comparison generated by scripts/ci/compare-coverage.ts
|
| Metric | Base | PR | Delta |
|---|---|---|---|
| Lines | 93.77% | 93.77% | ➡️ +0.00% |
| Statements | 92.31% | 92.30% | 📉 -0.01% |
| Functions | 93.00% | 93.00% | ➡️ +0.00% |
| Branches | 86.56% | 86.56% | ➡️ +0.00% |
📁 Per-file Coverage Changes (4 files)
| File | Lines (Before → After) | Statements (Before → After) |
|---|---|---|
src/commands/main-action.ts |
92.0% → 91.7% (-0.25%) | 91.7% → 91.4% (-0.24%) |
src/enclave/invocation-staging.ts |
97.1% → 97.0% (-0.09%) | 97.3% → 97.2% (-0.07%) |
src/enclave/host-executor-server.ts |
91.2% → 91.2% (+0.00%) | 90.1% → 89.8% (-0.29%) |
src/cloud-hypervisor/virtiofsd.ts |
83.9% → 84.2% (+0.34%) | 82.8% → 83.2% (+0.34%) |
Coverage comparison generated by scripts/ci/compare-coverage.ts
Preserve main's stderr fallback regressions using the protected transcript path. Co-authored-by: Copilot App <[email protected]>
✅ Coverage Check PassedOverall Coverage
📁 Per-file Coverage Changes (4 files)
Coverage comparison generated by |

Cloud Hypervisor enclaves failed shared session-log preflight before Copilot, Codex, or Claude could launch. The entrypoint’s UID did not match transcript ownership, and virtio-fs squashed guest root into the engine identity.
Separate writer and engine identities
SETUID/SETGIDcapabilities for the fixed trusted entrypoint.65534for ordinary I/O; permanently drop engine children to that identity.Protect transcript storage
/session-stateas root-owned0700, withsession.jsonlmode0600.Align preflight and append
Add boundary regressions