Add executor-context filesystem permission helpers (#43939)

## Why

Filesystem policies for remote execution need to interpret paths, home directories, and temporary directories using the execution host's context.

## What changed

- Add context-based read-denial matching, read-access checks, glob resolution, and `PathUri` workspace-write constructors without consulting local paths or environment variables.
- Share managed read-denial validation through `DenyReadValidator` and use it in core configuration, preserving required-entry checks, concrete grant validation, and constraint diagnostics.
- Reject invalid or unresolvable denial paths when constructing a context-based matcher, and apply `/tmp` denials according to the execution host's path convention.
- Preserve workspace-root symbols and protected metadata entries when materializing URI-based writable roots.

## Testing

Add regression tests for POSIX, Windows, and UNC path matching; conflicting read and write grants; malformed or unresolvable denials; `/tmp` handling; and workspace metadata protection.

GitOrigin-RevId: aa2b174288d1172ab52ff485f58d306236d27652
This commit is contained in:
Sean Huang
2026-09-08 22:52:05 +00:00
committed by copyberry
parent 1032738aa0
commit c53f342fec
7 changed files with 596 additions and 35 deletions
+18
View File
@@ -550,6 +550,24 @@ impl PermissionProfile {
}
}
/// Legacy workspace-write settings interpreted for executor-owned paths.
pub fn workspace_write_with_path_uris(
writable_roots: &[PathUri],
network: NetworkSandboxPolicy,
exclude_tmpdir_env_var: bool,
exclude_slash_tmp: bool,
) -> Self {
let file_system = FileSystemSandboxPolicy::workspace_write_with_path_uris(
writable_roots,
exclude_tmpdir_env_var,
exclude_slash_tmp,
);
Self::Managed {
file_system: ManagedFileSystemPermissions::from_sandbox_policy(&file_system),
network,
}
}
pub fn materialize_project_roots_with_workspace_roots(
self,
workspace_roots: &[AbsolutePathBuf],