nextcloud/lib/private/Security
Anna Larch c0b57cd298 fix(security): don't propagate ValueError from Crypto::decrypt() fallback
When decrypting a v3 ciphertext with a mismatched secret, the first
attempt throws an Exception (HMAC mismatch). The fallback then calls
decryptWithoutSecret() with an empty string, which causes hash_hkdf()
to throw a ValueError. Since ValueError extends \Error rather than
\Exception, it bypassed the catch block and propagated as an unhandled
error, crashing the whole request.

Wrap the fallback in its own try/catch(\Throwable) and rethrow the
original Exception so callers get a meaningful HMAC mismatch error.

Signed-off-by: Anna Larch <anna@nextcloud.com>
AI-Assisted-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-09 13:15:27 +00:00
..
Bruteforce chore: add missing Override attribute to OC 2026-04-28 21:29:27 +02:00
CSP chore: add missing Override attribute to OC 2026-04-28 21:29:27 +02:00
CSRF feat: Add generate session token to CsrfTokenManager 2026-05-12 18:24:12 +02:00
FeaturePolicy chore: Add SPDX header 2024-05-24 13:11:22 +02:00
IdentityProof feat: Add option to update the public key of a user 2025-11-19 10:51:43 +01:00
Ip chore: add missing Override attribute to OC 2026-04-28 21:29:27 +02:00
Normalizer refactor: Run rector on lib/private 2026-02-06 13:50:18 +01:00
RateLimiting chore: add missing Override attribute to OC 2026-04-28 21:29:27 +02:00
Signature chore: add missing Override attribute to OC 2026-04-28 21:29:27 +02:00
VerificationToken chore: add missing Override attribute to OC 2026-04-28 21:29:27 +02:00
Certificate.php chore: add missing Override attribute to OC 2026-04-28 21:29:27 +02:00
CertificateManager.php refactor: use strict operator 2026-04-30 00:51:29 +02:00
CredentialsManager.php chore: add missing Override attribute to OC 2026-04-28 21:29:27 +02:00
Crypto.php fix(security): don't propagate ValueError from Crypto::decrypt() fallback 2026-06-09 13:15:27 +00:00
Hasher.php fix: also respect max value for hashingThreads 2026-05-20 11:51:29 +00:00
RemoteHostValidator.php chore: add missing Override attribute to OC 2026-04-28 21:29:27 +02:00
SecureRandom.php chore: add missing Override attribute to OC 2026-04-28 21:29:27 +02:00
TrustedDomainHelper.php chore: add missing Override attribute to OC 2026-04-28 21:29:27 +02:00