MAX_SECRET_FILE_BYTES

Constant MAX_SECRET_FILE_BYTES 

Source
pub const MAX_SECRET_FILE_BYTES: usize = _; // 1_048_576usize
Expand description

Upper bound on one secret file’s size (DW-045, #46): secret files hold short key material, and the read must never be a memory-exhaustion vector — ${file:/dev/zero} reads NUL bytes forever (NULs are valid UTF-8), so an unbounded read runs until the allocator gives up and takes the process with it, on every reload. Bounded reads have precedent: the SNI ClientHello reassembler caps at 64 KiB (MAX_HELLO_BYTES in the security/TLS domain). At or under the cap the file is read whole; anything larger fails closed naming the path and the limit. The bound is enforced BOTH on the file’s metadata up front and on the bytes actually read (Read::take), so a file that grows between the two checks — or a non-regular file whose metadata size is 0, like /dev/zero — is still capped.