Skip to content

Commit 9eb23d9

Browse files
committed
refactor: remove unreachable null check per Copilot suggestion
Remove the null check for allowedHost since isAllowedUrl() validation guarantees the canonicalized host exists in CANONICALIZED_TO_ORIGINAL map. The check was technically unreachable code. This simplifies the code while maintaining the same security guarantees.
1 parent f7debb2 commit 9eb23d9

File tree

1 file changed

+0
-5
lines changed

1 file changed

+0
-5
lines changed

backend-java/.mvn/wrapper/MavenWrapperDownloader.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -192,11 +192,6 @@ private static void downloadFileFromURL( URL wrapperUrl, Path wrapperJarPath )
192192
String canonicalizedHost = canonicalizeHost(wrapperUrl.getHost());
193193
String allowedHost = CANONICALIZED_TO_ORIGINAL.get(canonicalizedHost);
194194

195-
// This should never be null given the validation above, but kept as a safety check
196-
if (allowedHost == null) {
197-
throw new IOException("URL validation failed: Host validation error.");
198-
}
199-
200195
// Construct URL using whitelist host (not user-provided host) and default port
201196
// Always use -1 to ensure default HTTPS port (443) is used
202197
// This ensures CodeQL recognizes we're using sanitized data

0 commit comments

Comments
 (0)