Skip to content

Commit

Permalink
bug #26057 [SecurityBundle] use libsodium to run Argon2i related test…
Browse files Browse the repository at this point in the history
…s (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
  • Loading branch information
nicolas-grekas committed Feb 6, 2018
2 parents ae25291 + 5f9471e commit 717e1c3
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
8 changes: 8 additions & 0 deletions .travis.yml
Expand Up @@ -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
Expand Down
@@ -1,6 +1,6 @@
security:
encoders:
JMS\FooBundle\Entity\User6:
JMS\FooBundle\Entity\User7:
algorithm: argon2i

providers:
Expand Down
Expand Up @@ -86,7 +86,7 @@ public function testEncodePasswordArgon2i()
$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));
}
Expand Down Expand Up @@ -272,7 +272,7 @@ protected function tearDown()
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);
Expand Down

0 comments on commit 717e1c3

Please sign in to comment.