Commit e326919
committed
Harden the deeplink suffix against traversal and delimiter injection
The splat arrives percent-decoded from the router, so the preserved remainder
could contain "." / ".." segments and literal "?" or "#" characters. Traversal
segments let a crafted suffix climb back out of the resolved environment path
(/deeplink/apikeys/../../../../../../x resolved to /orgs/x), and a decoded "?"
or "#" became part of the target's query or hash rather than its path.
Drop traversal segments and re-encode each remaining segment when rebuilding
the path. The redirect can no longer leave the resolved environment path.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MvNi2jRtYatPQdXFJRK9SW1 parent d2efe29 commit e326919
1 file changed
Lines changed: 12 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | | - | |
18 | | - | |
19 | | - | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
20 | 28 | | |
21 | 29 | | |
22 | 30 | | |
23 | 31 | | |
24 | 32 | | |
25 | 33 | | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
| 34 | + | |
32 | 35 | | |
33 | 36 | | |
34 | 37 | | |
| |||
0 commit comments