pub mod builder;
pub mod cli;
pub mod error;
pub mod har_reader;
pub mod mitmproxy_reader;
pub mod output;
pub mod params;
pub mod path_matching;
pub mod schema;
pub mod tnetstring;
pub mod types;
pub const MAX_INPUT_SIZE: u64 = 2 * 1024 * 1024 * 1024;
pub const MAX_PAYLOAD_SIZE: usize = 256 * 1024 * 1024;
pub const MAX_DEPTH: usize = 256;
pub const MAX_SCHEMA_DEPTH: usize = 64;
pub const MAX_BODY_SIZE: usize = 64 * 1024 * 1024;
pub fn validate_input_path(
path: &std::path::Path,
max_size: u64,
allow_symlinks: bool,
) -> Result<(), error::Error> {
if !allow_symlinks && path.symlink_metadata()?.file_type().is_symlink() {
return Err(error::Error::SymlinkRejected {
path: path.to_path_buf(),
});
}
let meta = std::fs::metadata(path)?;
if !meta.is_file() {
return Err(error::Error::NotRegularFile {
path: path.to_path_buf(),
});
}
if meta.len() > max_size {
return Err(error::Error::InputTooLarge {
size: meta.len(),
max: max_size,
});
}
Ok(())
}