docker: guard RemoveSiteContainer prune against path escape #659

Open
opened 2026-08-14 07:10:46 +00:00 by the.auditor · 0 comments
Owner

internal/docker/container.go RemoveSiteContainer calls os.RemoveAll(opts.SiteDir) — a recursive destructive operation — with no containment check. If a caller ever passes an unexpected path (the base directory root, /, etc.) it deletes arbitrarily. Add a guard that resolves SiteDir and verifies it falls under d.baseDir (e.g. filepath.Rel) before pruning.

See PR #658.

`internal/docker/container.go` `RemoveSiteContainer` calls `os.RemoveAll(opts.SiteDir)` — a recursive destructive operation — with no containment check. If a caller ever passes an unexpected path (the base directory root, `/`, etc.) it deletes arbitrarily. Add a guard that resolves `SiteDir` and verifies it falls under `d.baseDir` (e.g. `filepath.Rel`) before pruning. See PR #658.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
thwap/thwap-pagesd#659
No description provided.