8000 Don't allow true as algorithm config value · symfony/symfony@c2926d9 · GitHub
[go: up one dir, main page]

Skip to content

Commit c2926d9

Browse files
author
Jeroen van den Nieuwenhuisen
committed
Don't allow true as algorithm config value
1 parent 27de69a commit c2926d9

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/Symfony/Bundle/SecurityBundle/DependencyInjection/MainConfiguration.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,7 @@ private function addEncodersSection(ArrayNodeDefinition $rootNode)
399399
->performNoDeepMerging()
400400
->beforeNormalization()->ifString()->then(function ($v) { return ['algorithm' => $v]; })->end()
401401
->children()
402-
->scalarNode('algorithm')->cannotBeEmpty()->end()
402+
->scalarNode('algorithm')->cannotBeEmpty()->validate()->ifTrue()->thenInvalid('Invalid algorithm %s')->end()->end()
403403
->scalarNode('hash_algorithm')->info('Name of hashing algorithm for PBKDF2 (i.e. sha256, sha512, etc..) See hash_algos() for a list of supported algorithms.')->defaultValue('sha512')->end()
404404
->scalarNode('key_length')->defaultValue(40)->end()
405405
->booleanNode('ignore_case')->defaultFalse()->end()

src/Symfony/Component/Security/Core/Encoder/EncoderFactory.php

-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ private function getEncoderConfigFromAlgorithm($config)
8888
$config['algorithm'] = SodiumPasswordEncoder::isSupported() ? 'sodium' : 'native';
8989
}
9090

91-
switch ((string) $config['algorithm']) {
91+
switch ($config['algorithm']) {
9292
case 'plaintext':
9393
return [
9494
'class' => PlaintextPasswordEncoder::class,

0 commit comments

Comments
 (0)
0