Building 70 Projects ranging from beginner to advanced so anyone can β learn from, build upon, use as a reference, or even copy directly. Owned by my cybersecurity company π
Go aicertificationcloud-engineeringcybercybersecuritycybersecurity-analystcybersecurity-certificationcybersecurity-certificationscybersecurity-educationcybersecurity-jobscybersecurity-portfoliocybersecurity-projectscybersecurity-toolsgrchackinglearningpentestingproject-repositoryprojetcspython
feat(lisdex): B32 - the test half fixed structurally, and both of the row's prescribed fixes measured lethal
CarterPerez-devb3ae5f262764
diff --git a/PROJECTS/advanced/zero-day-vulnerability-scanner/crates/lisdex-surface/src/headers.rs b/PROJECTS/advanced/zero-day-vulnerability-scanner/crates/lisdex-surface/src/headers.rsindex 74b562ac..6159eb7d 100644--- a/PROJECTS/advanced/zero-day-vulnerability-scanner/crates/lisdex-surface/src/headers.rs+++ b/PROJECTS/advanced/zero-day-vulnerability-scanner/crates/lisdex-surface/src/headers.rs@@ -10,10 +10,15 @@ pub const INCLUDE_DIR: &str = "include";pub const MAX_DEPTH: usize = 12;pub const NESTED_INCLUDE_DEPTH: usize = 3;+// A directory whose name begins with this is a test directory, and naming the variants+// one at a time missed libarchive's `test_utils`, whose header declared four helpers that+// ranked as library entry points. Censused across the six validation trees: `test`, `tests`,+// `testing`, `test_utils`, `testpngs`, `testdata`, `test_cmake`, `test_cmake_no_target` -+// every match is genuinely a test directory, no false positives. This can never exclude the+// tree the user points at, because the walk only ever tests the names of CHILD directories.+pub const TEST_DIR_PREFIX: &str = "test";+pub const EXCLUDED_DIRS: &[&str] = &[- "test",- "tests",- "testing","contrib","example","examples",@@ -97,7 +102,8 @@ pub fn is_header(path: &Path) -> bool {#[must_use]pub fn is_excluded(name: &str) -> bool {- EXCLUDED_DIRS.contains(&name.to_lowercase().as_str())+ let lowered = name.to_lowercase();+ lowered.starts_with(TEST_DIR_PREFIX) || EXCLUDED_DIRS.contains(&lowered.as_str())}#[must_use]@@ -649,13 +655,38 @@ mod tests {&["include/archive.h","include/tests/helper.h",+ "include/test_utils/test_utils.h","include/contrib/oss-fuzz/harness.h","include/examples/demo.h","include/fuzz/driver.h",],);let set = discover(&root, None).unwrap();- assert_eq!(names(&set), vec!["archive.h"]);+ assert_eq!(+ names(&set),+ vec!["archive.h"],+ "libarchive's test_utils declared four helpers that ranked as library entry \+ points, because the exclusion list named test directories one variant at a time"+ );+ }++ #[test]+ fn a_directory_named_for_tests_is_excluded_however_it_is_spelled() {+ for name in ["test", "tests", "testing", "test_utils", "testdata"] {+ assert!(is_excluded(name), "{name}");+ }+ }++ #[test]+ fn the_tree_the_user_points_at_is_never_excluded_by_its_own_name() {+ let root = fixture("testu01", &["include/unif01.h", "src/unif01.c"]);+ let set = discover(&root, None).unwrap();+ assert_eq!(+ names(&set),+ vec!["unif01.h"],+ "the walk only ever judges the names of child directories, so a library whose \+ own name begins with test still analyses"+ );}#[test]