From 2429fa06d52d9bd584890607cd2d097126a4e274 Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 18 May 2026 17:17:42 +0000 Subject: [PATCH] Tighten bot probe regex and React Flight Sentry filter - Remove .xml, .log, .git from bot probe blocklist to avoid false positives on legitimate routes (e.g. /sitemap.xml) - Tighten React Flight error filter from broad string match to precise wire-format pattern (/\$\d+:[a-z]/) to avoid swallowing real errors - Remove redundant URL check from beforeSend (ignoreErrors already covers it) - Fix missing newline at end of instrument.server.mjs https://claude.ai/code/session_01Y5Ca6oxd5zyyM89acmogf7 --- instrument.server.mjs | 7 ++----- server/app.ts | 2 +- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/instrument.server.mjs b/instrument.server.mjs index 38f9a7e..486b0b6 100644 --- a/instrument.server.mjs +++ b/instrument.server.mjs @@ -12,12 +12,9 @@ Sentry.init({ /No route matches URL ".*\/(wp-admin|wp-login|phpmyadmin|xmlrpc)"/i, ], beforeSend(event) { - const url = event.request?.url ?? ""; const msg = event.exception?.values?.[0]?.value ?? ""; // Drop React Flight protocol probe errors (e.g. $1:aa:aa in multipart body) - if (msg.includes("$1:")) return null; - // Belt-and-suspenders: drop any remaining bot probe URL errors - if (/\.(php|env|htaccess|xml|aspx|bak|sql)$|wp-admin|phpmyadmin/i.test(url)) return null; + if (/\$\d+:[a-z]/.test(msg)) return null; return event; }, -}); \ No newline at end of file +}); diff --git a/server/app.ts b/server/app.ts index 379e435..2de2ca3 100644 --- a/server/app.ts +++ b/server/app.ts @@ -13,7 +13,7 @@ app.use((_, __, next) => DatabaseContext.run(db, next)); // Block common bot probe paths before React Router (and Sentry) see them const BOT_PROBE_RE = - /\.(php|env|git|htaccess|xml|aspx|asp|jsp|config|bak|sql|ini|log|swp|DS_Store)$|^\/(wp-admin|wp-login|phpmyadmin|xmlrpc|server-status|cgi-bin|shell|cmd|console|actuator)(\/|$)/i; + /\.(php|env|htaccess|aspx|asp|jsp|config|bak|sql|ini|swp|DS_Store)$|^\/(wp-admin|wp-login|phpmyadmin|xmlrpc|server-status|cgi-bin|shell|cmd|console|actuator)(\/|$)/i; app.use((req, res, next) => { if (BOT_PROBE_RE.test(req.path)) {