mirror of
https://github.com/PrivateBin/PrivateBin.git
synced 2025-09-17 03:04:41 -04:00
finishing changes in models, removing last md5 test cases, tightening up allowed POST data
This commit is contained in:
parent
06b90ff48e
commit
76dc01b959
7 changed files with 236 additions and 339 deletions
|
@ -32,10 +32,12 @@ class FormatV2
|
|||
*/
|
||||
public static function isValid($message, $isComment = false)
|
||||
{
|
||||
$required_keys = array('adata', 'meta', 'v', 'ct');
|
||||
$required_keys = array('adata', 'v', 'ct');
|
||||
if ($isComment) {
|
||||
$required_keys[] = 'pasteid';
|
||||
$required_keys[] = 'parentid';
|
||||
} else {
|
||||
$required_keys[] = 'meta';
|
||||
}
|
||||
|
||||
// Make sure no additionnal keys were added.
|
||||
|
@ -109,6 +111,15 @@ class FormatV2
|
|||
return false;
|
||||
}
|
||||
|
||||
// require only the key 'expire' in the metadata of pastes
|
||||
if (!$isComment && (
|
||||
count($message['meta']) === 0 ||
|
||||
!array_key_exists('expire', $message['meta']) ||
|
||||
count($message['meta']) > 1
|
||||
)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue