Skip to content

Commit

Permalink
COMMANDBOX-1647
Browse files Browse the repository at this point in the history
  • Loading branch information
bdw429s committed Dec 4, 2024
1 parent eb13d48 commit aa35163
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion gradle/version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
5.0.8-0de55e3b7a2f4c8dd5b33ef11edc7a90a39506e7-96ea216b7cfb6883a6af15c191a94953a0596b9c
5.0.9-0de55e3b7a2f4c8dd5b33ef11edc7a90a39506e7-96ea216b7cfb6883a6af15c191a94953a0596b9c
7 changes: 4 additions & 3 deletions src/main/java/runwar/undertow/SiteDeployment.java
Original file line number Diff line number Diff line change
Expand Up @@ -210,16 +210,17 @@ public String toString() {

@Override
public void handleRequest(final HttpServerExchange exchange) throws Exception {

String CononicalURI = CanonicalPathUtils.canonicalize(exchange.getRelativePath());
Resource resource = resourceManager
.getResource(CanonicalPathUtils.canonicalize(exchange.getRelativePath()));
.getResource(CononicalURI);
if (resource != null && !resource.isDirectory()) {
String ext = resource.getFile().getName().toLowerCase();
if (ext.contains(".")) {
ext = ext.substring(ext.lastIndexOf(".") + 1);
}

if (!extSet.contains(ext)) {
// Whitelist the /.well-known/ directory
if (!CononicalURI.startsWith("/.well-known/") && !extSet.contains(ext)) {
LOG.debug(
"Blocking access to [" + exchange.getRelativePath() + "] based on allowed extensions.");
exchange.setStatusCode(403);
Expand Down

0 comments on commit aa35163

Please sign in to comment.