mirror of https://github.com/MISP/MISP
fix: [attributes:validation] Allow telfhash to be either 70 or 72 chars long
parent
f79221abc8
commit
ec07c3eb7c
|
@ -224,7 +224,6 @@ class AttributeValidationTool
|
||||||
switch ($type) {
|
switch ($type) {
|
||||||
case 'md5':
|
case 'md5':
|
||||||
case 'imphash':
|
case 'imphash':
|
||||||
case 'telfhash':
|
|
||||||
case 'sha1':
|
case 'sha1':
|
||||||
case 'sha224':
|
case 'sha224':
|
||||||
case 'sha256':
|
case 'sha256':
|
||||||
|
@ -255,6 +254,11 @@ class AttributeValidationTool
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return __('Checksum has an invalid length or format (expected: at least 35 hexadecimal characters, optionally starting with t1 instead of hexadecimal characters). Please double check the value or select type "other".');
|
return __('Checksum has an invalid length or format (expected: at least 35 hexadecimal characters, optionally starting with t1 instead of hexadecimal characters). Please double check the value or select type "other".');
|
||||||
|
case 'telfhash':
|
||||||
|
if (self::isTelfhashValid($value)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return __('Checksum has an invalid length or format (expected: %s or %s hexadecimal characters). Please double check the value or select type "other".', 70, 72);
|
||||||
case 'pehash':
|
case 'pehash':
|
||||||
if (self::isHashValid('pehash', $value)) {
|
if (self::isHashValid('pehash', $value)) {
|
||||||
return true;
|
return true;
|
||||||
|
@ -635,6 +639,15 @@ class AttributeValidationTool
|
||||||
return strlen($value) > 35 && ctype_xdigit($value);
|
return strlen($value) > 35 && ctype_xdigit($value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $value
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
private static function isTelfhashValid($value)
|
||||||
|
{
|
||||||
|
return strlen($value) == 70 || strlen($value) == 72;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $type
|
* @param string $type
|
||||||
|
|
Loading…
Reference in New Issue