Skip to content

Commit 8190efc

Browse files
authored
fix: php-tuf#396 Update RollbackAttackException message (php-tuf#405)
1 parent b03a7bc commit 8190efc

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

src/Metadata/Verifier/RootVerifier.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ protected function checkRollbackAttack(MetadataBase $untrustedMetadata): void
3333
$expectedUntrustedVersion = $this->trustedMetadata->version + 1;
3434
$untrustedVersion = $untrustedMetadata->version;
3535
if ($expectedUntrustedVersion && ($untrustedMetadata->version !== $expectedUntrustedVersion)) {
36-
throw new RollbackAttackException("Remote 'root' metadata version \"$$untrustedVersion\" " .
37-
"does not the expected version \"$$expectedUntrustedVersion\"");
36+
throw new RollbackAttackException("Remote 'root' metadata version \"{$untrustedVersion}\" " .
37+
"does not match the expected version \"{$expectedUntrustedVersion}\"");
3838
}
3939
parent::checkRollbackAttack($untrustedMetadata);
4040
}

tests/Unit/Client/VerifierTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ public function verify(MetadataBase $untrustedMetadata): void
120120
public function testCheckRollbackAttackAttackExpectedVersion(): void
121121
{
122122
$this->expectException('\Tuf\Exception\Attack\RollbackAttackException');
123-
$this->expectExceptionMessage('Remote \'root\' metadata version "$2" does not the expected version "$3"');
123+
$this->expectExceptionMessage('Remote \'root\' metadata version "2" does not match the expected version "3"');
124124

125125
// The incoming version is lower than the local version, so this should
126126
// be identified as a rollback attack.

0 commit comments

Comments
 (0)