[object Object]

← back to Wallpapercontractor

harden: 404-guard snapshot artifacts from static root + ignore *.bak/*.pre-*

31e873e2ad0208e8b2a272c606726b10131785fc · 2026-05-19 08:13:20 -0700 · Steve

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

Files touched

Diff

commit 31e873e2ad0208e8b2a272c606726b10131785fc
Author: Steve <steve@designerwallcoverings.com>
Date:   Tue May 19 08:13:20 2026 -0700

    harden: 404-guard snapshot artifacts from static root + ignore *.bak/*.pre-*
    
    Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
---
 .gitignore |  6 ++++++
 server.js  | 12 ++++++++++++
 2 files changed, 18 insertions(+)

diff --git a/.gitignore b/.gitignore
index 4a0b3ea..ec2a1ea 100644
--- a/.gitignore
+++ b/.gitignore
@@ -7,3 +7,9 @@ tmp/
 dist/
 build/
 .next/
+*.bak
+*.bak.*
+*.pre-*
+*.orig
+*.swp
+*~
diff --git a/server.js b/server.js
index 67518d5..8662eac 100644
--- a/server.js
+++ b/server.js
@@ -28,6 +28,14 @@ app.use((req, res, next) => {
   next();
 });
 
+// Never serve editor/snapshot artifacts from the static root
+app.use((req, res, next) => {
+  if (/\.(bak|orig|swp|tmp)(\.|$)|\.pre-|~$/i.test(req.path)) {
+    return res.status(404).render('404', { site: SITE });
+  }
+  next();
+});
+
 app.use(express.static(path.join(__dirname, 'public'), { maxAge: '1h' }));
 
 // Ensure data dir for leads JSONL
@@ -123,6 +131,10 @@ app.get('/about', (req, res) => {
   res.render('about', { site: SITE });
 });
 
+app.get('/privacy', (req, res) => {
+  res.render('privacy', { site: SITE });
+});
+
 // ─── Consumer lead funnel ─────────────────────────────────────────────
 app.get('/find-installer', (req, res) => {
   res.render('lead', { site: SITE });

← eedf687 fix: add rel=noopener noreferrer to all target=_blank links  ·  back to Wallpapercontractor  ·  add /privacy page — fixes dead lead-funnel consent link cf652cb →