fix(domain): OD-3 value count runs past the depth cap; the rescue-copy guard covers the archive text
Security gate finding (R4.2): prescan stopped counting once the depth exceeded 64, so a 16 MiB rescue copy nested 65 deep passed the value budget with 66 values and built its 792 MiB tree. The count now runs to the end (the depth verdict unchanged, the PDF probe unchanged); the class is in the budget suite (48 MiB, refused) and pinned in cargo.
This commit is contained in:
1 parent
1695fbb408
commit
593893a7c2
4 files changed
+31
-12
No files matched your search
@@ -63,6 +63,16 @@ fn prescan_caps_the_depth_at_64() {
|
||||
assert!(prescan(objects.as_bytes()).within_depth);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn prescan_keeps_counting_values_past_the_depth_cap() {
|
||||
// A text nested past the cap must still report its size: the rescue copy applies the
|
||||
// value budget alone (R4.2 security gate).
|
||||
let deep = format!("{}{}{}", "[".repeat(65), "1,".repeat(1000), "1]".repeat(65));
|
||||
let scan = prescan(deep.as_bytes());
|
||||
assert!(!scan.within_depth);
|
||||
assert_eq!(scan.values, 65 + 1001);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn prescan_skips_strings_and_their_escapes() {
|
||||
let braces = format!("{{\"a\":\"{}\"}}", "{[".repeat(100));
|
||||
|
||||
Reference in new issue
Block a user