Commit 21f658f
committed
fix: aim the public traversal test at the vector that reaches the guard
The counterfactual did not discriminate: removing the containment check
left the test green. `/public/%2E%2E/secret.txt` never enters the public
branch at all, because the WHATWG URL parser decodes `%2E%2E` and
normalises the dot segment away, so the request arrives as plain
`/secret.txt`. The test was observing nothing.
An encoded slash survives parsing intact, so `/public/..%2Fsecret.txt`
enters the branch with a path `join` then resolves outside appDir/public/,
which is what the guard is for. With that vector the test goes red when
the guard is removed.
The comment this was derived from asserted the opposite ("after URL
parsing, which doesn't touch %2E"), so correct it where it now lives
rather than carry an inaccurate claim into the extracted function.1 parent 915c662 commit 21f658f
2 files changed
Lines changed: 19 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2106 | 2106 | | |
2107 | 2107 | | |
2108 | 2108 | | |
2109 | | - | |
2110 | | - | |
2111 | | - | |
2112 | | - | |
2113 | | - | |
| 2109 | + | |
| 2110 | + | |
| 2111 | + | |
| 2112 | + | |
2114 | 2113 | | |
2115 | 2114 | | |
2116 | 2115 | | |
| 2116 | + | |
| 2117 | + | |
| 2118 | + | |
| 2119 | + | |
2117 | 2120 | | |
2118 | 2121 | | |
2119 | 2122 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
113 | 113 | | |
114 | 114 | | |
115 | 115 | | |
116 | | - | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
117 | 126 | | |
118 | 127 | | |
119 | 128 | | |
120 | 129 | | |
121 | | - | |
| 130 | + | |
122 | 131 | | |
123 | 132 | | |
124 | 133 | | |
| |||
0 commit comments