bug #26057 [SecurityBundle] use libsodium to run Argon2i related tests (xabbuh)
This PR was merged into the 3.4 branch.
Discussion
----------
[SecurityBundle] use libsodium to run Argon2i related tests
| Q | A
| ------------- | ---
| Branch? | 3.4
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #26038
| License | MIT
| Doc PR |
Commits
-------
5f9471e
use libsodium to run Argon2i related tests
This commit is contained in:
commit
717e1c3c08
@ -149,7 +149,15 @@ before_install:
|
||||
([[ $deps ]] || tfold ext.symfony_debug 'cd src/Symfony/Component/Debug/Resources/ext && phpize && ./configure && make && echo extension = $(pwd)/modules/symfony_debug.so >> '"$INI")
|
||||
tfold ext.apcu tpecl apcu-4.0.11 apcu.so
|
||||
elif [[ ! $skip && $PHP = 7.* ]]; then
|
||||
# install libsodium
|
||||
if [[ ! -e ~/php-ext/$(php -r "echo basename(ini_get('extension_dir'));")/libsodium/sodium.so ]]; then
|
||||
sudo add-apt-repository ppa:ondrej/php -y
|
||||
sudo apt-get update -q
|
||||
sudo apt-get install libsodium-dev -y
|
||||
fi
|
||||
|
||||
tfold ext.apcu tpecl apcu-5.1.6 apcu.so
|
||||
tfold ext.libsodium tpecl libsodium sodium.so
|
||||
tfold ext.mongodb tpecl mongodb-1.4.0RC1 mongodb.so
|
||||
fi
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
security:
|
||||
encoders:
|
||||
JMS\FooBundle\Entity\User6:
|
||||
JMS\FooBundle\Entity\User7:
|
||||
algorithm: argon2i
|
||||
|
||||
providers:
|
||||
|
@ -86,7 +86,7 @@ class UserPasswordEncoderCommandTest extends WebTestCase
|
||||
$this->assertContains('Password encoding succeeded', $output);
|
||||
|
||||
$encoder = new Argon2iPasswordEncoder();
|
||||
preg_match('# Encoded password\s+(\$argon2i\$[\w\d,=\$+\/]+={0,2})\s+#', $output, $matches);
|
||||
preg_match('# Encoded password\s+(\$argon2id\$[\w\d,=\$+\/]+={0,2})\s+#', $output, $matches);
|
||||
$hash = $matches[1];
|
||||
$this->assertTrue($encoder->isPasswordValid($hash, 'password', null));
|
||||
}
|
||||
@ -272,7 +272,7 @@ EOTXT
|
||||
private function setupArgon2i()
|
||||
{
|
||||
putenv('COLUMNS='.(119 + strlen(PHP_EOL)));
|
||||
$kernel = $this->createKernel(array('test_case' => 'PasswordEncode', 'root_config' => 'argon2i'));
|
||||
$kernel = $this->createKernel(array('test_case' => 'PasswordEncode', 'root_config' => 'argon2i.yml'));
|
||||
$kernel->boot();
|
||||
|
||||
$application = new Application($kernel);
|
||||
|
Reference in New Issue
Block a user