-
Notifications
You must be signed in to change notification settings - Fork 9
Closed
Labels
testingTest coverage and qualityTest coverage and quality
Description
Category
Test Quality / Security
Severity
Critical
Location
crates/agnix-core/src/parsers/markdown.rs:18-95
Description
The MAX_REGEX_INPUT_SIZE constant (64KB) protects against ReDoS attacks, but boundary conditions are not adequately tested:
- Content at exactly 65,536 bytes (should be accepted)
- Content at 65,537 bytes (should be rejected)
- Pathological patterns near the limit (nested XML tags at boundary)
extract_importsis NOT subject to the limit but no test verifies it handles >64KB
Current test only checks MAX_REGEX_INPUT_SIZE + 1000, not the exact boundary.
Suggested Tests
#[test]
fn test_extract_xml_tags_exactly_at_64kb_limit() {
let content = format!("<tag>{}</tag>", "x".repeat(MAX_REGEX_INPUT_SIZE - 12));
assert_eq!(content.len(), MAX_REGEX_INPUT_SIZE);
let tags = extract_xml_tags(&content);
assert!(!tags.is_empty()); // Should process
}
#[test]
fn test_extract_xml_tags_one_byte_over_limit() {
let content = "x".repeat(MAX_REGEX_INPUT_SIZE + 1);
let tags = extract_xml_tags(&content);
assert!(tags.is_empty()); // Should skip
}Effort
Small
Found by /audit-project multi-agent review
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
testingTest coverage and qualityTest coverage and quality