From: Patrick Canterino Date: Wed, 12 Aug 2026 11:25:44 +0000 (+0200) Subject: Merge branch 'next-release' into 'next-release' X-Git-Tag: 4.8.0~17 X-Git-Url: https://git.p6c8.net/jirafeau/jirafeau.git/commitdiff_plain/f163f30e032ceb21fec3f4f37360ccc8975696a5?ds=sidebyside;hp=-c Merge branch 'next-release' into 'next-release' Promoting MR 35 to Next-Rrelease Except the Password Hashing that is Already Implemented See merge request jirafeau/Jirafeau!37 --- f163f30e032ceb21fec3f4f37360ccc8975696a5 diff --combined f.php index 870b4bd,b13e03b..3523596 --- a/f.php +++ b/f.php @@@ -36,7 -36,7 +36,7 @@@ if (!isset($_GET['h']) || empty($_GET[' $link_name = $_GET['h']; - if (!preg_match('/[0-9a-zA-Z_-]+$/', $link_name)) { + if (!preg_match('/^[0-9a-zA-Z_-]+$/', $link_name)) { require(JIRAFEAU_ROOT.'lib/template/header.php'); echo '

' . t('FILE_404') . '

'; require(JIRAFEAU_ROOT.'lib/template/footer.php'); @@@ -82,7 -82,7 +82,7 @@@ if (!file_exists(VAR_FILES . $p . $link exit; } - if (!empty($delete_code) && $delete_code == $link['link_code']) { + if (!empty($delete_code) && hash_equals((string) $link['link_code'], (string) $delete_code)) { require(JIRAFEAU_ROOT.'lib/template/header.php'); if (isset($_POST['do_delete'])) { jirafeau_delete_link($link_name); @@@ -171,9 -171,7 +171,9 @@@ if (!empty($link['key'])) require(JIRAFEAU_ROOT.'lib/template/footer.php'); exit; } else { - if (hash_equals($link['key'], md5($_POST['key']))) { + if (strpos($link['key'], '[SHA256]') == 0 && hash_equals(substr($link['key'], 8), hash('sha256', $_POST['key']))) { + $password_challenged = true; + } elseif (hash_equals($link['key'], md5($_POST['key']))) { $password_challenged = true; } else { sleep(2); diff --combined index.php index 82b3c8c,74c68a0..d60cb18 --- a/index.php +++ b/index.php @@@ -156,16 -156,14 +156,16 @@@ if ($cfg['download_password_requirement echo ''; } else { echo ''; - echo ''; + echo ' /> '; + echo ''; }?> @@@ -208,20 -206,6 +208,20 @@@ if ($cfg['maximal_upload_size'] >= 1024 diff --combined script.php index 301ebe8,cc37c41..2fc297f --- a/script.php +++ b/script.php @@@ -163,7 -163,7 +163,7 @@@ if (isset($_FILES['file']) && is_writab $d = $_GET['d']; } - if (!preg_match('/[0-9a-zA-Z_-]+$/', $link_name)) { + if (!preg_match('/^[0-9a-zA-Z_-]+$/', $link_name)) { echo 'Error 7'; exit; } @@@ -183,7 -183,7 +183,7 @@@ echo 'Error 9'; exit; } - if (strlen($link['key']) > 0 && md5($key) != $link['key']) { + if (strlen($link['key']) > 0 && hash('sha256', $key) != $link['key']) { sleep(2); echo 'Error 10'; exit;