Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions core/ormdocument.class.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -362,8 +362,7 @@ public static function DownloadDocument(WebPage $oPage, $sClass, $id, $sAttCode,
throw new Exception("Invalid id ($id) for class '$sClass' - the object does not exist or you are not allowed to view it");
}
}
if (($sSecretField != null) && ($oObj->Get($sSecretField) != $sSecretValue)) {
usleep(200);
if (($sSecretField != null) && !hash_equals($oObj->Get($sSecretField), $sSecretValue)) {
throw new Exception("Invalid secret for class '$sClass' - the object does not exist or you are not allowed to view it");
}
/** @var \ormDocument $oDocument */
Expand Down
4 changes: 2 additions & 2 deletions pages/ajax.render.php
Original file line number Diff line number Diff line change
Expand Up @@ -2136,7 +2136,7 @@ function(data){
$oAttachment->Set('item_class', $sObjClass);
$oAttachment->SetDefaultOrgId();
$oAttachment->Set('contents', $oDoc);
$oAttachment->Set('secret', sprintf('%06x', mt_rand(0, 0xFFFFFF))); // something not easy to guess
$oAttachment->Set('secret', bin2hex(random_bytes(16))); // 128 bits of entropy, cryptographically secure
$iAttId = $oAttachment->DBInsert();

$aResult['uploaded'] = 1;
Expand Down Expand Up @@ -2194,7 +2194,7 @@ function(data){
$oAttachment->Set('item_class', $sObjClass);
$oAttachment->SetDefaultOrgId();
$oAttachment->Set('contents', $oDoc);
$oAttachment->Set('secret', sprintf('%06x', mt_rand(0, 0xFFFFFF))); // something not easy to guess
$oAttachment->Set('secret', bin2hex(random_bytes(16))); // 128 bits of entropy, cryptographically secure
$iAttId = $oAttachment->DBInsert();

IssueLog::Trace('InlineImage created', LogChannels::INLINE_IMAGE, [
Expand Down