]> git.p6c8.net - jirafeau/pcanterino.git/commitdiff
Merge branch 'patch-1' into 'show_password_box'
authorPatrick Canterino <patrick@patrick-canterino.de>
Fri, 5 Jun 2026 14:16:41 +0000 (16:16 +0200)
committerPatrick Canterino <patrick@patrick-canterino.de>
Fri, 5 Jun 2026 14:16:41 +0000 (16:16 +0200)
Add a Show password checkbox

See merge request jirafeau/Jirafeau!30

.gitlab-ci.yml
CHANGELOG.md
f.php
lib/config.original.php
lib/functions.js.php
lib/functions.php
lib/settings.php
media/modern/favicon.ico [new file with mode: 0644]
script.php

index 627ed17edeafe41783446928a7827acd4a27ba9b..613ab9b6e3d819a399ed152c4000ba77d8bc8c47 100644 (file)
@@ -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
index c687514260f7a45c49182f7d5326c9737ddc1163..5e614eca4483fc51d6424ecfbda137f00409cc5d 100644 (file)
 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)
+
+- Favicon was missing in the `modern` theme
+- ...
+
 ## 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/f.php b/f.php
index 269b10be94725f3395ec739c2e0a614767dbab80..870b4bdd8aa28b400d92f668c83ca784f1d7cfe6 100644 (file)
--- 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);
index 6b7c342e51cf7a1402774266016c0862f14a770c..37c87ebc573d6d6db4637d2c815c658980291c5c 100644 (file)
@@ -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).
index 29d50c198edfbc321a0d1855eadd8624f4baa15b..cafecafcdc0f6fcd19ade0b89944ec80c86daad8 100644 (file)
@@ -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 ()
 {
+<?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;
 }
 
index 84bcea8ebaff44c805ac6a33d4b03c8abcd39c32..948a436de4843bd28f1b1210e1fcc3f379a8923f 100644 (file)
@@ -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);
@@ -1088,10 +1088,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 +1642,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()
index 5a8d3a7948dfdd27f0a05713470237e654757af0..e015067bd45e9345de460ff77f6536e77478d0ac 100644 (file)
@@ -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/modern/favicon.ico b/media/modern/favicon.ico
new file mode 100644 (file)
index 0000000..c42c696
Binary files /dev/null and b/media/modern/favicon.ico differ
index ae574494bf2165f2698c96b06b4f28773be762db..301ebe8cb088e83e6d9774bdc852d36811e10c68 100644 (file)
@@ -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;

patrick-canterino.de