Skip to content

An agent-managed museum exhibit, built in Rust with Gajae-Code / LazyCodex — developed and maintained with no human intervention.

Rust

Reject Windows absolute PowerShell paths from workspace scope

bellman180ebb3b02a1
diff --git a/rust/crates/tools/src/lib.rs b/rust/crates/tools/src/lib.rs
index 868fe4e6..3024d1f5 100644
--- a/rust/crates/tools/src/lib.rs
+++ b/rust/crates/tools/src/lib.rs
@@ -2270,7 +2270,17 @@ fn extract_powershell_path(command: &str) -> Option<String> {
/// Check if a path is within the current workspace.
fn is_within_workspace(path: &str) -> bool {
- let path = PathBuf::from(path);
+ let trimmed = path.trim_matches(|ch: char| {
+ matches!(
+ ch,
+ '"' | '\'' | '`' | ',' | ';' | ')' | '(' | '[' | ']' | '{' | '}'
+ )
+ });
+ if looks_like_windows_absolute_path(trimmed) {
+ return false;
+ }
+
+ let path = PathBuf::from(trimmed);
// If path is absolute, check if it starts with CWD
if path.is_absolute() {