influxdata / influxdata/influxdb
Unsafe tar archive handling
- Dominant language
- Rust
- Stars
- 31.7k
- Forks
- 3.7k
- Avg merge
- 13h 37m
- Merged PRs (30d)
- 8
Description
https://github.com/influxdata/influxdb/blob/7b1763e791bc9a93d9bac80e721958d75dfdaccc/pkg/tar/stream.go#L109-L130
When hdr is something like `../../../../bad/fileOrDir`, `MkdirAll` will attempt to create a directory in an unwanted location. Reported by Github CodeQL.
Also `Join/Split/Join` seems redundant, it can be made simpler.
Contributor guide
Research direction
Start in pkg/tar/stream.go at lines 109-130 and inspect how hdr paths reach MkdirAll. Reproduce the CodeQL-reported traversal case using a path such as ../../../../bad/fileOrDir, then verify archive extraction cannot create directories outside the intended location. Also review whether the Join/Split/Join sequence can be simplified without changing safe path handling.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- security
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100