Skip to content

fix(sandbox): serve files in subdirectories under -sandbox - #231

Merged
Mzack9999 merged 2 commits into
projectdiscovery:devfrom
hakarrr:fix/sandbox-nested-paths
Dec 2, 2026
Merged

Mzack9999 merged 2 commits into
projectdiscovery:devfrom
hakarrr:fix/sandbox-nested-paths

Conversation

@hakarrr

@hakarrr hakarrr commented Dec 1, 2026

Copy link
Copy Markdown

Fixes #230

Proposed changes

With -sandbox, files more than one directory below the root were rejected as "invalid file". The containment check matched the absolute path against a glob where * does not cross path separators. It now checks containment with filepath.Rel, so nested files are served and paths outside the root are still rejected.

Tests: new pkg/httpserver/sandboxfs_test.go covers nested files and outside-root rejection (fails before the change, passes after). go test ./pkg/httpserver/... and go vet ./... are clean.

Checklist

  • Pull request is created against the dev branch
  • All checks passed (lint, unit/integration/regression tests etc.) with my changes
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)

hakarrr and others added 2 commits December 1, 2026 07:21
Fixes projectdiscovery#230

Co-authored-by: GeneralTony007 <144252170+GeneralTony007@users.noreply.github.com>
@Mzack9999
Mzack9999 merged commit f59f682 into projectdiscovery:dev Dec 2, 2026
5 checks passed
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.

2 participants