-
Notifications
You must be signed in to change notification settings - Fork 89
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Deprecate the default signed cookie algorithm
Deprecate the default value for the `signed_cookie.hash_algo` configuration value (currently "sha256") in preparation for a change in 4.0.
- Loading branch information
Showing
3 changed files
with
28 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,10 +22,13 @@ | |
use Nelmio\SecurityBundle\ExternalRedirect\AllowListBasedTargetValidator; | ||
use Nelmio\SecurityBundle\Signer; | ||
use PHPUnit\Framework\TestCase; | ||
use Symfony\Bridge\PhpUnit\ExpectDeprecationTrait; | ||
use Symfony\Component\DependencyInjection\ContainerBuilder; | ||
|
||
final class NelmioSecurityExtensionTest extends TestCase | ||
{ | ||
use ExpectDeprecationTrait; | ||
|
||
private NelmioSecurityExtension $extension; | ||
|
||
protected function setUp(): void | ||
|
@@ -54,6 +57,23 @@ public function testLoadSignedCookie(): void | |
$this->assertServiceIdClass($container, 'nelmio_security.signer', Signer::class); | ||
} | ||
|
||
/** | ||
* @group legacy | ||
*/ | ||
public function testDeprecatedSignedCookieDefaultAlgorithm(): void | ||
{ | ||
$this->expectDeprecation('Since nelmio/security-bundle 3.4.0: The default value for `signed_cookie.hash_algo` is deprecated and will change in 4.0. You should configure an algorithm explicitly.'); | ||
Check failure on line 65 in tests/DependencyInjection/NelmioSecurityExtensionTest.php
|
||
|
||
$container = new ContainerBuilder(); | ||
$this->extension->load([ | ||
[ | ||
'signed_cookie' => [], | ||
], | ||
], $container); | ||
|
||
$this->assertContainerWithParameterValue($container, 'nelmio_security.signer.hash_algo', 'sha256'); | ||
} | ||
|
||
public function testLoadClickJacking(): void | ||
{ | ||
$container = new ContainerBuilder(); | ||
|