Skip to content

fix(serve): resolve symlinks in path-traversal boundary check - #55

Merged
alshdavid merged 2 commits into
mainfrom
agent/auto-flash/c05a256258fa
Oct 19, 2026
Merged

alshdavid merged 2 commits into
mainfrom
agent/auto-flash/c05a256258fa

Conversation

@alshdavid

Copy link
Copy Markdown
Owner

Fixes #27

The lexical boundary check (normalize().starts_with(serve_dir_abs)) does not resolve symlinks, so a symlink inside the served tree could point outside it.

The served directory is canonicalized once at startup, and each request path is canonicalized before being served. Requests that resolve outside the served directory get a 403. The index.html fallback is checked too, since it replaces the target path after the first check.

Verified locally: symlinked directory and symlinked file both return 403 while normal files return 200.

@alshdavid
alshdavid merged commit 19104b2 into main Oct 19, 2026
4 checks passed
@alshdavid
alshdavid deleted the agent/auto-flash/c05a256258fa branch October 19, 2026 09:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Path-traversal guard is lexical only — symlinks can escape the served dir

1 participant