Review fixes: the derived key is wiped also when a key is damaged, each tidy-up step after a removal on its own
CI / unit (8.2) (push) Has been cancelled
CI / unit (8.3) (push) Has been cancelled
CI / unit (8.4) (push) Has been cancelled
CI / psalm (push) Has been cancelled
CI / frontend (push) Has been cancelled
CI / integration (mariadb, 32) (push) Has been cancelled
CI / integration (mariadb, 33) (push) Has been cancelled
CI / integration (mariadb, 34) (push) Has been cancelled
CI / integration (mariadb, 35) (push) Has been cancelled
CI / integration (pgsql, 32) (push) Has been cancelled
CI / integration (pgsql, 33) (push) Has been cancelled
CI / integration (pgsql, 34) (push) Has been cancelled
CI / integration (pgsql, 35) (push) Has been cancelled
CI / integration (sqlite, 32) (push) Has been cancelled
CI / integration (sqlite, 33) (push) Has been cancelled
CI / integration (sqlite, 34) (push) Has been cancelled
CI / integration (sqlite, 35) (push) Has been cancelled
CI / integration-targets (push) Has been cancelled
CI / integration-user (32) (push) Has been cancelled
CI / integration-user (33) (push) Has been cancelled
CI / integration-user (34) (push) Has been cancelled
CI / integration-user (35) (push) Has been cancelled
CI / integration-full-restore (push) Has been cancelled

- The key derived from the passphrase is wiped on every path, also when the key or nonce turns out damaged
- After a removal the pending flag and the cached index are tidied up independently; a failing log cannot stop the removal event
- Tests: a short salt or nonce gives the damaged-key error
This commit is contained in:
2026-11-09 02:33:50 +01:00
parent fb8e8d0694
commit 2a72acb70b
3 changed files with 39 additions and 8 deletions
+13
View File
@@ -30,6 +30,19 @@ class KeyRingTest extends TestCase {
KeyRing::unwrapAny($wrapped, 'right');
}
public function testAShortSaltOrNonceIsADamagedKey(): void {
foreach (['salt', 'nonce'] as $part) {
$wrapped = KeyRing::generate()->wrap('right');
$wrapped[$part] = base64_encode('short');
try {
KeyRing::unwrapAny($wrapped, 'right');
$this->fail("a short $part was accepted");
} catch (CryptoException $e) {
$this->assertStringContainsString('Damaged key file', $e->getMessage(), $part);
}
}
}
public function testBlobIdsAreKeyed(): void {
$this->assertNotSame(KeyRing::generate()->blobId('same'), KeyRing::generate()->blobId('same'));
$k = KeyRing::generate();