__ __ __ __ _____ _ _ _____ _ _ _ | \/ | \ \ / / | __ \ (_) | | / ____| | | | | | \ / |_ __\ V / | |__) | __ ___ ____ _| |_ ___ | (___ | |__ ___| | | | |\/| | '__|> < | ___/ '__| \ \ / / _` | __/ _ \ \___ \| '_ \ / _ \ | | | | | | |_ / . \ | | | | | |\ V / (_| | || __/ ____) | | | | __/ | | |_| |_|_(_)_/ \_\ |_| |_| |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1 if you need WebShell for Seo everyday contact me on Telegram Telegram Address : @jackleetFor_More_Tools:
<?php
namespace Tuf\Tests\Client;
use Tuf\Exception\Attack\RollbackAttackException;
use Tuf\Tests\ClientTestBase;
use Tuf\Tests\TestHelpers\DurableStorage\TestStorage;
/**
* Tests that server-side rollback attacks are detected.
*/
class RollbackAttackTest extends ClientTestBase
{
/**
* {@inheritdoc}
*/
protected function setUp(): void
{
parent::setUp();
// Always throw an exception if writing to client storage.
$this->clientStorage = new class () extends TestStorage {
/**
* {@inheritDoc}
*/
public function write(string $name, string $data): void
{
throw new \LogicException("Unexpected attempt to change client storage.");
}
/**
* {@inheritDoc}
*/
public function delete(string $name): void
{
throw new \LogicException("Unexpected attempt to change client storage.");
}
};
}
/**
* @testWith ["consistent"]
* ["inconsistent"]
*/
public function testRollbackAttackDetection(string $fixtureVariant): void
{
$this->loadClientAndServerFilesFromFixture("AttackRollback/$fixtureVariant");
try {
// § 5.4.3
// § 5.4.4
$this->getUpdater()->refresh();
$this->fail('No exception thrown.');
} catch (RollbackAttackException $exception) {
$this->assertSame('Remote timestamp metadata version "$1" is less than previously seen timestamp version "$2"', $exception->getMessage());
$this->assertMetadataVersions([
'root' => 2,
'timestamp' => 2,
'snapshot' => 2,
'targets' => 2,
], $this->clientStorage);
}
}
}
| Name | Type | Size | Permission | Actions |
|---|---|---|---|---|
| ConsistentFixturesUpdaterTest.php | File | 5.79 KB | 0664 |
|
| HashedBinsTest.php | File | 822 B | 0664 |
|
| InconsistentFixturesUpdaterTest.php | File | 4.3 KB | 0664 |
|
| InvalidRefreshTest.php | File | 1.27 KB | 0664 |
|
| RoleDownloadLimitTest.php | File | 1.46 KB | 0664 |
|
| RollbackAttackTest.php | File | 1.82 KB | 0664 |
|
| SnapshotHashesTest.php | File | 1.3 KB | 0664 |
|
| TestLoader.php | File | 1.95 KB | 0664 |
|
| UnchangedTimestampTest.php | File | 972 B | 0664 |
|
| UpdaterTest.php | File | 40.51 KB | 0664 |
|
| VerifiedDownloadTest.php | File | 2.23 KB | 0664 |
|