← back to Resume Queue Viewer
Add 404 guard for snapshot/backup URL paths
65467ca7c3a5eb12742dd8ccf2bd362436a4e7a0 · 2026-05-19 21:20:08 -0700 · SteveStudio2
Refuses any request whose path matches *.bak, *.pre-*, *.orig, *.rej,
*.swp, or *~ before any other routing. The viewer serves no static files
today but this is belt-and-braces in case a future static mount is added.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Files touched
Diff
commit 65467ca7c3a5eb12742dd8ccf2bd362436a4e7a0
Author: SteveStudio2 <steve@designerwallcoverings.com>
Date: Tue May 19 21:20:08 2026 -0700
Add 404 guard for snapshot/backup URL paths
Refuses any request whose path matches *.bak, *.pre-*, *.orig, *.rej,
*.swp, or *~ before any other routing. The viewer serves no static files
today but this is belt-and-braces in case a future static mount is added.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
---
server.js | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/server.js b/server.js
index 4ff630b..23b0834 100644
--- a/server.js
+++ b/server.js
@@ -386,7 +386,19 @@ setInterval(load, 30000);
</body>
</html>`;
+// Defensive 404-guard: even though this app serves no static files, refuse to
+// answer any URL that looks like a snapshot/backup leak (*.bak, *.pre-*,
+// *.orig, *.rej, *.swp, *~) before any other routing. Belt-and-braces in case
+// a future static-mount is bolted on top.
+const SNAPSHOT_RE = /(\.bak(\.|$)|\.pre-|\.orig$|\.rej$|\.swp$|~$)/i;
+
const server = http.createServer((req, res) => {
+ if (SNAPSHOT_RE.test(req.url || '')) {
+ res.writeHead(404, { 'Content-Type': 'text/plain; charset=utf-8' });
+ res.end('404 — not found');
+ return;
+ }
+
if (req.url === '/api/queue') return sendJSON(res, 200, buildQueue());
if (req.url === '/api/run' && req.method === 'POST') {
← 2fda15c Add rel="noopener noreferrer" to external link in queue card
·
back to Resume Queue Viewer
·
Expand sort options: Status, Priority, Title A→Z bab1134 →