Resolve permission profiles with explicit execution-host path context (#44676)

## Why

Permission paths need to follow the execution host's path conventions and home directory. Literal directory names containing glob syntax must not change the meaning of deny patterns, and profile availability checks need to account for configured workspace roots.

## What changed

- Use `ConfigPathContext` to compile built-in and custom profiles, returning the resolved profile and deduplicated `PathUri` workspace roots. Materialize configured roots while retaining runtime workspace symbols.
- Use the same compiler for configuration loading, persisted profile validation, and profile catalogs. Resolve roots against the requested `cwd` when listing profiles.
- Resolve home-relative scoped rules using the supplied home directory and reject unsafe directory prefixes when constructing globs.
- Share workspace-root materialization across native paths and URIs. Deny the affected root when a workspace glob cannot be safely resolved, and clear grants for legacy home-relative workspace denials whose target is unknown.

## Testing

Add coverage for POSIX, Windows, and UNC path resolution, inherited workspace roots, scoped home denials, missing home context, and conservative denial behavior for unsafe globs. Add an app-server test verifying that profile availability reflects the requested `cwd`.

GitOrigin-RevId: ca259434742365c16d0b72629cabfbab41513a80
This commit is contained in:
Sean Huang authored and copyberry committed 2026-09-11 00:03:40 +00:00
1 parent 935ac7710d
commit 9e22e74e8d
17 files changed
+1453 -428

No files matched your search

+7 -4
View File
@@ -47,12 +47,15 @@ impl FileSystemSandboxPolicy {
}
/// Preserves workspace-root symbols and adds their executor-owned concrete paths.
/// Legacy home-relative workspace denials clear all grants when their target is unknown.
pub fn with_materialized_project_roots_for_path_uris(mut self, roots: &[PathUri]) -> Self {
for entry in self
let Some(materialized) = self
.clone()
.materialize_project_roots_with_path_uris(roots)
.entries
{
.try_materialize_project_roots_with_path_uris(roots)
else {
return Self::restricted(Vec::new());
};
for entry in materialized.entries {
if !self.entries.contains(&entry) {
self.entries.push(entry);
}