.ai-rulez/skills/security-limits-dos-protection/SKILL.md
security limits dos protection
npx skillsauth add kreuzberg-dev/kreuzberg .ai-rulez/skills/security-limits-dos-protectionInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Defense-in-depth DoS protection via SecurityLimits and validator helpers in crates/kreuzberg/src/extractors/security.rs. All archive and complex format extractors MUST use these.
| Field | Default | Purpose |
|-------|---------|---------|
| max_archive_size | 500 MB | Uncompressed archive size limit |
| max_compression_ratio | 100:1 | Zip bomb detection threshold |
| max_files_in_archive | 10,000 | Archive file count limit |
| max_nesting_depth | 100 | Structure nesting limit |
| max_entity_length | 32 | XML entity length limit |
| max_content_size | 100 MB | String growth per document |
| max_iterations | 10M | Loop iteration limit |
| max_xml_depth | 100 | XML nesting depth |
| max_table_cells | 100K | Table cell count limit |
Access via config.security_limits.clone().unwrap_or_default().
let limits = config.security_limits.clone().unwrap_or_default();
let validator = ZipBombValidator::new(limits);
validator.validate(&mut archive)?; // Checks ratio, size, file count
let mut validator = StringGrowthValidator::new(limits.max_content_size);
validator.check_append(text.len())?; // Call before each append
content.push_str(&text);
let mut depth = DepthValidator::new(limits.max_nesting_depth);
depth.push()?; // Entering nested structure
// ... process ...
depth.pop(); // Exiting
let mut iter = IterationValidator::new(limits.max_iterations);
for item in collection {
iter.check_iteration()?;
}
let mut validator = TableValidator::new(limits.max_table_cells);
validator.add_cells(rows * cols)?;
| Format Family | Required Validators |
|--------------|-------------------|
| Archives (ZIP/TAR/7z/GZIP) | ZipBombValidator before extraction |
| Office XML (DOCX/PPTX/ODT) | DepthValidator + StringGrowthValidator |
| XML/HTML | DepthValidator + StringGrowthValidator |
| Spreadsheets (XLSX/ODS) | TableValidator + StringGrowthValidator |
| Any loop-heavy processing | IterationValidator |
config.security_limits is NoneKreuzbergError::validation(msg)tools
Extract text, tables, metadata, and images from 91+ document formats (PDF, Office, images, HTML, email, archives, academic) using Kreuzberg. Use when writing code that calls Kreuzberg APIs in Python, Node.js/TypeScript, Rust, or CLI. Covers installation, extraction (sync/async), configuration (OCR, chunking, output format), batch processing, error handling, and plugins.
testing
test execution patterns
development
ocr uackend management
data-ai
mime detection routing