Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions server.js
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,14 @@ export default class EleventyDevServer {

computedPath = decodeURIComponent(computedPath);

// Reject a literal `..` path segment that only appears after percent-decoding.
// This closes a bypass where a `%2f`-encoded separator survives the URL layer's
// own dot-segment normalization (which only recognizes literal `/`), then decodes
// into a real `../` here, escaping `this.dir` via a same-prefix sibling directory.
if(computedPath.split(path.sep).includes("..")) {
throw new Error("Invalid path");
}

if(!filename) { // is a direct URL request (not an implicit .html or index.html add)
let alias = this.matchPassthroughAlias(filepath);

Expand Down