mirror of
https://github.com/pbakaus/impeccable.git
synced 2026-09-12 22:26:38 +03:00
Fix Windows CSP candidate path normalization
Normalize native relative paths before slash-based CSP classification and signal output. Preserve literal Unix backslashes. AI assistance: Codex, under maintainer direction.
This commit is contained in:
@@ -167,7 +167,11 @@ fn walk(root: &str, dir: &str, depth: usize, hits: &mut Hits) {
|
||||
let Ok(bytes) = std::fs::read(&abs) else { continue };
|
||||
let slice = if bytes.len() > MAX_READ_BYTES { &bytes[..MAX_READ_BYTES] } else { &bytes[..] };
|
||||
let body = String::from_utf8_lossy(slice);
|
||||
visit(root, &abs, &jsp::relative("/", root, &abs), &body, hits);
|
||||
// Candidate patterns use '/', while native Windows relative paths
|
||||
// use '\\'. Normalize once for classification and portable signals;
|
||||
// to_posix preserves literal backslashes in Unix filenames.
|
||||
let rel = jsp::to_posix(&jsp::relative("/", root, &abs));
|
||||
visit(root, &abs, &rel, &body, hits);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user