Skip to content

Commit

Permalink
Make sure /..;/ isn't resolved as /
Browse files Browse the repository at this point in the history
  • Loading branch information
jmartisk committed Feb 15, 2024
1 parent 754f4e4 commit c5a0c96
Showing 1 changed file with 40 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
package io.quarkus.vertx.http.proxy;

import static io.restassured.RestAssured.given;

import org.jboss.shrinkwrap.api.asset.StringAsset;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.RegisterExtension;

import io.quarkus.test.QuarkusUnitTest;

/**
* Make sure that `/..;/` appended to a path is not resolved to `/`, as this
* would allow to escape the allowed context when passing through proxies
* (httpd does not recognize it as a double-dot segment and lets the request
* through without sanitizing the path).
*/
public class DotDotSemicolonSegmentTest {

@RegisterExtension
static final QuarkusUnitTest config = new QuarkusUnitTest().withApplicationRoot(jar -> {
jar.addAsResource(new StringAsset("Hello"), "META-INF/resources/index.html");
});

@Test
public void testPathIsNotResolved() {
given()
.get("/index.html")
.then()
.statusCode(200);
given()
.get("/something/../index.html")
.then()
.statusCode(200);
given()
.get("/something/..;/index.html")
.then()
.statusCode(404);
}

}

0 comments on commit c5a0c96

Please sign in to comment.