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?hp=cb5f6b575e3ccc91f5d37f08f1814ce0a006b29f 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 --- diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 627ed17..613ab9b 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -3,10 +3,12 @@ cache: paths: - vendor/ -# Run tests for php:8.2 -job_lint_app_82: - image: php:8.2 - before_script: &before_linter_script +# Aliases and Anchors for reuse + +.linter_script: &linter_script + - ./vendor/bin/parallel-lint --gitlab --exclude vendor . + - ./vendor/bin/php-cs-fixer -vvv check . --using-cache=no --rules=@PSR12,-single_space_around_construct +.before_script: &before_linter_script # Install git, the docker php image doesn't have it installed by default - apt-get update -yqq - apt-get install git -yqq @@ -17,24 +19,63 @@ job_lint_app_82: - curl -sS https://getcomposer.org/installer | php # Create composer.json file manually, since this is a project without any non-dev dependencies yet - php composer.phar require --dev php-parallel-lint/php-parallel-lint - - php composer.phar require --dev friendsofphp/php-cs-fixer:3.64.0 + - php composer.phar require --dev friendsofphp/php-cs-fixer:3.93.1 # Install all project dependencies - php composer.phar install - script: &linter_script - - ./vendor/bin/parallel-lint --exclude vendor . - - ./vendor/bin/php-cs-fixer -vvv check . --using-cache=no --rules=@PSR12,-single_space_around_construct + +.enableWarningOnFailure: &linter_warning + allow_failure: + exit_codes: + - 1 + + +# Run tests for php:8.5 +job_lint_app_85: + image: php:8.5 + before_script: *before_linter_script + script: *linter_script + +# Run tests for php:8.4 +job_lint_app_84: + image: php:8.4 + before_script: *before_linter_script + script: *linter_script + +job_lint_app_83: + image: php:8.3 + before_script: *before_linter_script + script: *linter_script + +# Run tests for php:8.2 +job_lint_app_82: + image: php:8.2 + before_script: *before_linter_script + script: *linter_script + + +# ================= +# Deprecated ones START +# ================= # Run tests for php:8.1 job_lint_app_81: image: php:8.1 before_script: *before_linter_script script: *linter_script + <<: *linter_warning + + # Run tests for php:7.4 job_lint_app_74: image: php:7.4 before_script: *before_linter_script script: *linter_script + <<: *linter_warning + +# ================= +# Deprecated ones END +# ================= publish: image: docker:latest diff --git a/AUTHORS.md b/AUTHORS.md index 98e175b..9eaa5e5 100644 --- a/AUTHORS.md +++ b/AUTHORS.md @@ -104,6 +104,7 @@ This is a list of people who contributed to Jirafeau over the years. The list wa - Sven Dickert - Sylke Vicious - Szylu +- TehPeGaSuS - Thomas LEBEAU - Thomas Sontheimer - Tymofij Lytvynenko diff --git a/CHANGELOG.md b/CHANGELOG.md index c687514..a85065c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,9 +12,22 @@ 5. Follow the installation wizard, it should propose you the same data folder or even update automatically 6. Check your `/lib/config.local.php` and compare it with the `/lib/config.original.php` to see if new configuration items are available. If a new item is missing in your `config.local.php`, this may trigger some errors as Jirafeau may expect to have them. +## Version 4.7.x (not yet released) + +- ... + +## Version 4.7.2 + +- Added a button for showing the download password before uploading the file +- Favicon was missing in the `modern` theme +- Download passwords are now stored as SHA256 hashes +- Downloading encrypted files uploaded using "classic upload" (using just plain HTTP POST without the HTML5 file API) could not be downloaded. This was caused by not correctly marking the files as encrypted. +- Few more little fixes +- Upgrade from 4.7.1: in-place upgrade + ## Version 4.7.1 -- Fixed another possibility to bypass the checks for [CVE-2022-30110](https://www.cve.org/CVERecord?id=CVE-2022-30110), [CVE-2024-12326](https://www.cve.org/CVERecord?id=CVE-2024-12326) and [CVE-2025-7066](https://www.cve.org/CVERecord?id=CVE-2025-7066) (prevent preview of SVG images and other critical files) by sending a manipulated HTTP request with a MIME type like "image". When doing the preview, the browser tries to automatically detect the MIME type resulting in detecting SVG and possibly executing JavaScript code. To prevent this, MIME sniffing is disabled. +- Fixed another possibility to bypass the checks for [CVE-2022-30110](https://www.cve.org/CVERecord?id=CVE-2022-30110), [CVE-2024-12326](https://www.cve.org/CVERecord?id=CVE-2024-12326) and [CVE-2025-7066](https://www.cve.org/CVERecord?id=CVE-2025-7066) (prevent preview of SVG images and other critical files) by sending a manipulated HTTP request with a MIME type like "image". When doing the preview, the browser tries to automatically detect the MIME type resulting in detecting SVG and possibly executing JavaScript code. To prevent this, MIME sniffing is disabled. This issue has subsequently been reported as [CVE-2026-1466](https://www.cve.org/CVERecord?id=CVE-2026-1466). - The default value of `max_upload_chunk_size_bytes` was set to `5000000`. Higher values could trigger a bug Chromium-based browsers on servers with HTTP/3 enabled, causing asynchronous uploads to fail. - Docker image: Updated PHP to 8.3 and removed `mime-types.conf` from `lighttpd.conf` - Upgrade from 4.7.0: in-place upgrade, you also should set `max_upload_chunk_size_bytes` to `5000000` in your `config.local.php`! diff --git a/docker/docker_config.php b/docker/docker_config.php index 6037ec6..d814a8e 100644 --- a/docker/docker_config.php +++ b/docker/docker_config.php @@ -194,6 +194,7 @@ function run_setup(&$cfg) env_2_cfg_bool($cfg, 'one_time_download_preselected'); env_2_cfg_bool($cfg, 'enable_crypt'); env_2_cfg_bool($cfg, 'debug'); + env_2_cfg_bool($cfg, 'debug_enforce_classic_upload'); env_2_cfg_int($cfg, 'maximal_upload_size'); env_2_cfg_string_array($cfg, 'upload_password'); env_2_cfg_string_array($cfg, 'upload_ip'); diff --git a/f.php b/f.php index b13e03b..3523596 100644 --- a/f.php +++ b/f.php @@ -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 --git a/index.php b/index.php index 74c68a0..d60cb18 100644 --- a/index.php +++ b/index.php @@ -156,14 +156,16 @@ if ($cfg['download_password_requirement'] === 'generated') { echo ''; } else { echo ''; - echo ''; + echo ' /> '; + echo ''; }?> @@ -206,6 +208,20 @@ if ($cfg['maximal_upload_size'] >= 1024) { diff --git a/lib/config.original.php b/lib/config.original.php index 6b7c342..37c87eb 100644 --- a/lib/config.original.php +++ b/lib/config.original.php @@ -235,6 +235,10 @@ $cfg['installation_done'] = false; */ $cfg['debug'] = false; +/* Enable this debug flag to enforce the classic (synchronous) file upload mechanism. + */ +$cfg['debug_enforce_classic_upload'] = false; + /* Set Jirafeau's maximal upload chunk * When Jirafeau upload a large file, Jirafeau sends several data chunks to fit server's capabilities. * Jirafeau tries to upload each data chunk with the maximal size allowed by PHP (post_max_size and upload_max_filesize). diff --git a/lib/functions.js.php b/lib/functions.js.php index 29d50c1..cafecaf 100644 --- a/lib/functions.js.php +++ b/lib/functions.js.php @@ -430,9 +430,9 @@ function classic_upload (file, time, password, one_time) req.upload.addEventListener ("progress", upload_progress, false); req.addEventListener ("error", XHRErrorHandler, false); req.addEventListener ("abort", XHRErrorHandler, false); - req.onreadystatechange = function () + req.onload = function () { - if (req.readyState == 4 && req.status == 200) + if (req.status === 200) { var res = req.responseText; @@ -479,6 +479,13 @@ function classic_upload (file, time, password, one_time) function check_html5_file_api () { + + // Enforce classic upload is enabled through config! + return false; + return window.File && window.FileReader && window.FileList && window.Blob; } diff --git a/lib/functions.php b/lib/functions.php index 84bcea8..6c8d56d 100644 --- a/lib/functions.php +++ b/lib/functions.php @@ -464,9 +464,9 @@ function jirafeau_handle_add_file_encryption($crypt_module_enabled, $file_path) error_log("PHP extension sodium not loaded, won't encrypt in Jirafeau"); } if ($crypt_module_enabled == true && extension_loaded('sodium') == true) { - $crypt_key = jirafeau_encrypt_file($file_path, $file_path.'crypt'); + $crypt_key = jirafeau_encrypt_file($file_path, $file_path.'.crypt'); if (strlen($crypt_key) > 0) { - if (rename($file_path.'crypt', $file_path) === true) { + if (rename($file_path.'.crypt', $file_path) === true) { $crypted = true; } } @@ -544,7 +544,7 @@ function jirafeau_add_file($file, $one_time_download, $key, $time, $ip, $crypt, /* hash password or empty. */ $password = ''; if (!empty($key)) { - $password = md5($key); + $password = '[SHA256]' . hash('sha256', $key); } /* create link file */ @@ -554,7 +554,7 @@ function jirafeau_add_file($file, $one_time_download, $key, $time, $ip, $crypt, $handle, $name . NL. $mime_type . NL. $size . NL. $password . NL. $time . NL . $hash. NL . ($one_time_download ? 'O' : 'R') . NL . time() . - NL . $ip . NL. $delete_link_code . NL . ($crypted ? 'C' : 'O') + NL . $ip . NL. $delete_link_code . NL . ($crypted ? 'C2' : 'O') ); fclose($handle); $hash_link = substr(base_16_to_64(md5_file($link_tmp_name)), 0, $link_name_length); @@ -947,6 +947,7 @@ function jirafeau_admin_bug_report($cfg) $out .= "- version: " . JIRAFEAU_VERSION . "
"; $jirafeau_options = [ 'debug', + 'debug_enforce_classic_upload', 'file_hash', 'litespeed_workaround', 'store_uploader_ip', @@ -1088,10 +1089,10 @@ function jirafeau_async_init($filename, $type, $one_time, $key, $time, $ip) $w_path = $p . $ref . '_data'; touch($w_path); - /* md5 password or empty */ + /* sha256 password or empty */ $password = ''; if (!empty($key)) { - $password = md5($key); + $password = '[SHA256]' . hash('sha256', $key); } /* Store information. */ @@ -1642,7 +1643,7 @@ function jirafeau_escape($string) function jirafeau_admin_session_start() { $_SESSION['admin_auth'] = true; - $_SESSION['admin_csrf'] = md5(uniqid(mt_rand(), true)); + $_SESSION['admin_csrf'] = hash('sha256', uniqid(mt_rand(), true)); } function jirafeau_session_end() diff --git a/lib/settings.php b/lib/settings.php index 5a8d3a7..e015067 100644 --- a/lib/settings.php +++ b/lib/settings.php @@ -43,7 +43,7 @@ if ($cfg['debug'] === true) { /* Jirafeau package */ define('JIRAFEAU_PACKAGE', 'Jirafeau'); -define('JIRAFEAU_VERSION', '4.7.1'); +define('JIRAFEAU_VERSION', '4.7.x-dev'); define('JIRAFEAU_WEBSITE', 'https://gitlab.com/jirafeau/Jirafeau'); diff --git a/media/courgette/style.css.php b/media/courgette/style.css.php index 4b75988..7623cd5 100644 --- a/media/courgette/style.css.php +++ b/media/courgette/style.css.php @@ -1,9 +1,9 @@ - * Jimmy Beauvois + * Jirafeau, your web file repository + * Copyright (C) 2008 Julien "axolotl" BERNARD + * Copyright (C) 2015 Jerome Jutteau + * Copyright (C) 2024 Jirafeau project (see AUTHORS.md) * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as @@ -20,7 +20,7 @@ */ /* - * This stylesheet is the default stylesheet for Jyraphe. + * This stylesheet is the default stylesheet for Jirafeau. * The content is dynamically generated for easier handling. */ @@ -286,6 +286,26 @@ input[type="submit"]:focus { background: url(email.png) no-repeat; } +#show_password { + flex: 1 1 auto; + position: absolute; + right: 0%; + background: none; + border: none; + cursor: pointer; + opacity: 30%; +} +#show_password:hover { + opacity: 100%; +} + +.passwordcolumn { + display: flex; + position: relative; + align-items: center; + width: 100%; +} + /* ========================================================================== 5 = Terms of service ========================================================================== */ diff --git a/media/dark-courgette/style.css.php b/media/dark-courgette/style.css.php index 3657b87..7a577c9 100644 --- a/media/dark-courgette/style.css.php +++ b/media/dark-courgette/style.css.php @@ -1,9 +1,9 @@ - * Jimmy Beauvois + * Jirafeau, your web file repository + * Copyright (C) 2008 Julien "axolotl" BERNARD + * Copyright (C) 2015 Jerome Jutteau + * Copyright (C) 2024 Jirafeau project (see AUTHORS.md) * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as @@ -20,7 +20,7 @@ */ /* - * This stylesheet is the default stylesheet for Jyraphe. + * This stylesheet is the default dark mode stylesheet for Jirafeau. * The content is dynamically generated for easier handling. */ @@ -289,6 +289,26 @@ input[type="submit"]:focus { background: url(email.png) no-repeat; } +#show_password { + flex: 1 1 auto; + position: absolute; + right: 0%; + background: none; + border: none; + cursor: pointer; + opacity: 30%; +} +#show_password:hover { + opacity: 100%; +} + +.passwordcolumn { + display: flex; + position: relative; + align-items: center; + width: 100%; +} + /* ========================================================================== 5 = Terms of service ========================================================================== */ @@ -471,4 +491,4 @@ textarea[readonly="readonly"] + p + p a:focus { padding-left: 40px; padding-top: 10px; padding-bottom: 10px; -} +} \ No newline at end of file diff --git a/media/elegantish/elegantish.css b/media/elegantish/elegantish.css index 7e04ac8..253bcd0 100644 --- a/media/elegantish/elegantish.css +++ b/media/elegantish/elegantish.css @@ -286,6 +286,26 @@ input[type="submit"]:focus { background: url(email.png) no-repeat; } +#show_password { + flex: 1 1 auto; + position: absolute; + right: 0%; + background: none; + border: none; + cursor: pointer; + opacity: 30%; +} +#show_password:hover { + opacity: 100%; +} + +.passwordcolumn { + display: flex; + position: relative; + align-items: center; + width: 100%; +} + /* ========================================================================== 5 = Terms of service ========================================================================== */ diff --git a/media/elegantish/style.css.php b/media/elegantish/style.css.php index 7107195..401b37a 100644 --- a/media/elegantish/style.css.php +++ b/media/elegantish/style.css.php @@ -1,9 +1,9 @@ - * Jimmy Beauvois + * Jirafeau, your web file repository + * Copyright (C) 2008 Julien "axolotl" BERNARD + * Copyright (C) 2015 Jerome Jutteau + * Copyright (C) 2024 Jirafeau project (see AUTHORS.md) * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as @@ -19,11 +19,6 @@ * along with this program. If not, see . */ -/* - * This stylesheet is the default stylesheet for Jyraphe. - * The content is dynamically generated for easier handling. - */ - $dark = '#8B4513'; header('Content-type: text/css'); diff --git a/media/industrial/style.css.php b/media/industrial/style.css.php index 34d9990..f28921e 100644 --- a/media/industrial/style.css.php +++ b/media/industrial/style.css.php @@ -1,7 +1,9 @@ + * Copyright (C) 2015 Jerome Jutteau + * Copyright (C) 2024 Jirafeau project (see AUTHORS.md) * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as @@ -17,11 +19,6 @@ * along with this program. If not, see . */ -/* - * This stylesheet is the default stylesheet for Jyraphe. - * The content is dynamically generated for easier handling. - */ - $dark = '#8B4513'; header('Content-type: text/css'); @@ -193,3 +190,23 @@ input:hover { padding-bottom: 15px; background: url(email.png) no-repeat; } + +#show_password { + flex: 1 1 auto; + position: absolute; + right: 0%; + background: none; + border: none; + cursor: pointer; + opacity: 30%; +} +#show_password:hover { + opacity: 100%; +} + +.passwordcolumn { + display: flex; + position: relative; + align-items: center; + width: 100%; +} diff --git a/media/jyraphe/style.css.php b/media/jyraphe/style.css.php index 1a2b789..517ae1c 100644 --- a/media/jyraphe/style.css.php +++ b/media/jyraphe/style.css.php @@ -2,6 +2,8 @@ /* * Jirafeau, your web file repository * Copyright (C) 2008 Julien "axolotl" BERNARD + * Copyright (C) 2015 Jerome Jutteau + * Copyright (C) 2024 Jirafeau project (see AUTHORS.md) * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as @@ -17,11 +19,6 @@ * along with this program. If not, see . */ -/* - * This stylesheet is the default stylesheet for Jirafeau. - * The content is dynamically generated for easier handling. - */ - $dark = '#8B4513'; header('Content-type: text/css'); @@ -241,3 +238,23 @@ h1 a { padding-left: 20px; background: url(email.png) no-repeat; } + +#show_password { + flex: 1 1 auto; + position: absolute; + right: 0%; + background: none; + border: none; + cursor: pointer; + opacity: 30%; +} +#show_password:hover { + opacity: 100%; +} + +.passwordcolumn { + display: flex; + position: relative; + align-items: center; + width: 100%; +} \ No newline at end of file diff --git a/media/modern/favicon.ico b/media/modern/favicon.ico new file mode 100644 index 0000000..c42c696 Binary files /dev/null and b/media/modern/favicon.ico differ diff --git a/media/modern/style.css.php b/media/modern/style.css.php index fcdf9ca..e40760a 100644 --- a/media/modern/style.css.php +++ b/media/modern/style.css.php @@ -1,9 +1,9 @@ - * Jimmy Beauvois + * Jirafeau, your web file repository + * Copyright (C) 2008 Julien "axolotl" BERNARD + * Copyright (C) 2015 Jerome Jutteau + * Copyright (C) 2024 Jirafeau project (see AUTHORS.md) * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as @@ -19,11 +19,6 @@ * along with this program. If not, see . */ -/* - * This stylesheet is the default stylesheet for Jyraphe. - * The content is dynamically generated for easier handling. - */ - $dark = '#8B4513'; header('Content-type: text/css'); @@ -233,3 +228,23 @@ font-size:90%; padding-left: 20px; background: url(email.png) no-repeat; } + +#show_password { + flex: 1 1 auto; + position: absolute; + right: 0%; + background: none; + border: none; + cursor: pointer; + opacity: 30%; +} +#show_password:hover { + opacity: 100%; +} + +.passwordcolumn { + display: flex; + position: relative; + align-items: center; + width: 100%; +} diff --git a/script.php b/script.php index cc37c41..2fc297f 100644 --- a/script.php +++ b/script.php @@ -183,7 +183,7 @@ if (isset($_FILES['file']) && is_writable(VAR_FILES) 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;