Skip to content

Commit e25ee06

Browse files
committed
Defence in depth for adding directories to the zip
Found while debugging the MathJax issue (#3276), MathJax requires the `mathjaxfonts` to be specified in the config. We parse that URL and try to add that directory to the zip which fails.
1 parent b5f2352 commit e25ee06

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

webapp/src/Service/DOMJudgeService.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1574,6 +1574,10 @@ public function getScoreboardZip(
15741574
if ($filepath === false) {
15751575
throw new Exception("Could not find (possibly symlinked) file: " . $file . ", at: " . $publicPath);
15761576
}
1577+
if (!in_array(filetype($filepath), ['file', 'link'])) {
1578+
// Ignore special filetypes
1579+
continue;
1580+
}
15771581
if (!(str_starts_with($filepath, $publicPath) ||
15781582
str_starts_with($filepath, $this->vendorDir) ||
15791583
str_starts_with($filepath, $this->nodeModulesDir))

0 commit comments

Comments
 (0)