Skip to content

Commit 0c46a6f

Browse files
committed
Notification improvements
1 parent 480cbc8 commit 0c46a6f

File tree

3 files changed

+22
-6
lines changed

3 files changed

+22
-6
lines changed

crates/cbom-generator/src/certificate_parser.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,9 @@ impl CertificateParser {
4040
];
4141

4242
// Walk through the directory looking for certificate files
43+
// Limit depth to avoid scanning too deep in large repos
4344
for entry in WalkDir::new(scan_path)
45+
.max_depth(10) // Limit depth to avoid excessive scanning
4446
.into_iter()
4547
.filter_map(|e| e.ok())
4648
.filter(|e| e.file_type().is_file())

crates/cbom-generator/src/lib.rs

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -200,9 +200,14 @@ impl CbomGenerator {
200200

201201
/// Generate an MV-CBOM for the given directory (single project)
202202
pub fn generate_cbom(&self, scan_path: &Path, findings: &[Finding]) -> Result<MvCbom> {
203-
let scan_path = scan_path
204-
.canonicalize()
205-
.with_context(|| format!("Failed to canonicalize path: {}", scan_path.display()))?;
203+
// Skip canonicalization if the path doesn't exist or is too large
204+
let scan_path = if scan_path.exists() {
205+
scan_path
206+
.canonicalize()
207+
.unwrap_or_else(|_| scan_path.to_path_buf())
208+
} else {
209+
scan_path.to_path_buf()
210+
};
206211

207212
// Project parsing removed; no component information included
208213

@@ -255,9 +260,14 @@ impl CbomGenerator {
255260
scan_path: &Path,
256261
findings: &[Finding],
257262
) -> Result<Vec<(PathBuf, MvCbom)>> {
258-
let scan_path = scan_path
259-
.canonicalize()
260-
.with_context(|| format!("Failed to canonicalize path: {}", scan_path.display()))?;
263+
// Skip canonicalization if the path doesn't exist or is too large
264+
let scan_path = if scan_path.exists() {
265+
scan_path
266+
.canonicalize()
267+
.unwrap_or_else(|_| scan_path.to_path_buf())
268+
} else {
269+
scan_path.to_path_buf()
270+
};
261271

262272
// Project discovery removed; just generate one CBOM for the root
263273
let cboms = vec![(scan_path.clone(), self.generate_cbom(&scan_path, findings)?)];

crates/cli/src/main.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,10 @@ fn main() -> Result<()> {
187187
let default_path = PathBuf::from(".");
188188
let scan_path = args.paths.first().unwrap_or(&default_path);
189189

190+
if args.progress {
191+
eprintln!("Generating CBOM for {} findings...", findings.len());
192+
}
193+
190194
if args.recursive {
191195
// Simplified: generate a single CBOM for the root
192196
match cbom_generator.generate_cboms_recursive(scan_path, &findings) {

0 commit comments

Comments
 (0)