Summary
spider.name() is interpolated directly into filesystem paths for cache and checkpoint directories without sanitization. A spider name containing ../ enables path traversal to write outside the .scrapling/ directory.
Location
- File:
src/spiders/engine.rs
- Line(s): 50–60
Severity
High
Details
.unwrap_or_else(|| format!(".scrapling/{}/cache", spider.name()));
.unwrap_or_else(|| format!(".scrapling/{}/checkpoints", spider.name()));
If a spider name contains ../ (e.g., "../../etc/cron.d"), create_dir_all and subsequent file writes would target arbitrary filesystem locations.
Suggested Fix
Sanitize the spider name before use:
let safe_name = spider.name().replace(['/', '\\', '.'], "_");
let dir = format!(".scrapling/{}/cache", safe_name);
Or validate using Path::new(name).components() to ensure no .. or root components.
Automated finding by repo-monitor
Summary
spider.name()is interpolated directly into filesystem paths for cache and checkpoint directories without sanitization. A spider name containing../enables path traversal to write outside the.scrapling/directory.Location
src/spiders/engine.rsSeverity
High
Details
If a spider name contains
../(e.g.,"../../etc/cron.d"),create_dir_alland subsequent file writes would target arbitrary filesystem locations.Suggested Fix
Sanitize the spider name before use:
Or validate using
Path::new(name).components()to ensure no..or root components.Automated finding by repo-monitor