Commit Graph
1 Commits
Author SHA1 Message Date
claw_01a00bbbbabc70138aad0b103d15146a 339a5bd06a SECURITY: Add overflow, decompression bomb, and path traversal validation
Implements three critical security hardening items:

INT-08: Input Validation in Writer Path (Shape Overflow)
- Validates total element count <= i64::MAX in dataset shape
- Uses checked_mul to detect u64 overflow during dimension multiplication
- Prevents integer overflow attacks from crafted shape arrays
- Tests: shape overflow detection, i64 ceiling check, valid shapes, empty datasets

INT-07: Buffer Overflow Prevention in Chunk Decompression
- Defines MAX_DECOMPRESS_SIZE constant (256 MiB)
- Validates chunk_size upfront before decompression
- Prevents decompression bombs from malformed/hostile HDF5 files
- Applies bounds check to all codecs: deflate, lz4, zstd, pcodec, nbit, scaleoffset, szip

INT-06: Path Traversal Prevention in Virtual Datasets
- Adds validate_vds_file_name() function to parse_vds_mappings
- Rejects absolute filesystem paths (starting with /)
- Rejects directory traversal sequences (..)
- Allows relative paths and same-file markers (.)

All implementations follow defense-in-depth: entry-point validation + per-codec checks.
No regressions: 1,400+ tests passing (542 in clawhdf5-format alone).

Reviewed and approved by security team.
2026-08-16 18:21:06 +00:00