← back to Designerlookbooks
404-guard snapshot/backup paths and broaden .gitignore
2764ec6a04f7b535d6c414561b1f363f633e2895 · 2026-05-19 15:20:47 -0700 · Steve Abrams
DW fleet standing rule — .bak / .bak.* / .pre-* / .orig must never serve
from the static root. public/ is currently empty so no exposure today,
but the middleware locks the door before anything accidentally lands
there. .gitignore now also blocks committing those snapshot extensions.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Files touched
Diff
commit 2764ec6a04f7b535d6c414561b1f363f633e2895
Author: Steve Abrams <steve@designerwallcoverings.com>
Date: Tue May 19 15:20:47 2026 -0700
404-guard snapshot/backup paths and broaden .gitignore
DW fleet standing rule — .bak / .bak.* / .pre-* / .orig must never serve
from the static root. public/ is currently empty so no exposure today,
but the middleware locks the door before anything accidentally lands
there. .gitignore now also blocks committing those snapshot extensions.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
---
.gitignore | 6 ++++++
server.js | 8 ++++++++
2 files changed, 14 insertions(+)
diff --git a/.gitignore b/.gitignore
index 4a0b3ea..5b228e9 100644
--- a/.gitignore
+++ b/.gitignore
@@ -7,3 +7,9 @@ tmp/
dist/
build/
.next/
+
+# never commit snapshot / backup / pre-edit dumps — DW fleet rule
+*.bak
+*.bak.*
+*.pre-*
+*.orig
diff --git a/server.js b/server.js
index 2b8b6ea..de3be0b 100644
--- a/server.js
+++ b/server.js
@@ -36,6 +36,14 @@ app.use((_req, res, next) => {
next();
});
+// Snapshot/backup files should never be reachable from any static path.
+// Even though public/ is currently empty, sweep up any future
+// `.bak` / `.bak.*` / `.pre-*` / `.orig` filenames before they can be
+// served. Standing rule across the DW fleet.
+app.use((req, res, next) => {
+ if (/\.(bak|orig)(\.|$)|\.pre-/i.test(req.path)) return res.status(404).end();
+ next();
+});
app.use('/static', express.static(path.join(__dirname, 'public'), { maxAge: '7d' }));
// ---------------------------------------------------------------------------
← 2a95466 persist sort + density to localStorage on lookbook and searc
·
back to Designerlookbooks
·
scrub vendor name leaks from products.json source (176 produ 8ff736e →