Repository navigation
Conversation
Backport of NVIDIA#5234 to windows. The gateway accepts live policy updates that only add filesystem paths, and the supervisor reported such a revision as loaded after reloading the network policy alone. Filesystem grants are applied when the sandbox starts (the MXC driver maps them into the container at create), so the running workload never received the added paths. Compare each reload with the filesystem grants applied at startup and reject a changed revision before replacing the running policy. The rejection uses the existing policy validation failure handling, so the revision is reported as failed and the configured failure mode applies. Network-only reloads and reordered paths still load. Closes NVIDIA#5326 Signed-off-by: Rahool Paliwal <rpaliwal@nvidia.com>
This branch has not been deployed
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
Backport of #5234 to
windows. A live policy update that adds a filesystem path is accepted by the gateway, reported as loaded by the supervisor, and shown as effective, but the running workload never receives the new path. On Windows the MXC driver maps filesystem grants into the container only when the sandbox is created. After this change the supervisor compares the candidate's filesystem section with the one applied at startup and rejects a changed revision as failed, with "filesystem policy cannot be changed on a running sandbox; recreate the sandbox to apply filesystem changes".Related Issue
Closes #5326
The
windowscounterpart of #5041, which #5234 closes onmain.Changes
openshell-supervisor(lib.rs): addvalidate_live_filesystem_policy, the same check as fix(supervisor): reject live filesystem policy changes that cannot take effect #5234'sConfigRuntime::validate_live_filesystem_policy, except that it returnsErr(miette::miette!(..))like the other validators in this crate instead ofmiette::bail!. It comparesinclude_workdirand theread_only/read_writepaths as sets, so reordered paths still load. The poll loop runs it beforereload_gateway_configuration_runtimeand reports a mismatch asGatewayRuntimeReloadError::PolicyValidation. Rejection then follows the existing validation-failure handling: the revision is reported failed, and the configuredpolicy_validation_failure_mode(defaultfail_closed) applies.windowsthe poll loop still lives inlib.rs(there is noconfig_runtime.rs), so the check is a free function that takes the applied policy (current_endpoint_policy) instead of a method.run_policy_poll_loop_with_clientbecausewindowshas noConfigRuntime):live_filesystem_changes_reject_polled_policy_without_advancing_active_revision: sandbox and global sources × added read-only path, added read-write path, and a filesystem section added where there was none; checks the failed status report, fail-closed versus retained policy, and the OPA generation.live_filesystem_change_poll_reports_failure_then_accepts_network_only_repair: a rejected revision followed by a network-only revision with reordered paths loads. Unlike themaintest, it sets the transparent TCP state as ready, because thewindowsreload path still checks it for the TCP fixture.poll_rejects_first_tcp_expansion_and_reports_previous_policy_active: its second revision now keeps the first revision's filesystem section and changes only the network rules. It was built from a TCP-only policy with no filesystem section, so the new check rejected it before the TCP check ran. The gateway already refuses a sandbox policy update that drops the filesystem section.mainno longer has the transparent TCP check, so fix(supervisor): reject live filesystem policy changes that cannot take effect #5234 did not need this.docs/how-it-works/policies/manage-policies.mdx, same text as fix(supervisor): reject live filesystem policy changes that cannot take effect #5234.Testing
cargo test -p openshell-supervisor --libpasses 158/158;cargo fmt --all --checkis clean;cargo clippy -p openshell-supervisor --all-targets --no-deps -- -D warningsis clean. With the new check disabled, both new tests fail.cargo test -p openshell-supervisor --libpasses 155/155.cargo clippy -p openshell-supervisor --all-targets --no-deps -- -D warningsis clean.mise run windows:build:x64succeeds.wxc-exec --probereportsbaseContainerApiPresent: true), with a sandbox created withread_write: [A]whose workload keeps writing to A and tries to write to B:policy set --waitadding B printed "Policy version 2 loaded (active version: 2)" and exited 0;policy listshowed version 2 as Loaded. 25 s later the workload was still running and still could not write to B.policy listshows version 2 as Failed with that error. The supervisor logs the fail-closed transition (defaultfail_closed). A following network-only update with the filesystem section unchanged loads as version 3. Removing a path is still rejected by the gateway, and a new sandbox created with A and B can write to B.Not tested: ARM64, the MXC end-to-end scenarios, and the full workspace test suite. Running
cargo clippy -p openshell-supervisor --all-targets -- -D warningswithout--no-depson Windows stops inopenshell-extension-core(transport.rs:185, unusedasync), which this change does not touch.Note for review: after a rejected revision,
sandbox getlists the stored candidate policy (including the added path) together withConfigurationInvalid, whilepolicy getshows the active policy. This is existing gateway behaviour and is unchanged here.Checklist