Skip to content

Commit

Permalink
[JENKINS-75003] Zip-based tool installer configuration incorrectly re…
Browse files Browse the repository at this point in the history
…jects non-HTTP(S) URLs (regression in 2.379) (#10065)

[JENKINS-75003] Zip-based tool installer configuration incorrectly rejects non-HTTP(S) URLs
  • Loading branch information
basil authored Dec 17, 2024
1 parent f1b6d31 commit 34aba67
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions core/src/main/java/hudson/tools/ZipExtractionInstaller.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.nio.file.FileSystemNotFoundException;
import java.nio.file.Path;
import jenkins.MasterToSlaveFileCallable;
import jenkins.model.Jenkins;
import org.jenkinsci.Symbol;
Expand Down Expand Up @@ -117,6 +119,14 @@ public FormValidation doCheckUrl(@QueryParameter String value) throws Interrupte
} catch (URISyntaxException e) {
return FormValidation.error(e, Messages.ZipExtractionInstaller_malformed_url());
}
if (uri.getScheme() != null && !uri.getScheme().startsWith("http")) {
try {
Path.of(uri);
return FormValidation.ok();
} catch (FileSystemNotFoundException | IllegalArgumentException e) {
return FormValidation.error(e, Messages.ZipExtractionInstaller_malformed_url());

Check warning on line 127 in core/src/main/java/hudson/tools/ZipExtractionInstaller.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Not covered lines

Lines 122-127 are not covered by tests
}
}
HttpClient httpClient = ProxyConfiguration.newHttpClient();
HttpRequest httpRequest;
try {
Expand Down

0 comments on commit 34aba67

Please sign in to comment.