Skip to content

fix(controller): harden path traversal check against encoded bypass attempts#2089

Merged
bpamiri merged 1 commit intodevelopfrom
peter/fix-path-traversal-encoding
Apr 10, 2026
Merged

fix(controller): harden path traversal check against encoded bypass attempts#2089
bpamiri merged 1 commit intodevelopfrom
peter/fix-path-traversal-encoding

Conversation

@bpamiri
Copy link
Copy Markdown
Collaborator

@bpamiri bpamiri commented Apr 10, 2026

Summary

  • Add URL-decode normalization and null-byte stripping before path traversal validation in $generateIncludeTemplatePath()
  • Prevents bypasses using %2e%2e (URL-encoded ..) or null byte injection in partial/template names
  • Defense-in-depth improvement — the value is developer-controlled in practice, but this hardens the framework against edge cases

Test plan

  • Existing path traversal tests pass (normal partials still work)
  • New tests verify URL-encoded traversal, null bytes, and mixed encoding are rejected
  • Run bash tools/test-local.sh security

🤖 Generated with Claude Code

…ttempts

Add URL-decode normalization and null-byte stripping before the path
traversal check in $generateIncludeTemplatePath(). Prevents bypasses
using %2e%2e or null byte injection in partial/template names.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@bpamiri bpamiri merged commit 8e54507 into develop Apr 10, 2026
3 checks passed
@bpamiri bpamiri deleted the peter/fix-path-traversal-encoding branch April 10, 2026 11:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant