Skip to content

feat(http): validate session identifiers - #2281

Merged
brendt merged 1 commit into
tempestphp:3.xfrom
osbre:harden/session-id-validation
Sep 7, 2026
Merged

feat(http): validate session identifiers#2281
brendt merged 1 commit into
tempestphp:3.xfrom
osbre:harden/session-id-validation

Conversation

@osbre

@osbre osbre commented Sep 6, 2026

Copy link
Copy Markdown
Contributor

Adds strict validation to SessionId to prevent potential path traversal vulnerabilities when session identifiers are used as filenames.

Validating at the SessionId level ensures that all storage drivers and resolvers automatically inherit this security guarantee. This approach matches standard practices used by other frameworks (such as Laravel and Symfony) for file-based session handlers. Existing UUIDs and standard identifiers remain fully compatible.

Testing

Added unit tests in packages/http/tests/Session/SessionIdTest.php.

@github-actions

github-actions Bot commented Sep 6, 2026

Copy link
Copy Markdown

Benchmark Results

Comparison of harden/session-id-validation against 3.x (16a1a2a6db94d90ca803ae4442520b880813d4e5).

Open to see the benchmark results
Benchmark Set Mem. Peak Time Variability
ViewRenderBench(benchExpressions) - 24.592mb 0.00% 261.719μs -5.27% ±0.88% +53.88%
ContainerBench(benchRegisterInitializer) - 6.419mb 0.00% 3.254μs +6.79% ±0.83% -30.24%
ContainerBench(benchRegisterClosureSingleton) - 6.453mb 0.00% 1.469μs +11.10% ±1.57% -45.79%

Generated by phpbench against commit c74c33f

@brendt
brendt merged commit b1ae60e into tempestphp:3.x Sep 7, 2026
78 checks passed
@brendt

brendt commented Sep 7, 2026

Copy link
Copy Markdown
Member

Thanks!

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