Skip to content

fileserver: reject short names in every path component - #7952

Merged
steadytao merged 5 commits into
caddyserver:masterfrom
DavidCarliez:codex/windows-short-name-components
Aug 28, 2026
Merged

steadytao merged 5 commits into
caddyserver:masterfrom
DavidCarliez:codex/windows-short-name-components

Conversation

@DavidCarliez

Copy link
Copy Markdown
Contributor

Summary

  • Detect Windows NTFS 8.3 short-name syntax in every path component, including parent components.
  • Handle both slash types and Windows trailing-dot/space behavior.
  • Preserve ordinary tilde-containing names that do not match 8.3 alias syntax.
  • Add portable helper tests and a Windows-only file-server regression test.

Testing

  • go test -race -short ./...
  • go build ./...
  • go vet ./modules/caddyhttp/fileserver
  • Windows cross-compilation
  • Targeted Windows tests under Wine

The regression test confirms that a short-name parent component followed by a long filename is rejected with HTTP 400. It also confirms that an ordinary long tilde-containing filename remains accessible.

Assistance Disclosure

OpenAI Codex generated the implementation and tests under my direction. I reviewed the resulting patch and used Codex to run and verify the automated test suite. The associated security report was also AI-assisted.

Signed-off-by: DavidCarliez <271374756+DavidCarliez@users.noreply.github.com>
@CLAassistant

CLAassistant commented Aug 22, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@steadytao steadytao left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will review more thoroughly once the below is resolved.

DavidCarliez and others added 2 commits August 24, 2026 18:33
Signed-off-by: DavidCarliez <271374756+DavidCarliez@users.noreply.github.com>

@steadytao steadytao left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Windows can be configured with fsutil behavior allowextchar 1, allowing extended characters, including diacritics, in generated 8.3 names. This makes the new café~1.txt pass-through unsafe on those systems. We cannot treat every non-ASCII tilde-number shape as an ordinary long name. Please either fail closed for this shape or resolve actual aliases through an appropriate Windows API and apply the hide check to the resolved long path.

@steadytao steadytao added this to the v2.11.5 milestone Aug 25, 2026
@steadytao steadytao added the bug 🐞 Something isn't working label Aug 25, 2026
Signed-off-by: DavidCarliez <271374756+DavidCarliez@users.noreply.github.com>

@steadytao steadytao left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@steadytao
steadytao enabled auto-merge (squash) August 28, 2026 09:02
@steadytao
steadytao merged commit 3244ef4 into caddyserver:master Aug 28, 2026
23 of 26 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug 🐞 Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants