test: use exact hostname matching in mock fetch handlers#764
Open
test: use exact hostname matching in mock fetch handlers#764
Conversation
Semgrep Security ScanNo security issues found. |
74aa6ba to
3e17310
Compare
PR Metrics
Updated Fri, 24 Apr 2026 20:37:31 GMT · run #1200 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Replace loose
url.includes(...)/url.startsWith(...)in backend test mock fetch handlers with proper hostname parsing vianew URL(url).hostname. Fixes 10 CodeQLjs/incomplete-url-substring-sanitizationalerts (#21–#30).Test plan
bun tsc --noEmit(backend) cleanbun test --rerun-each 5on modified files: 170/170 passNote
Low Risk
Low risk: changes are limited to test-only mock
fetchURL matching logic and should not affect production behavior beyond making mocks stricter.Overview
Updates backend tests to stop using loose
url.includes(...)/startsWith(...)checks in mockedfetchhandlers.Mocks now parse URLs with
new URL(url).hostnameand match exact hostnames (including a sharedisPosthogRequesthelper for PostHog), tightening request classification and addressing CodeQL incomplete URL substring sanitization alerts.Reviewed by Cursor Bugbot for commit 09589fb. Bugbot is set up for automated code reviews on this repo. Configure here.