[object Object]

← back to Linenwallpaper

fix: remove served .bak file, patch 404 guard regex, add *.bak-* to .gitignore

63a40654d2476d37a3ebbbe24376804e9671cf09 · 2026-05-30 21:30:07 -0700 · Steve Abrams

public/index.html.bak-20260526152130 was being served by express.static (HTTP 200)
because the 404-guard regex only blocked .bak followed by . or EOL, not .bak-TIMESTAMP
suffixes. Removed the file, fixed the guard to match .bak- patterns, and added
*.bak-* to .gitignore so timestamped backups can never slip in again.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

Files touched

Diff

commit 63a40654d2476d37a3ebbbe24376804e9671cf09
Author: Steve Abrams <steve@designerwallcoverings.com>
Date:   Sat May 30 21:30:07 2026 -0700

    fix: remove served .bak file, patch 404 guard regex, add *.bak-* to .gitignore
    
    public/index.html.bak-20260526152130 was being served by express.static (HTTP 200)
    because the 404-guard regex only blocked .bak followed by . or EOL, not .bak-TIMESTAMP
    suffixes. Removed the file, fixed the guard to match .bak- patterns, and added
    *.bak-* to .gitignore so timestamped backups can never slip in again.
    
    Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
---
 .gitignore        |  1 +
 package-lock.json | 13 +++++++++++++
 server.js         |  2 +-
 3 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/.gitignore b/.gitignore
index 7e2084a..caca2c7 100644
--- a/.gitignore
+++ b/.gitignore
@@ -11,5 +11,6 @@ build/
 .next/
 *.bak
 *.bak.*
+*.bak-*
 *.pre-*
 .deploy.conf
diff --git a/package-lock.json b/package-lock.json
index 692729e..accff9d 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -8,6 +8,7 @@
       "name": "linenwallpaper",
       "version": "0.1.0",
       "dependencies": {
+        "dotenv": "^17.4.2",
         "express": "^4.21.0",
         "helmet": "^8.1.0"
       }
@@ -172,6 +173,18 @@
         "npm": "1.2.8000 || >= 1.4.16"
       }
     },
+    "node_modules/dotenv": {
+      "version": "17.4.2",
+      "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-17.4.2.tgz",
+      "integrity": "sha512-nI4U3TottKAcAD9LLud4Cb7b2QztQMUEfHbvhTH09bqXTxnSie8WnjPALV/WMCrJZ6UV/qHJ6L03OqO3LcdYZw==",
+      "license": "BSD-2-Clause",
+      "engines": {
+        "node": ">=12"
+      },
+      "funding": {
+        "url": "https://dotenvx.com"
+      }
+    },
     "node_modules/dunder-proto": {
       "version": "1.0.1",
       "resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz",
diff --git a/server.js b/server.js
index edffb58..a1b59d9 100644
--- a/server.js
+++ b/server.js
@@ -141,7 +141,7 @@ app.use(require('../_shared/api-vendor-redact'));
 // 404-guard for backup/pre-fix snapshot files — never serve them even if they
 // slip into a deploy dir (defense-in-depth alongside .gitignore + rsync excludes).
 app.use((req, res, next) => {
-  if (/\.(bak|pre-[^/]+)(\.|$)/i.test(req.path)) return res.status(404).send('Not found');
+  if (/\.(bak[-.]|pre-)[^/]*/i.test(req.path) || /\.bak$/i.test(req.path)) return res.status(404).send('Not found');
   next();
 });
 app.use(helmet({ contentSecurityPolicy: false }));

← 4bf5032 feat(fleet): theme1/theme2 query-param-gated toggle on catal  ·  back to Linenwallpaper  ·  noopener,noreferrer on sister-site window.open popup 8c441a9 →