improve static serve jail
This commit is contained in:
parent
6cc849bf01
commit
0bfe34ab6b
|
|
@ -253,7 +253,7 @@ public sealed class HttpServer {
|
|||
if (reqPath.StartsWith(k)) { // do a static serve
|
||||
wasStaticlyServed = true;
|
||||
var relativeStaticReqPath = reqPath[k.Length..];
|
||||
var staticResponsePath = Path.Combine(v, relativeStaticReqPath.TrimStart('/'));
|
||||
var staticResponsePath = Path.GetFullPath(Path.Join(v, relativeStaticReqPath.TrimStart('/')));
|
||||
|
||||
if (Path.GetRelativePath(v, staticResponsePath).Contains("..")) {
|
||||
requestLogger.Warning($"Blocked GET request to {reqPath} as somehow the target file does not lie inside the static serve folder? Are you using symlinks?");
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user