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

   @papegaaij, a question about the underlying weakness on 10.x: should we 
implement the proposal below?
   
   The flaky test is being fixed separately, test-only, on wicket-10.x (and on 
9.x if a license cleanup release is cut). That fix doesn't touch the cause. On 
10.x, `CryptoMapper`, the page store and the remember-me cookie still default 
to unauthenticated encryption (PBEWithMD5AndDES, DES-CBC). A wrong key or a 
tampered ciphertext can therefore decrypt to garbage instead of failing cleanly.
   
   ### Why the 11.x fix (WICKET-7190) can't be backported as is
   
   - **It breaks the API.** It removes `SunJceCrypt`, `AbstractCrypt`, 
`TrivialCrypt`, `KeyInSessionSunJceCryptFactory`, `ICrypter`, `DefaultCrypter` 
and `GCMSIVCrypter`, and it moves `ICrypt` and `ICryptFactory` from 
`org.apache.wicket.util.crypt` to `org.apache.wicket.core.util.crypt` with 
different methods. japicmp fails 10.x on that.
   - **It's a clean break for data.** Data encrypted by 10.x can't be decrypted 
by 11.x. Changing the default in a 10.x release would log out remember-me 
users, invalidate bookmarked encrypted URLs and make existing encrypted 
page-store entries unreadable.
   - **It needed CryptoMapper changes.** AES-GCM uses a random nonce, while the 
10.x `CryptoMapper` relies on deterministic encryption: a URL generated again 
in the same request must match the requested URL, or URL normalisation 
redirects endlessly. 11.x needed CryptoMapper changes and a deterministic entry 
point (`encryptUrlSafeDeterministic`) for this.
   
   ### Proposal: an additive, opt-in authenticated crypt for 10.x
   
   - **A new crypt class.** Add an authenticated implementation of the existing 
10.x `org.apache.wicket.util.crypt.ICrypt`. It must encrypt deterministically 
for URL use, so either AES-GCM-SIV (Bouncy Castle, optional dependency) or a 
SIV-style construction.
   - **A matching factory.** Add a key-in-session factory for it that 
applications opt into with `SecuritySettings.setCryptFactory(...)`.
   - **No removals and no default change.** Leave the existing classes and the 
PBEWithMD5AndDES default as they are. That keeps japicmp green, and nobody's 
encrypted data breaks on upgrade.
   - **Documentation.** Document the option on `SunJceCrypt` and in the user 
guide as the way to get authenticated URL encryption on 10.x without moving to 
11.
   
   The trade-off is a new crypto class to maintain on an LTS line, while the 
weakness is already documented on `SunJceCrypt` and 11.x is the supported way 
out. The page store (`DefaultCrypter`, AES-CBC) would need a similar opt-in if 
we want to cover it too.
   


-- 
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