Honor unelevated Windows sandbox mode

This commit is contained in:
David Wiesen
2026-05-20 10:02:51 -07:00
parent d4f842f3b3
commit e421970d0a
2 changed files with 6 additions and 7 deletions
+4 -5
View File
@@ -115,12 +115,11 @@ pub(crate) struct WindowsSandboxFilesystemOverrides {
fn windows_sandbox_uses_elevated_backend(
sandbox_level: WindowsSandboxLevel,
proxy_enforced: bool,
_proxy_enforced: bool,
) -> bool {
// Windows firewall enforcement is tied to the logon-user sandbox identities, so
// proxy-enforced sessions must use that backend even when the configured mode is
// the default restricted-token sandbox.
proxy_enforced || matches!(sandbox_level, WindowsSandboxLevel::Elevated)
// Honor the configured Windows sandbox mode instead of silently upgrading
// restricted-token sessions onto the elevated setup path.
matches!(sandbox_level, WindowsSandboxLevel::Elevated)
}
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)]
+2 -2
View File
@@ -409,12 +409,12 @@ fn windows_restricted_token_runs_for_legacy_restricted_policies() {
}
#[test]
fn windows_proxy_enforcement_uses_elevated_backend() {
fn windows_restricted_token_mode_stays_unelevated_when_proxy_is_enforced() {
assert!(!windows_sandbox_uses_elevated_backend(
WindowsSandboxLevel::RestrictedToken,
/*proxy_enforced*/ false,
));
assert!(windows_sandbox_uses_elevated_backend(
assert!(!windows_sandbox_uses_elevated_backend(
WindowsSandboxLevel::RestrictedToken,
/*proxy_enforced*/ true,
));