From 622a207ff5873b0c52b841d7147b0f38c8b9076c Mon Sep 17 00:00:00 2001 From: raj pandey Date: Mon, 23 Nov 2026 20:11:07 +0530 Subject: [PATCH] test: replace WAF-blocked payloads in ErrorHandling special-case tests Error_XSSAttempt_SafelyHandled sends '' as a where() value. The Cloudflare WAF on dev11 blocks it with an HTML 403 page at random, so the SDK fails with "SyntaxError: Unexpected token '<'" (passed in #770 and #772-#775, failed in #771 and #776-#781 on the same commit). Error_SQLInjectionAttempt_SafelyHandled sends "'; DROP TABLE entries; --", the same string that was blocked in WhereOperators on Nov 16. Same approach as 45a5af5: replace both with URL metacharacter values (&, =, %, +, #, space) that already pass the WAF in WhereOperators and are what can actually corrupt a query string the SDK builds. Co-Authored-By: Claude Opus 5.5 --- .../ErrorTests/ErrorHandling.test.js | 22 ++++++++++++------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/test/integration/ErrorTests/ErrorHandling.test.js b/test/integration/ErrorTests/ErrorHandling.test.js index 855043055..99d3be528 100644 --- a/test/integration/ErrorTests/ErrorHandling.test.js +++ b/test/integration/ErrorTests/ErrorHandling.test.js @@ -718,34 +718,40 @@ describe('Error Tests - Error Handling & Validation', () => { } }); - test('Error_SQLInjectionAttempt_SafelyHandled', async () => { + // SQL/XSS-style strings (e.g. "'; DROP TABLE", "') + .where('title', '100% a+b #1') .limit(3) .toJSON() .find(); - // Should treat as normal string AssertionHelper.assertQueryResultStructure(result); - console.log('✅ XSS attempt safely handled'); + console.log('✅ Percent, plus and hash in value handled safely'); }); test('Error_UnicodeInQuery_HandlesCorrectly', async () => {