fix(policy): normalize Windows FFI paths
This commit is contained in:
+8
-1
@@ -1563,7 +1563,7 @@ const AUDITED_UNSAFE_SOURCE_FILES: &[&str] = &[
|
|||||||
];
|
];
|
||||||
|
|
||||||
fn is_audited_unsafe_source(path: &Path) -> bool {
|
fn is_audited_unsafe_source(path: &Path) -> bool {
|
||||||
let as_path = path.as_os_str().to_string_lossy();
|
let as_path = path.as_os_str().to_string_lossy().replace('\\', "/");
|
||||||
AUDITED_UNSAFE_SOURCE_FILES
|
AUDITED_UNSAFE_SOURCE_FILES
|
||||||
.iter()
|
.iter()
|
||||||
.any(|candidate| as_path.ends_with(candidate))
|
.any(|candidate| as_path.ends_with(candidate))
|
||||||
@@ -3739,4 +3739,11 @@ source = "git+https://example.invalid/repo"
|
|||||||
)]
|
)]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn audited_unsafe_allowlist_accepts_windows_separators() {
|
||||||
|
let path = Path::new(r".\adapters\fparkan-render-vulkan\src\ffi\runtime.rs");
|
||||||
|
|
||||||
|
assert!(is_audited_unsafe_source(path));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user