fix(tests): R4.9 security gate findings: serve.mjs refuses an empty or unspecified --host (an unset FAUNOSTEO_DEV_HOST bound every interface); report-compare reads at most the 50 MiB cap + 1 byte after its size check; recettes source dev-env.sh first
This commit is contained in:
1 parent
24e05cecd5
commit
80cc261c24
4 files changed
+18
-4
No files matched your search
@@ -11,7 +11,7 @@
|
||||
#![allow(clippy::disallowed_methods)]
|
||||
|
||||
use std::collections::HashMap;
|
||||
use std::io::{self, ErrorKind, Write};
|
||||
use std::io::{self, ErrorKind, Read, Write};
|
||||
use std::path::{Path, PathBuf};
|
||||
use std::{env, fs, process};
|
||||
|
||||
@@ -125,7 +125,15 @@ impl Files for Disk {
|
||||
if meta.len() > MAX_PDF_BYTES as u64 {
|
||||
return Err(FileFailure::TooLarge);
|
||||
}
|
||||
fs::read(path).map_err(|e| failure_of(&e))
|
||||
// Bounded read: a file that grew after the size check is still refused.
|
||||
let mut bytes = Vec::new();
|
||||
fs::File::open(path)
|
||||
.and_then(|f| f.take(MAX_PDF_BYTES as u64 + 1).read_to_end(&mut bytes))
|
||||
.map_err(|e| failure_of(&e))?;
|
||||
if bytes.len() > MAX_PDF_BYTES {
|
||||
return Err(FileFailure::TooLarge);
|
||||
}
|
||||
Ok(bytes)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user