Force field validation to use sha1

When using blowfish as your application's hashing strategy, form field
validation would fail horribly.  Forcing sha1 fixes this and restores
behavior consistent with 2.2.x

Fixes #3280
This commit is contained in:
mark_story 2012-10-18 21:26:26 -04:00
parent 1cc82ff39f
commit f457f07b5c
2 changed files with 2 additions and 2 deletions

View file

@ -493,7 +493,7 @@ class SecurityComponent extends Component {
$fieldList += $lockedFields; $fieldList += $lockedFields;
$unlocked = implode('|', $unlocked); $unlocked = implode('|', $unlocked);
$check = Security::hash(serialize($fieldList) . $unlocked . Configure::read('Security.salt')); $check = Security::hash(serialize($fieldList) . $unlocked . Configure::read('Security.salt'), 'sha1');
return ($token === $check); return ($token === $check);
} }

View file

@ -538,7 +538,7 @@ class FormHelper extends AppHelper {
$locked = implode(array_keys($locked), '|'); $locked = implode(array_keys($locked), '|');
$unlocked = implode($unlockedFields, '|'); $unlocked = implode($unlockedFields, '|');
$fields = Security::hash(serialize($fields) . $unlocked . Configure::read('Security.salt')); $fields = Security::hash(serialize($fields) . $unlocked . Configure::read('Security.salt'), 'sha1');
$out = $this->hidden('_Token.fields', array( $out = $this->hidden('_Token.fields', array(
'value' => urlencode($fields . ':' . $locked), 'value' => urlencode($fields . ':' . $locked),