Skip to content

Commit dd5d46a

Browse files
authored
Merge branch 'master' into fix/jenkins-core-cleanup-and-sync
2 parents 1085d3d + 84498e2 commit dd5d46a

File tree

11 files changed

+131
-7
lines changed

11 files changed

+131
-7
lines changed

.github/workflows/announce-lts-rc.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
discourse-author-username: jenkins-release-bot
1818
discourse-category: 23
1919
- name: Post on mailing list
20-
uses: dawidd6/action-send-mail@6d98ae34d733f9a723a9e04e94f2f24ba05e1402 # v6
20+
uses: dawidd6/action-send-mail@6e71c855c9a091d80a519621b9fd3e8d252ca40c # v7
2121
with:
2222
server_address: smtp.gmail.com
2323
server_port: 465

.github/workflows/publish-release-artifact.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
steps:
1919
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
2020
- name: Set up JDK 21
21-
uses: actions/setup-java@f2beeb24e141e01a676f977032f5a29d81c9e27e #v 5.0.0
21+
uses: actions/setup-java@5d7b2146334bacf88728daaa70414a99f5164e0f #v 5.0.0
2222
with:
2323
distribution: "temurin"
2424
java-version: 21

ath.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ set -o xtrace
66
cd "$(dirname "$0")"
77

88
# https://github.com/jenkinsci/acceptance-test-harness/releases
9-
export ATH_VERSION=6483.vecb_7d34edb_75
9+
export ATH_VERSION=6504.v878e5b_e776d7
1010

1111
if [[ $# -eq 0 ]]; then
1212
export JDK=21

core/src/main/java/hudson/model/UpdateSite.java

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,29 @@ protected UpdateCenter.InstallationJob createInstallationJob(Plugin plugin, Upda
294294
*/
295295
@Restricted(NoExternalUse.class)
296296
public final FormValidation verifySignatureInternal(JSONObject o) throws IOException {
297-
return getJsonSignatureValidator().verifySignature(o);
297+
FormValidation result = getJsonSignatureValidator(null).verifySignature(o);
298+
299+
if (result.kind == FormValidation.Kind.ERROR) {
300+
String message = result.getMessage();
301+
if (message != null) {
302+
// String siteUrl = getUrl();
303+
String updatedMessage;
304+
305+
if (message.contains("update site") && message.contains(" Path") && !message.contains(url)) {
306+
// Ensure the update site URL is included in error messages by replacing the site identifier in messages of the 'update site … Path' pattern or appending it otherwise.
307+
updatedMessage = message.replaceAll(
308+
"(update site\\s+).*?(\\s+Path)",
309+
"$1" + url + "$2"
310+
);
311+
} else {
312+
// Do not alter message structure; only add URL context
313+
updatedMessage = message + " (URL: " + url + ")";
314+
}
315+
return FormValidation.error(updatedMessage);
316+
}
317+
}
318+
319+
return result;
298320
}
299321

300322
/**

core/src/main/java/jenkins/util/JSONSignatureValidator.java

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package jenkins.util;
22

3+
import edu.umd.cs.findbugs.annotations.NonNull;
34
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
45
import hudson.Util;
56
import hudson.util.FormValidation;
@@ -138,7 +139,9 @@ public FormValidation verifySignature(JSONObject o) throws IOException {
138139
if (warning != null) return warning;
139140
return FormValidation.ok();
140141
} catch (GeneralSecurityException e) {
141-
return FormValidation.error(e, "Signature verification failed in " + name);
142+
// Return a user-friendly error message without the full stack trace
143+
String rootCauseMessage = getRootCauseMessage(e);
144+
return FormValidation.error("Signature verification failed in " + name + ": " + rootCauseMessage);
142145
}
143146
}
144147

@@ -321,5 +324,25 @@ protected Set<TrustAnchor> loadTrustAnchors(CertificateFactory cf) throws IOExce
321324
return anchors;
322325
}
323326

327+
/**
328+
* Extracts a user-friendly message from an exception chain.
329+
*
330+
* @param e the exception to extract the message from
331+
* @return a concise, readable error message
332+
*/
333+
private String getRootCauseMessage(@NonNull Throwable e) {
334+
Throwable cause = e;
335+
while (cause.getCause() != null && cause.getCause() != cause) {
336+
cause = cause.getCause();
337+
}
338+
339+
String message = cause.getMessage();
340+
if (message != null && !message.isEmpty()) {
341+
return message;
342+
}
343+
344+
return cause.getClass().getSimpleName();
345+
}
346+
324347
private static final Logger LOGGER = Logger.getLogger(JSONSignatureValidator.class.getName());
325348
}

core/src/site/site.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
</breadcrumbs>
1010
<head>
1111
<![CDATA[
12-
<script src="https://cdn.jsdelivr.net/npm/lit@3.3.1/polyfill-support.js"></script>
12+
<script src="https://cdn.jsdelivr.net/npm/lit@3.3.2/polyfill-support.js"></script>
1313
<script src="https://cdn.jsdelivr.net/npm/@webcomponents/webcomponentsjs@2.8.0/webcomponents-loader.js"></script>
1414
<script data="jio" src="https://cdn.jsdelivr.net/npm/@jenkinsci/jenkins-io-components/+esm" type="module"></script>
1515
<script data="jio" nomodule="" src="https://cdn.jsdelivr.net/npm/@jenkinsci/jenkins-io-components"></script>

test/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ THE SOFTWARE.
192192
<dependency>
193193
<groupId>org.jenkins-ci.main</groupId>
194194
<artifactId>jenkins-test-harness</artifactId>
195-
<version>2537.v48fd29a_7070d</version>
195+
<version>2538.vcca_5b_74c18a_2</version>
196196
<scope>test</scope>
197197
<exclusions>
198198
<exclusion>

test/src/test/java/hudson/model/UpdateSiteTest.java

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424

2525
package hudson.model;
2626

27+
import static org.hamcrest.MatcherAssert.assertThat;
28+
import static org.hamcrest.Matchers.containsString;
2729
import static org.junit.jupiter.api.Assertions.assertEquals;
2830
import static org.junit.jupiter.api.Assertions.assertFalse;
2931
import static org.junit.jupiter.api.Assertions.assertNotEquals;
@@ -299,4 +301,45 @@ private PluginWrapper buildPluginWrapper(String name, String wikiUrl) {
299301
new ArrayList<>()
300302
);
301303
}
304+
305+
@Test
306+
void signatureVerificationFailureIncludesUpdateSiteUrl() throws Exception {
307+
// Create an UpdateSite with an invalid/malformed signature that will trigger an error
308+
URL url = new URL(baseUrl, "/plugins/invalid-signature-update-center.json");
309+
UpdateSite site = new UpdateSite(UpdateCenter.ID_DEFAULT, url.toString());
310+
overrideUpdateSite(site);
311+
312+
FormValidation validation = site.updateDirectlyNow(true);
313+
314+
assertEquals(FormValidation.Kind.ERROR, validation.kind);
315+
316+
String message = validation.getMessage();
317+
assertNotNull(message);
318+
assertTrue(
319+
message.contains(url.toString()),
320+
"Signature verification error should include update site URL"
321+
);
322+
assertThat(message, containsString("Empty input"));
323+
}
324+
325+
@Test
326+
void signatureVerificationFailureIncludesUpdateSiteUrlWithoutPath() throws Exception {
327+
// Create an UpdateSite with an invalid/malformed signature that will trigger an error that involves Path
328+
URL url = new URL(baseUrl, "/plugins/invalid-signature-update-center-core-cm.json");
329+
UpdateSite site = new UpdateSite(UpdateCenter.ID_DEFAULT, url.toString());
330+
overrideUpdateSite(site);
331+
332+
FormValidation validation = site.updateDirectlyNow(true);
333+
334+
assertEquals(FormValidation.Kind.ERROR, validation.kind);
335+
336+
String message = validation.getMessage();
337+
assertNotNull(message);
338+
assertTrue(
339+
message.contains(url.toString()),
340+
"Signature verification error should include update site URL"
341+
);
342+
assertThat(message, containsString("Path does not chain with any of the trust anchors"));
343+
}
344+
302345
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"updateCenterVersion": 1,
3+
"core": {
4+
"name": "core",
5+
"version": "2.541",
6+
"url": "http://updates.jenkins.io/download/war/2.541/jenkins.war"
7+
},
8+
"plugins": {},
9+
"signature": {
10+
"correct_digest": "scNImoAz/AONJTUC+jwpX1ik1Mg=",
11+
"correct_digest512": "0442f8003c5b707bdd7f8f06c096d51c3da1ad5715946ad226a8e4c8ce85a71a4db1cf4f7bf9565220a7339a2103780ae75e85a08c18e9642165c9f296660e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iVE91w3QYrDahhHBBC3UPetfslEWSliTgckUFojfdX/67hR1921lgL2ITxGtOS4j+dO9ydUVAaY6McAU1kJVrljY9IwsLxMaENrAL7otXG2xKBBCskTNcrizODuyzIg7LHOOVX6/EIzTN+o9RZG4b5zxwQZq5NS4yldbPpXPZuXnezCWr8qndwK3pqbiwmvLiBcsFCrnz7e2ixiAs7c6ZY6srb5WScVywZeLHwhpISEBPZe4ejvWQRHaDanca15IKeqARJKL8H/Jti1aUHqrLkH92s8FWaEL25TrMXb5u2r15qpL6OCMP+5O2jEnVl0ajkkNb/BBqUPuPXsg5vo8tkuk7gylNrK0LSM/t49gdYGBE/Cp2GgvGwfhasM27Os+J1TnIs0Bqsl125CwWxa7aXql39JQ/t12ekAUZvgziTGY1LHO4V7YMWTdiBdr57LKudFpFJZGXsPMkupi8mtlCU=",
16+
"correct_signature512": "0403e57342c6610922a4ca1c647b075923baa9d38ba50a9b5eb3fd2cd4154febf60434d3d9dc2e15db536128191f69a0bafe119cba7b7d887b8b0d38ebac0855da7b6f958afe06a48362cee018159628852fa593e58e56aa8cf94c978f344e906db8559b69d72971b918322e7108a23fb124022b2f442f73f12e5a34af0385295954f7347da4ff0faf33db8c2dc1c1684551a0018c30fd2d39117717b092c42e20c6d78506d89d942d30c66295c5e04cfd655259e4a4a263a85a7b3a89377ae067279989a164ab46ae34edbed7f722f3c4f2bbd9d59412559eeaed03ef5e743602c54d0222d010ce0c010576a682b9979654e976aa418deb0de5069139031e04a61d26904e70bdca2168dc434f5955c6f39f6c6fe45b6014702b5afedfa2f89763f2e43fbb82d47858a1fd0bd04bea05a4f23d207d28c3246a99c2b2ac84a4fa16da292148074afd358728a2844ef985bf9a1479d6cf1bb1d7acc48c9731e2a9906f8beac110d91c851736bfd12508ae08c669d89a74a347a764b1f4be5fe01829ab0f80e6da5e2abafeb045a50b066ec3d6a6a95254fdc57e898eaf91b48d8585ef74b9ab1feecea2583c37be77d7c295c5918d492e01515b76877508d8af3bedddf1f2c56453ffa88505df9b2d8865e5a9970af0875cbfa596afe10326befbea4970cb2160b59cbff683b351d0a3b872039934cfff668dfe92c3f4d4abd262",
17+
"digest": "216DEgEmoe6+B+96+1RFOIKCqmY=",
18+
"signature": "X4RsFd2sxBMy2BaUeW64hvzP+VUg/nS0KSoKnCo26nt5G5qXvJ9TVb9ifMuLdFnk2kPMGOh/NZ5rfPFdVhLPRkcpg9saAXYcMYj4Nfg6gzlgBjsGzcmaQ6ky2q2qTIEXGZcjKTql99uap9hMXKaXDdgcfVE22mV92dvASazz1KX3fM37sticmC6eJF+Fj1OFx2BPjzPaNKZyXuwqMe7X3SG70fY0bbcc6TfOXSHWOI3WS0T7N13Br0cD/kx+r8sKDv73kkx/anI0VxxaGXcttZ9M9q/ubqRDju6dLubXP+5rTzQmphpwwUPz4t4mv0Acp8/E35Rp5SELn45cUJTyb2anxPOVB84gKBaeN9G+fitEmQkEt2jLnidcKTbNfgPUXWAkUnCuPbl7W7zeRQ4dnEQoCfkswS3Q5qoE8R0d76G//R8p6oeQZL9akV4NHV9E22iu0l+eA8GTrX50TEApF1+iil/Y4CeHWyALBn/FYARig2L3W040O9GOPoBGpZ5qTFxA55es4h69ij84nt+uANJzypzRFV7DmhL97UKm4XV7ADB+UQ90pXvAoih510O0p1/67xdZcKx5URhmj53xOAn8WbvATzeu8/MqNnglmTcX+VKInVWjai4gtOg2UmaijUCt0CuCcLNyWpClk51p0Kfr7gYb4UKJuWSIfVzHaPY="
19+
}
20+
}

0 commit comments

Comments
 (0)