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): B78 - a one-character vocabulary entry is a wildcard, and the row's floor was too high
CarterPerez-devc03f6b0894cf
diff --git a/PROJECTS/advanced/zero-day-vulnerability-scanner/crates/lisdex-harness/src/synth.rs b/PROJECTS/advanced/zero-day-vulnerability-scanner/crates/lisdex-harness/src/synth.rsindex 930f075e..7c06543a 100644--- a/PROJECTS/advanced/zero-day-vulnerability-scanner/crates/lisdex-harness/src/synth.rs+++ b/PROJECTS/advanced/zero-day-vulnerability-scanner/crates/lisdex-harness/src/synth.rs@@ -4200,6 +4200,28 @@ mod tests {assert!(!is_extent_name("color_type"));}+ #[test]+ fn a_word_ending_in_n_is_not_an_extent_because_n_is_a_vocabulary_entry() {+ for name in [+ "align",+ "distortion",+ "pattern",+ "column",+ "origin",+ "version",+ ] {+ assert!(+ !is_extent_name(name),+ "{name} is not an extent; it merely ends in the one-character entry n"+ );+ }+ assert!(is_extent_name("n"), "n itself is still an extent name");+ assert!(+ is_extent_name("inlen") && is_extent_name("keylen") && is_extent_name("isize"),+ "the suffix arm still carries the glued lowercase extents it was added for"+ );+ }+#[test]fn a_config_that_is_not_an_extent_still_binds() {let expat = candidate(diff --git a/PROJECTS/advanced/zero-day-vulnerability-scanner/crates/lisdex-surface/src/extract.rs b/PROJECTS/advanced/zero-day-vulnerability-scanner/crates/lisdex-surface/src/extract.rsindex 91b1b2bd..a6b7ce71 100644--- a/PROJECTS/advanced/zero-day-vulnerability-scanner/crates/lisdex-surface/src/extract.rs+++ b/PROJECTS/advanced/zero-day-vulnerability-scanner/crates/lisdex-surface/src/extract.rs@@ -24,6 +24,7 @@ impl Drop for ReentryGuard {}pub const MIN_PROJECT_STEM: usize = 3;+pub const MIN_SUFFIX_ENTRY: usize = 2;pub const C_ARGS: [&str; 3] = ["-x", "c", "-std=c11"];pub const CPP_ARGS: [&str; 3] = ["-x", "c++", "-std=c++17"];pub const TEARDOWN_VERBS: [&str; 15] = [@@ -414,9 +415,11 @@ pub fn carries_word(name: &str, vocabulary: &[&str]) -> bool {// read as one word. Fall back to a suffix match, which is where the verb or the// extent lands in every case measured.match words.as_slice() {- [only] => vocabulary- .iter()- .any(|entry| only.len() > entry.len() && only.to_lowercase().ends_with(entry)),+ [only] => vocabulary.iter().any(|entry| {+ entry.len() >= MIN_SUFFIX_ENTRY+ && only.len() > entry.len()+ && only.to_lowercase().ends_with(entry)+ }),_ => false,}}@@ -932,6 +935,40 @@ void WebPFreeDecBuffer(WebPDecBuffer *buffer);assert!(carries_word("uncompress2", &READ_WORDS));}+ #[test]+ fn a_one_character_entry_is_a_wildcard_on_the_suffix_arm_and_never_matches_there() {+ let vocabulary = ["n", "len"];+ for name in ["align", "token", "column", "pattern", "origin", "main"] {+ assert!(+ !carries_word(name, &vocabulary),+ "{name} ends in n and would match a single-character entry as a suffix"+ );+ }+ }++ #[test]+ fn the_floor_applies_to_the_suffix_arm_alone_and_not_to_token_equality() {+ let vocabulary = ["n", "len"];+ assert!(+ carries_word("n", &vocabulary),+ "a parameter literally named n is an extent by token equality"+ );+ assert!(+ carries_word("num_n", &vocabulary),+ "n as a whole word must still match once there is a boundary to split on"+ );+ }++ #[test]+ fn a_two_character_entry_still_matches_as_a_suffix() {+ let vocabulary = ["sz", "len"];+ assert!(carries_word("bufsz", &vocabulary));+ assert!(+ carries_word("inlen", &vocabulary),+ "the suffix arm is load-bearing for all-lowercase extents and must survive the floor"+ );+ }+// The isolating control for stripping per WORD rather than per name: the ladder's old// local workaround trimmed the whole identifier, which cannot reach a digit that is not// the last character. Both must pass, and only the per-word rule satisfies the second.