Skip to content

Fix critical/high security vulnerabilities + comprehensive test coverage#12

Merged
pmclSF merged 2 commits intomainfrom
security/fix-critical-vulnerabilities
Feb 16, 2026
Merged

Fix critical/high security vulnerabilities + comprehensive test coverage#12
pmclSF merged 2 commits intomainfrom
security/fix-critical-vulnerabilities

Conversation

@pmclSF
Copy link
Owner

@pmclSF pmclSF commented Feb 16, 2026

Summary

  • Eliminate numpy.load(allow_pickle=True) in compress_octree.py and training_pipeline.py — prevents arbitrary code execution via crafted .npy/.npz files. Metadata now saved as JSON sidecar; optimizer variables saved as individual .npy files with numeric dtypes.
  • Add path validation in training_pipeline.py (traversal guard via Path.relative_to()) and evaluation_pipeline.py (existence check) for checkpoint loading.
  • Replace model.save() with model.save_weights() in cli_train.py to avoid full SavedModel format vulnerable to Keras deserialization RCE.
  • Fix 3 additional bugs found during coverage analysis: debug output no longer pickles dicts, NaN/Inf metadata scalars converted to None for valid JSON, path validation uses relative_to() to prevent prefix collision bypass.
  • Add 26 new tests (213 → 239) covering security controls, NaN/Inf handling, zero/empty cases, error paths, format regression, integration, and E2E.

Test plan

  • ruff check src/ tests/ — lint clean
  • pytest tests/ -v — all 239 tests pass, 0 regressions
  • Path traversal attacks rejected (../../, absolute paths, prefix collisions)
  • NaN/Inf in metadata serialized safely
  • Missing file error paths produce clear exceptions
  • Checkpoint save/load preserves optimizer state values
  • Full compress → save → load → decompress E2E quality verified

🤖 Generated with Claude Code

pmclSF and others added 2 commits February 16, 2026 01:49
- Remove numpy.load(allow_pickle=True) in compress_octree.py and
  training_pipeline.py to prevent arbitrary code execution via crafted
  .npy/.npz files. Metadata now saved as JSON sidecar; optimizer
  variables saved as individual .npy files with numeric dtypes.
- Add path validation in training_pipeline.py (traversal guard) and
  evaluation_pipeline.py (existence check) for checkpoint loading.
- Replace model.save() with model.save_weights() in cli_train.py to
  avoid full SavedModel format vulnerable to Keras deserialization RCE.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…age analysis

Bug fixes in source:
- compress_octree: _save_debug_info no longer pickles dicts (only saves ndarrays)
- compress_octree: save_compressed converts NaN/Inf scalars to None for valid JSON
- training_pipeline: path validation uses Path.relative_to() to prevent prefix
  collision bypass (e.g. checkpoints_evil matching checkpoints prefix)

New tests (26 total, 213 → 239):
- test_compress_octree (13): NaN/Inf metadata, empty grid, no-normals roundtrip,
  missing sidecar/grid files, debug pickle prevention, metadata value fidelity,
  numpy scalar types, dtype change documentation, E2E quality check
- test_training_pipeline (9): path traversal/absolute/prefix-collision rejection,
  NaN in optimizer vars, save before training, missing weights, partial optimizer
  files, old pickle format ignored, optimizer state value fidelity
- test_evaluation_pipeline (3): no checkpoint configured, empty string checkpoint,
  missing checkpoint raises FileNotFoundError
- test_integration (1): checkpoint resume preserves eval loss

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@pmclSF pmclSF merged commit f613703 into main Feb 16, 2026
6 checks passed
@pmclSF pmclSF deleted the security/fix-critical-vulnerabilities branch February 16, 2026 16:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant