dashorst commented on issue #1923:
URL: https://github.com/apache/wicket/issues/1923#issuecomment-6892033424

   The failure is a nondeterministic test on the SunJceCrypt-based lines (10.x, 
9.x). It is not caused by the build-helper bump, the Java 25 runner or the CI 
setup. The rerun of run 43666967893 (attempt 2) passed on all three JDKs.
   
   ### Cause
   
   `pageInstanceDecryptMultipleCryptoMapper` wraps the test's fixed-key mapper 
in a second `new CryptoMapper(mapper, tester.getApplication())`. On 10.x that 
outer mapper uses the application's default `KeyInSessionSunJceCryptFactory`, 
which creates a random key and salt per session, so every test run has a 
different outer key.
   
   The outer mapper first tries to decrypt a URL that the inner mapper 
encrypted with a different key. The cipher is PBEWithMD5AndDES: DES in CBC mode 
without an integrity check. A wrong key normally fails the PKCS#5 padding 
check, `decryptUrlSafe` returns `null`, and the URL is passed through 
unchanged. In about 1 in 256 runs, though, the garbage plaintext happens to end 
in valid padding. `AbstractCrypt.decryptUrlSafe` then turns the bytes into a 
string (this never throws), the outer mapper hands that garbage URL to the 
inner mapper, the inner mapper can't map it, and the test receives `null`.
   
   ### Reproduction
   
   - wicket-10.x, Java 25: the unmodified test repeated 2000 times 
(`@RepeatedTest`) failed 7 times, all with `expected: not <null>`. That is 
0.35%, against a predicted ~0.39%.
   - wicket-10.x, Java 17: also 7 failures in 2000, so the JDK makes no 
difference.
   - master: 0 failures in 5000 runs. Since WICKET-7190, master and 11.x 
default to an AES-GCM `KeyInSessionCryptFactory`, and a wrong key always fails 
the GCM authentication tag.
   
   ### CI history
   
   I searched the failed-job logs of the failed Java CI runs since June 2026. 
Every CryptoMapper failure is one of the three "multiple CryptoMapper" tests in 
this class, and all of them are on code that still used SunJceCrypt:
   
   | Test | Run | Branch |
   |---|---|---|
   | `pageInstanceDecryptMultipleCryptoMapper` | 41733610238 | readme-10 |
   | `pageInstanceDecryptMultipleCryptoMapper` | 38346579647 | metric-fix (→ 
wicket-10.x) |
   | `mountedPageRequestListenerParameter`, second half | 43327674221 | 
email-pattern-1884-10.x |
   | `mountedPageRequestListenerParameter`, second half | 33307543434 | 
wicket-10.x |
   | `mountedPageRequestListenerParameter`, second half | 33307501356 | 
wicket-9.x |
   | `bookmarkablePageDecryptMultipleCryptoMapper` | 32071871314 | master 
(August, before the AES-GCM rework landed) |
   
   With three exposed tests in each of three JDK jobs, roughly 3–4% of 10.x 
workflow runs should fail on this. The fail-fast matrix only hides whether the 
cancelled jobs would have passed; it doesn't cause the failure.
   
   ### Effect on applications
   
   On 10.x, an application that stacks two CryptoMappers with different keys 
sends about 1 in 256 of the inner mapper's URLs to a 404. The same lack of 
integrity means a URL from an expired session key can decrypt to garbage 
instead of raising `PageExpiredException`. Removing this requires authenticated 
encryption, which is the WICKET-7190 rework already on 11.x and master. That is 
too large for a maintenance line.
   
   ### Fix
   
   master and 11.x need no change. For 10.x the fix belongs in the test only: 
give the outer mapper in the three tests a fixed second `SunJceCrypt` key (`new 
CryptoMapper(mapper, () -> otherCrypt)`), so each run gives the same result. 
9.x is end of life, but the same change should be cherry-picked there if a 
license cleanup release is cut.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to