atris 3.72.1 → 3.72.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/site.js +2 -0
- package/package.json +1 -1
package/lib/site.js
CHANGED
|
@@ -103,6 +103,8 @@ function serveSite(dir, port = 4321) {
|
|
|
103
103
|
let rel;
|
|
104
104
|
try { rel = decodeURIComponent((req.url || '/').split('?')[0]); }
|
|
105
105
|
catch { res.writeHead(400); res.end('bad request'); return; }
|
|
106
|
+
// A null byte makes the fs calls below throw synchronously and crash the server.
|
|
107
|
+
if (rel.includes('\0')) { res.writeHead(400); res.end('bad request'); return; }
|
|
106
108
|
if (rel.endsWith('/')) rel += 'index.html';
|
|
107
109
|
const file = path.normalize(path.join(root, rel));
|
|
108
110
|
// compare against root + separator so a sibling like "site-evil" can't pass for "site"
|