Promoting MR 35 to Next-Rrelease Except the Password Hashing that is Already Implemented
See merge request jirafeau/Jirafeau!37
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
- 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
- Sven Dickert
- Sylke Vicious
- Szylu
+- TehPeGaSuS
- Thomas LEBEAU
- Thomas Sontheimer
- Tymofij Lytvynenko
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`!
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');
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);
echo '<input type="hidden" name="key" id="input_key" value="' . $download_pass .'"/>';
} else {
echo '<tr><td><label for="input_key">' . t('PSW') . ':' . '</label></td>';
- echo '<td><input type="password" name="key" id="input_key" autocomplete = "new-password"';
+ echo '<td class="passwordcolumn"><input type="password" name="key" id="input_key" autocomplete = "new-password"';
if ($cfg['download_password_policy'] === 'regex') {
echo ' pattern="' . jirafeau_escape(substr($cfg['download_password_policy_regex'], 1, strlen($cfg['download_password_policy_regex']) - 2)) . '"'; //remove php delimiters
}
if ($cfg['download_password_requirement'] === 'required') {
echo ' required';
}
- echo '/></td></tr>';
+ echo ' /> <button data-toggle="false" type="button" id="show_password">
+ </button>';
+ echo '</td></tr>';
}?>
<tr>
<td><label for="select_time"><?php echo t('TIME_LIM') . ':'; ?></label></td>
<script type="text/javascript" lang="Javascript">
// @license magnet:?xt=urn:btih:0b31508aeb0634b347b8270c7bee4d411b5d4109&dn=agpl-3.0.txt AGPL-v3-or-Later
+ // ICONS in SVG
+ const EYE_OPEN = `<svg width="20" height="20" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" aria-hidden="true" version="1.1" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
+ <path d="m1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z" stroke-width="1.7604"/>
+ <circle cx="12" cy="12" r="3"/>
+ <path d="m2.9757 2.7901 18.56 18.546" display="none" fill="none" stroke="#000" stroke-width="1.7604"/>
+</svg>`;
+ const EYE_CLOSE = `<svg width="20" height="20" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" aria-hidden="true" version="1.1" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
+ <path d="m1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z" stroke-width="1.7604"/>
+ <circle cx="12" cy="12" r="3"/>
+ <path d="m2.9757 2.7901 18.56 18.546" fill="none" stroke="#000" stroke-width="1.7604"/>
+</svg>`;
+
+
+
document.getElementById('error_pop').style.display = 'none';
document.getElementById('uploading').style.display = 'none';
document.getElementById('upload_finished').style.display = 'none';
addCopyListener('delete_link_button', 'delete_link');
addTextCopyListener('password_copy_button', 'output_key');
// @license-end
+// show password toggle
+ document.getElementById('show_password').innerHTML = EYE_OPEN;
+ document.getElementById('show_password')?.addEventListener('click', function() {
+ const pwd = document.getElementById('input_key');
+ const show_password = pwd.type === 'text';
+ const next_show_password_toggle_value = !show_password;
+ if (next_show_password_toggle_value) {
+ pwd.type = 'text';
+ document.getElementById('show_password').setAttribute('data-show-enabled', true);
+ // symbol eye strikethrough
+ document.getElementById('show_password').innerHTML = EYE_CLOSE;
+ } else {
+ pwd.type = 'password';
+ // symbol eye
+ document.getElementById('show_password').innerHTML = EYE_OPEN;
+ }
+ });
</script>
<?php require(JIRAFEAU_ROOT . 'lib/template/footer.php'); ?>
*/
$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).
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;
function check_html5_file_api ()
{
+<?php
+ if (isset($cfg['debug_enforce_classic_upload']) && $cfg['debug_enforce_classic_upload']) { ?>
+ // Enforce classic upload is enabled through config!
+ return false;
+<?php
+ }
+?>
return window.File && window.FileReader && window.FileList && window.Blob;
}
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;
}
}
/* hash password or empty. */
$password = '';
if (!empty($key)) {
- $password = md5($key);
+ $password = '[SHA256]' . hash('sha256', $key);
}
/* create link file */
$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);
$out .= "- version: " . JIRAFEAU_VERSION . "<br/>";
$jirafeau_options = [
'debug',
+ 'debug_enforce_classic_upload',
'file_hash',
'litespeed_workaround',
'store_uploader_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. */
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()
/* 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');
<?php
/*
- * Jyraphe, your web file repository
- * Copyright (C) 2013
- * Jerome Jutteau <jerome@jutteau.fr>
- * Jimmy Beauvois <jimmy.beauvois@gmail.com>
+ * Jirafeau, your web file repository
+ * Copyright (C) 2008 Julien "axolotl" BERNARD <axolotl@magieeternelle.org>
+ * Copyright (C) 2015 Jerome Jutteau <jerome@jutteau.fr>
+ * Copyright (C) 2024 Jirafeau project <https://gitlab.com/jirafeau> (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
*/
/*
- * This stylesheet is the default stylesheet for Jyraphe.
+ * This stylesheet is the default stylesheet for Jirafeau.
* The content is dynamically generated for easier handling.
*/
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
========================================================================== */
<?php
/*
- * Jyraphe, your web file repository
- * Copyright (C) 2013
- * Jerome Jutteau <jerome@jutteau.fr>
- * Jimmy Beauvois <jimmy.beauvois@gmail.com>
+ * Jirafeau, your web file repository
+ * Copyright (C) 2008 Julien "axolotl" BERNARD <axolotl@magieeternelle.org>
+ * Copyright (C) 2015 Jerome Jutteau <jerome@jutteau.fr>
+ * Copyright (C) 2024 Jirafeau project <https://gitlab.com/jirafeau> (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
*/
/*
- * 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.
*/
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
========================================================================== */
padding-left: 40px;
padding-top: 10px;
padding-bottom: 10px;
-}
+}
\ No newline at end of file
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
========================================================================== */
<?php
/*
- * Jyraphe, your web file repository
- * Copyright (C) 2013
- * Jerome Jutteau <jerome@jutteau.fr>
- * Jimmy Beauvois <jimmy.beauvois@gmail.com>
+ * Jirafeau, your web file repository
+ * Copyright (C) 2008 Julien "axolotl" BERNARD <axolotl@magieeternelle.org>
+ * Copyright (C) 2015 Jerome Jutteau <jerome@jutteau.fr>
+ * Copyright (C) 2024 Jirafeau project <https://gitlab.com/jirafeau> (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
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
-/*
- * This stylesheet is the default stylesheet for Jyraphe.
- * The content is dynamically generated for easier handling.
- */
-
$dark = '#8B4513';
header('Content-type: text/css');
<?php
/*
- * Jyraphe, your web file repository
+ * Jirafeau, your web file repository
* Copyright (C) 2008 Julien "axolotl" BERNARD <axolotl@magieeternelle.org>
+ * Copyright (C) 2015 Jerome Jutteau <jerome@jutteau.fr>
+ * Copyright (C) 2024 Jirafeau project <https://gitlab.com/jirafeau> (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
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
-/*
- * This stylesheet is the default stylesheet for Jyraphe.
- * The content is dynamically generated for easier handling.
- */
-
$dark = '#8B4513';
header('Content-type: text/css');
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%;
+}
/*
* Jirafeau, your web file repository
* Copyright (C) 2008 Julien "axolotl" BERNARD <axolotl@magieeternelle.org>
+ * Copyright (C) 2015 Jerome Jutteau <jerome@jutteau.fr>
+ * Copyright (C) 2024 Jirafeau project <https://gitlab.com/jirafeau> (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
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
-/*
- * This stylesheet is the default stylesheet for Jirafeau.
- * The content is dynamically generated for easier handling.
- */
-
$dark = '#8B4513';
header('Content-type: text/css');
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
<?php
/*
- * Jyraphe, your web file repository
- * Copyright (C) 2013
- * Jerome Jutteau <jerome@jutteau.fr>
- * Jimmy Beauvois <jimmy.beauvois@gmail.com>
+ * Jirafeau, your web file repository
+ * Copyright (C) 2008 Julien "axolotl" BERNARD <axolotl@magieeternelle.org>
+ * Copyright (C) 2015 Jerome Jutteau <jerome@jutteau.fr>
+ * Copyright (C) 2024 Jirafeau project <https://gitlab.com/jirafeau> (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
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
-/*
- * This stylesheet is the default stylesheet for Jyraphe.
- * The content is dynamically generated for easier handling.
- */
-
$dark = '#8B4513';
header('Content-type: text/css');
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%;
+}
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;