Compare commits

...

2 Commits

Author SHA1 Message Date
Eva Wong
21fd94d594 Add Windows metadata setup target type 2026-05-04 10:20:50 -07:00
Eva Wong
c4a2a4475e Add Windows metadata adapter target type 2026-05-04 10:20:50 -07:00
3 changed files with 42 additions and 1 deletions

View File

@@ -95,7 +95,8 @@ pub struct ExecParams {
pub arg0: Option<String>,
}
/// Resolved filesystem overrides for the Windows sandbox backends.
/// Layer: Windows adapter layer. Resolved filesystem overrides for the Windows
/// sandbox backends.
///
/// The unelevated restricted-token backend only consumes extra deny-write
/// carveouts on top of the legacy `WorkspaceWrite` allow set. The elevated
@@ -111,6 +112,25 @@ pub(crate) struct WindowsSandboxFilesystemOverrides {
pub(crate) additional_deny_write_paths: Vec<AbsolutePathBuf>,
}
/// Layer: Windows adapter layer. This is the Windows projection of
/// `WritableRoot::protected_metadata_names` from `FileSystemSandboxPolicy`.
#[allow(dead_code)]
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord)]
pub(crate) struct WindowsProtectedMetadataTarget {
pub(crate) path: AbsolutePathBuf,
pub(crate) mode: WindowsProtectedMetadataMode,
}
/// Layer: Windows adapter layer. The enforcement layer needs to know why a
/// protected metadata path is absent instead of treating every missing path as
/// an existing filesystem object.
#[allow(dead_code)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
pub(crate) enum WindowsProtectedMetadataMode {
ExistingDeny,
MissingCreationMonitor,
}
fn windows_sandbox_uses_elevated_backend(
sandbox_level: WindowsSandboxLevel,
proxy_enforced: bool,

View File

@@ -171,6 +171,10 @@ pub use session::spawn_windows_sandbox_session_elevated;
#[cfg(target_os = "windows")]
pub use session::spawn_windows_sandbox_session_legacy;
#[cfg(target_os = "windows")]
pub use setup::ProtectedMetadataMode;
#[cfg(target_os = "windows")]
pub use setup::ProtectedMetadataTarget;
#[cfg(target_os = "windows")]
pub use setup::SETUP_VERSION;
#[cfg(target_os = "windows")]
pub use setup::SandboxSetupRequest;

View File

@@ -99,6 +99,23 @@ pub struct SetupRootOverrides {
pub deny_write_paths: Option<Vec<PathBuf>>,
}
/// Layer: Windows enforcement request boundary. These targets are projected by
/// the adapter layer before they reach the setup helper.
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct ProtectedMetadataTarget {
pub path: PathBuf,
pub mode: ProtectedMetadataMode,
}
/// Layer: Windows enforcement request boundary. The helper must distinguish
/// existing metadata objects from missing names that need create monitoring.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub enum ProtectedMetadataMode {
ExistingDeny,
MissingCreationMonitor,
}
pub fn run_setup_refresh(
policy: &SandboxPolicy,
policy_cwd: &Path,