preparing for v1.48.0

This commit is contained in:
Mick Grove 2025-09-05 09:31:52 -07:00
commit ba12a5b2be
6 changed files with 15 additions and 29 deletions

View file

@ -161,10 +161,7 @@ fn handle_zip_archive_streaming(
Ok(CompressedContent::ArchiveFiles(entries_on_disk))
}
fn handle_asar_archive_in_memory(
buffer: &[u8],
archive_path: &Path,
) -> Result<CompressedContent> {
fn handle_asar_archive_in_memory(buffer: &[u8], archive_path: &Path) -> Result<CompressedContent> {
match AsarReader::new(buffer, None) {
Ok(reader) => {
let mut contents = Vec::new();
@ -525,4 +522,4 @@ mod tests {
Ok(())
}
}
}

View file

@ -35,7 +35,7 @@ mod tests {
use crate::cli::commands::github::GitHistoryMode;
use crate::cli::commands::rules::RuleSpecifierArgs;
use crate::matcher::{SerializableCapture, SerializableCaptures};
use crate::rules::rule::{Rule, RuleSyntax, Confidence};
use crate::rules::rule::{Confidence, Rule, RuleSyntax};
use crate::util::intern;
use crate::{
blob::BlobId,
@ -50,12 +50,12 @@ mod tests {
origin::Origin,
reporter::styles::Styles,
};
use smallvec::smallvec;
use std::{
io::Cursor,
path::PathBuf,
sync::{Arc, Mutex},
};
use smallvec::smallvec;
use url::Url;
fn create_default_args() -> cli::commands::scan::ScanArgs {
use crate::cli::commands::gitlab::GitLabRepoType; // bring enum into scope
@ -243,8 +243,7 @@ mod tests {
fn test_validation_status_in_json() -> Result<()> {
let test_cases = vec![(true, "Active Credential"), (false, "Inactive Credential")];
for (validation_success, expected_status) in test_cases {
let mock_match =
create_mock_match("MockRule", "mock_rule_1", validation_success);
let mock_match = create_mock_match("MockRule", "mock_rule_1", validation_success);
let matches = vec![ReportMatch {
origin: OriginSet::new(
Origin::from_file(PathBuf::from("/mock/path/file.rs")),

View file

@ -282,4 +282,4 @@ mod tests {
fn docker_struct_new() {
let _ = Docker::new();
}
}
}

View file

@ -53,10 +53,7 @@ pub async fn run_secret_validation(
let mut simple_matches = Vec::new();
let mut dependent_blobs = FxHashMap::default(); // blob_id -- Vec<Arc<…>>
for (blob_id, matches) in all_matches_by_blob {
if matches
.iter()
.any(|m| !m.2.rule.syntax().depends_on_rule.is_empty())
{
if matches.iter().any(|m| !m.2.rule.syntax().depends_on_rule.is_empty()) {
dependent_blobs.insert(blob_id, matches);
} else {
simple_matches.extend(matches);
@ -77,10 +74,7 @@ pub async fn run_secret_validation(
.get(1)
.or_else(|| arc_msg.2.groups.captures.get(0))
.map_or("", |c| c.value);
groups
.entry(format!("{}|{}", arc_msg.2.rule.id(), secret))
.or_default()
.push(arc_msg);
groups.entry(format!("{}|{}", arc_msg.2.rule.id(), secret)).or_default().push(arc_msg);
}
let validation_results = DashMap::<String, CachedResponse>::new();
@ -133,8 +127,10 @@ pub async fn run_secret_validation(
}
}
let mut om =
OwnedBlobMatch::convert_match_to_owned_blobmatch(&rep_arc.2, rep_arc.2.rule.clone());
let mut om = OwnedBlobMatch::convert_match_to_owned_blobmatch(
&rep_arc.2,
rep_arc.2.rule.clone(),
);
validate_single(
&mut om,

View file

@ -75,8 +75,8 @@ pub async fn check_url_resolvable(url: &Url) -> Result<(), Box<dyn std::error::E
mod tests {
use super::*;
use crate::matcher::{SerializableCapture, SerializableCaptures};
use smallvec::smallvec;
use pretty_assertions::assert_eq;
use smallvec::smallvec;
#[test]
fn single_unnamed_capture_is_returned() {
@ -135,13 +135,7 @@ mod tests {
end: 2,
value: "aa",
},
SerializableCapture {
name: None,
match_number: 1,
start: 4,
end: 6,
value: "cc",
},
SerializableCapture { name: None, match_number: 1, start: 4, end: 6, value: "cc" },
],
};
let result = process_captures(&captures);

View file

@ -6,7 +6,6 @@ use std::{
use anyhow::Result;
use gix::{date, ObjectId};
use smallvec::smallvec;
use kingfisher::{
blob::{BlobId, BlobMetadata},
findings_store::FindingsStore,
@ -18,6 +17,7 @@ use kingfisher::{
rules::rule::{Confidence, Rule, RuleSyntax},
util::intern,
};
use smallvec::smallvec;
// ---- helpers -------------------------------------------------------------------------------
fn make_match(fp: u64) -> Match {