- 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
37 lines
988 B
Rust
37 lines
988 B
Rust
use indexmap::IndexMap;
|
|
use pdftract_core::parser::object::{PdfDict, PdfObject};
|
|
#[allow(unused_imports)]
|
|
use pdftract_core::parser::stream::{LZWDecoder, StreamDecoder};
|
|
use std::sync::Arc;
|
|
|
|
#[test]
|
|
fn test_lzw_debug() {
|
|
// Test with lzw_early_change_0.bin data
|
|
// 08 80 48 65 6c 6c 6f 57 6f 72 6c 64
|
|
let input = vec![
|
|
0x08, 0x80, 0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x57, 0x6f, 0x72, 0x6c, 0x64,
|
|
];
|
|
|
|
let mut params = IndexMap::new();
|
|
params.insert(Arc::from("/EarlyChange"), PdfObject::Integer(0));
|
|
|
|
let mut counter = 0;
|
|
let decoder = LZWDecoder;
|
|
let result = decoder.decode(
|
|
&input,
|
|
Some(&PdfObject::Dict(Box::new(params))),
|
|
&mut counter,
|
|
u64::MAX,
|
|
);
|
|
|
|
match result {
|
|
Ok(data) => {
|
|
println!(
|
|
"Decoded {} bytes: {:?}",
|
|
data.len(),
|
|
String::from_utf8_lossy(&data)
|
|
);
|
|
}
|
|
Err(e) => println!("Error: {:?}", e),
|
|
}
|
|
}
|