Skip to content

Commit

Permalink
feat: Deprecate OpenSSL signing
Browse files Browse the repository at this point in the history
Closes #878.
  • Loading branch information
theofidry committed Oct 21, 2023
1 parent b7472c2 commit f170cd1
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 4 deletions.
7 changes: 7 additions & 0 deletions src/Configuration/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -2292,6 +2292,13 @@ private static function retrieveSigningAlgorithm(stdClass $raw, ConfigurationLog
self::addRecommendationForDefaultValue($logger, self::ALGORITHM_KEY);
}

if (Phar::OPENSSL === $algorithm) {
$logger->addWarning(
'Using an OpenSSL signature is deprecated and will be removed in 5.0.0. Please check '
.'https://github.com/box-project/box/blob/main/doc/phar-signing.md for alternatives.',
);
}

return $algorithm;
}

Expand Down
28 changes: 24 additions & 4 deletions tests/Configuration/ConfigurationSigningTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,12 @@ public function test_the_key_can_be_configured(): void
self::assertFalse($this->config->promptForPrivateKey());

self::assertSame([], $this->config->getRecommendations());
self::assertSame([], $this->config->getWarnings());
self::assertSame(
[
'Using an OpenSSL signature is deprecated and will be removed in 5.0.0. Please check https://github.com/box-project/box/blob/main/doc/phar-signing.md for alternatives.',
],
$this->config->getWarnings(),
);
}

public function test_the_key_pass_can_be_configured(): void
Expand All @@ -263,7 +268,12 @@ public function test_the_key_pass_can_be_configured(): void
self::assertTrue($this->config->promptForPrivateKey());

self::assertSame([], $this->config->getRecommendations());
self::assertSame([], $this->config->getWarnings());
self::assertSame(
[
'Using an OpenSSL signature is deprecated and will be removed in 5.0.0. Please check https://github.com/box-project/box/blob/main/doc/phar-signing.md for alternatives.',
],
$this->config->getWarnings(),
);

foreach ([false, null] as $keyPass) {
$this->setConfig([
Expand All @@ -283,7 +293,12 @@ public function test_the_key_pass_can_be_configured(): void
);
}

self::assertSame([], $this->config->getWarnings());
self::assertSame(
[
'Using an OpenSSL signature is deprecated and will be removed in 5.0.0. Please check https://github.com/box-project/box/blob/main/doc/phar-signing.md for alternatives.',
],
$this->config->getWarnings(),
);
}

$this->setConfig([
Expand All @@ -297,7 +312,12 @@ public function test_the_key_pass_can_be_configured(): void
self::assertFalse($this->config->promptForPrivateKey());

self::assertSame([], $this->config->getRecommendations());
self::assertSame([], $this->config->getWarnings());
self::assertSame(
[
'Using an OpenSSL signature is deprecated and will be removed in 5.0.0. Please check https://github.com/box-project/box/blob/main/doc/phar-signing.md for alternatives.',
],
$this->config->getWarnings(),
);
}

public static function passFileFreeSigningAlgorithmProvider(): iterable
Expand Down

0 comments on commit f170cd1

Please sign in to comment.