Skip to content

Commit ad34de5

Browse files
ihor-sokoliukclaudecodex
committed
test(search): assert all-cooled error by exact match to clear CodeQL alert (FEAT-047)
CodeQL flagged the new all-cooled-down test's error.message.includes('https://...') assertions as js/incomplete-url-substring-sanitization (2 high). The check is a test assertion, not URL sanitization, but it fails the required gate. Replace the URL-substring includes() with a single exact-match assertion on the full error string, which also covers ordering and the no-double-space requirement. Test-only; no production behavior change. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Co-Authored-By: Codex <noreply@openai.com>
1 parent d4bd62c commit ad34de5

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

__tests__/unit/search.test.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2008,9 +2008,13 @@ async function runTests() {
20082008
await performWebSearch(mockServer as any, 'all cooled');
20092009
assert.fail('Expected all-cooled error');
20102010
} catch (error: any) {
2011-
assert.ok(error.message.includes('All configured SearXNG instances are in cooldown after repeated failures'), error.message);
2012-
assert.ok(error.message.includes('https://cooled-one.example.com'), error.message);
2013-
assert.ok(error.message.includes('https://cooled-two.example.com'), error.message);
2011+
// Exact-match (not URL substring .includes()) so the assertion also covers
2012+
// ordering and the absence of double spaces, and avoids CodeQL's
2013+
// incomplete-url-substring-sanitization false positive on test code.
2014+
assert.equal(
2015+
error.message,
2016+
'All configured SearXNG instances are in cooldown after repeated failures: https://cooled-one.example.com, https://cooled-two.example.com.',
2017+
);
20142018
assert.ok(!error.message.includes(' '), error.message);
20152019
}
20162020
assert.equal(fetchCalled, false);

0 commit comments

Comments
 (0)