Description
Snapshot files are written at path.join(checkpointDir, relativePath) without checking if relativePath escapes the workspace (e.g., if a model wrote an absolute path or a path containing ..). The snapshot read could thus write outside the checkpoints directory.
Environment
- OS: Any
- Node version: v22.20.0
- Nanocoder version: 1.30.0
- Provider: N/A
- Model: N/A
Steps to Reproduce
- Modify
metadata.filesChanged or trick the model into creating a path containing ...
- Trigger the checkpoint manager to save.
Expected Behavior
The path should be strictly validated and normalized to ensure it stays within the intended directory sandbox.
Actual Behavior
A path traversal vulnerability exists, allowing files to be written out of bounds.
Additional Context
Description
Snapshot files are written at
path.join(checkpointDir, relativePath)without checking ifrelativePathescapes the workspace (e.g., if a model wrote an absolute path or a path containing..). The snapshot read could thus write outside the checkpoints directory.Environment
Steps to Reproduce
metadata.filesChangedor trick the model into creating a path containing...Expected Behavior
The path should be strictly validated and normalized to ensure it stays within the intended directory sandbox.
Actual Behavior
A path traversal vulnerability exists, allowing files to be written out of bounds.
Additional Context