File tree Expand file tree Collapse file tree 2 files changed +41
-0
lines changed
Engine/Internal/Protocol/Parser
Testing/Acceptance/Engine/Internal/Security Expand file tree Collapse file tree 2 files changed +41
-0
lines changed Original file line number Diff line number Diff line change @@ -14,6 +14,16 @@ public static void Validate(Request request)
1414 {
1515 throw new ProtocolException ( "Multiple 'Host' headers specified" ) ;
1616 }
17+
18+ var target = request . Target . Path . Parts ;
19+
20+ for ( var i = 0 ; i < target . Count ; i ++ )
21+ {
22+ if ( target [ i ] . Value == "." || target [ i ] . Value == ".." )
23+ {
24+ throw new ProtocolException ( "Segments '.' or '..' are now allowed in path" ) ;
25+ }
26+ }
1727 }
1828
1929}
Original file line number Diff line number Diff line change 1+ namespace GenHTTP . Testing . Acceptance . Engine . Internal . Security ;
2+
3+ [ TestClass ]
4+ public class PathSegmentTests : WireTest
5+ {
6+
7+ [ TestMethod ]
8+ public async Task TestUp ( )
9+ {
10+ var request = new [ ]
11+ {
12+ "GET /../ HTTP/1.1" ,
13+ "Host: host"
14+ } ;
15+
16+ await TestAsync ( request , "Segments '.' or '..' are now allowed in path" ) ;
17+ }
18+
19+ [ TestMethod ]
20+ public async Task TestEncoded ( )
21+ {
22+ var request = new [ ]
23+ {
24+ "GET /%2E/ HTTP/1.1" ,
25+ "Host: host"
26+ } ;
27+
28+ await TestAsync ( request , "Segments '.' or '..' are now allowed in path" ) ;
29+ }
30+
31+ }
You can’t perform that action at this time.
0 commit comments