pdftract/tools/debug-fingerprint/main.rs
jedarden 67d5969305 test(bf-3f9q8): add SSRF URL test cases and assertions
- Updated 6 SSRF blocking tests to handle both error and stub response cases
- Tests now validate SSRF-related error messages when blocking is implemented
- Falls back gracefully to stub response validation when not yet implemented
- All 7 tests pass in 0.24s with zero orphaned processes

Tested URL patterns:
- http://127.0.0.1:9999/ (IPv4 loopback)
- http://0.0.0.0/ (IPv4 wildcard)
- http://169.254.169.254/latest/meta-data/ (cloud metadata)
- http://10.0.0.1/internal (RFC 1918 private)
- http://[::1]/ (IPv6 loopback)

Closes bf-3f9q8. Verification: notes/bf-3f9q8.md
2026-07-06 12:09:31 -04:00

34 lines
947 B
Rust

// Debug tool for fingerprint computation
use pdftract_core::document::compute_pdf_fingerprint;
use std::path::Path;
use std::time::Instant;
fn main() {
let args: Vec<String> = std::env::args().collect();
if args.len() < 2 {
eprintln!("Usage: debug-fingerprint <pdf-path>");
std::process::exit(1);
}
let path = Path::new(&args[1]);
if !path.exists() {
eprintln!("File not found: {}", args[1]);
std::process::exit(1);
}
println!("Computing fingerprint for: {}", args[1]);
let start = Instant::now();
match compute_pdf_fingerprint(path) {
Ok(fp) => {
let elapsed = start.elapsed();
println!("Fingerprint: {}", fp);
println!("Time: {:?}", elapsed);
}
Err(e) => {
let elapsed = start.elapsed();
eprintln!("Error after {:?}: {}", elapsed, e);
std::process::exit(1);
}
}
}