Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Deprecate OpenSSL signing #1100

Merged
merged 2 commits into from
Oct 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
9 changes: 6 additions & 3 deletions tests/Console/Command/CompileTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,8 @@ public function test_it_can_build_a_phar_file(): void
* Done.

No recommendation found.
No warning found.
⚠️ <warning>1 warning found:</warning>
- 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.

// PHAR: {$numberOfFiles} files (100B)
// You can inspect the generated PHAR with the "info" command.
Expand Down Expand Up @@ -897,7 +898,8 @@ public function test_it_can_build_a_phar_file_in_verbose_mode(): void
* Done.

No recommendation found.
No warning found.
⚠️ <warning>1 warning found:</warning>
- 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.

// PHAR: {$expectedNumberOfFiles} files (100B)
// You can inspect the generated PHAR with the "info" command.
Expand Down Expand Up @@ -1026,7 +1028,8 @@ public function test_it_can_build_a_phar_file_in_very_verbose_mode(): void
* Done.

No recommendation found.
No warning found.
⚠️ <warning>1 warning found:</warning>
- 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.

// PHAR: {$expectedNumberOfFiles} files (100B)
// You can inspect the generated PHAR with the "info" command.
Expand Down