Skip to content

fix(http): reject %00 in static paths and keep symlinks inside the static root - #3784

Merged
BaseMax merged 1 commit into
mainfrom
fix/static-serving-nul-symlink
Nov 21, 2026
Merged

BaseMax merged 1 commit into
mainfrom
fix/static-serving-nul-symlink

Conversation

@BaseMax

@BaseMax BaseMax commented Nov 21, 2026

Copy link
Copy Markdown
Member

Static serving decoded the URL into a C string, so a %00 cut the path short and an allowed file could be fetched under another name, and a symlink inside the static directory could point out of it.

A %00 in the path now gets 400. Before serving a file, a directory or its index.html, the real path is resolved with os.RealPath and must stay under the real static root (directory boundary check, fails closed, lower cased and slash normalised on Windows).

Tested with a main-built compiler: new tests/en/general/net_http_static_jail (localhost server and raw socket; before the fix every case answered 200), plus net_http_static_cache, net_spa_fallback and serve_template, salam check for windows and macOS targets.

@BaseMax
BaseMax requested a review from a team as a code owner November 21, 2026 17:56
@coderabbitai

coderabbitai Bot commented Nov 21, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 16 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 2 included reviews currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: e3d6b70a-f420-4613-8300-ec978cb01b71
Commits

Reviewing files that changed from the base of the PR and between 286fde7 and 7b18ced.

Files ignored due to path filters: 1

  • tests/en/general/net_http_static_jail.out is excluded by !**/*.out
Files selected for processing: 2

  • std/net/http/ctx_internal.salam
  • tests/en/general/net_http_static_jail.salam
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@BaseMax
BaseMax merged commit 9be8f6a into main Nov 21, 2026
15 checks passed
@BaseMax
BaseMax deleted the fix/static-serving-nul-symlink branch November 21, 2026 17:58
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.

1 participant