[TikiWiki-commits] [Git][tikiwiki/tiki][24.x] [BP][FIX] Fix scheduler injection

"Elifeleti Mukisa Dan \(@Danelif\) via TikiWiki-cvs" <[email protected]>
Newsgroups gmane.comp.cms.tiki.cvs
Message-ID <69838baf169bf_3b1844a8162c@gitlab-sidekiq-low-urgency-cpu-bound-v2-55cfcc57bd-b9fm6.mail>

Elifeleti Mukisa Dan pushed to branch 24.x at Tiki Wiki CMS Groupware / Tiki


Commits:
c375a41b by Elifeleti Mukisa Dan at 2026-02-04T18:04:42+00:00
[BP][FIX] Fix scheduler injection
---
* [BP][FIX] Fix scheduler injection
---
* [BP][FIX] Fix scheduler injection
---
* [BP][FIX] Fix scheduler injection
---
* [FIX] Fix scheduler injection
---
* [FIX] Fix scheduler injection

(cherry picked from commit ef49326b3ddc4424b438b1f3e1efc796e22944b9)

Co-authored-by: Danelif <[email protected]>

See merge request tikiwiki/tiki!8503

See merge request tikiwiki/tiki!9496

See merge request tikiwiki/tiki!9497

See merge request tikiwiki/tiki!9500

See merge request tikiwiki/tiki!9508

- - - - -


2 changed files:

- lib/core/Scheduler/Task/HTTPGetCommandTask.php
- tiki-admin_schedulers.php


Changes:

=====================================
lib/core/Scheduler/Task/HTTPGetCommandTask.php
=====================================
@@ -8,7 +8,6 @@
 
 class Scheduler_Task_HTTPGetCommandTask extends Scheduler_Task_CommandTask
 {
-
     public function execute($params = null)
     {
         try {
@@ -106,4 +105,40 @@ class Scheduler_Task_HTTPGetCommandTask extends Scheduler_Task_CommandTask
             ],
         ];
     }
+/**
+ * @param mixed $value
+ * @return string|bool
+ */
+    public function validateOutputFile($value)
+    {
+    // First validate the path
+        $publicPathes = [TEMP_PATH, HTTP_PUBLIC_PATH];
+        $pathDir = dirname($value);
+
+        foreach ($publicPathes as $dir) {
+            $realDir = realpath($dir);
+
+            if (strpos($pathDir, $realDir) === 0) {
+                return tra('You cannot write to this path.');
+            }
+        }
+
+        // After validate the file extension
+        $badExts = [
+            'php', 'phtml', 'phar',
+            'asp', 'aspx', 'jsp', 'cgi',
+            'pl', 'py', 'rb', 'sh',
+            'exe', 'dll', 'so', 'bin', 'msi',
+            'js', 'html', 'htm', 'svg', 'swf',
+            'cmd', 'bat', 'vbs', 'jar'
+        ];
+
+        $parts = explode('.', $value, 2);
+
+        if (count($parts) == 2 && in_array($parts[1], $badExts, true)) {
+            return tra('This extension is not allowed.');
+        }
+
+        return true;
+    }
 }


=====================================
tiki-admin_schedulers.php
=====================================
@@ -54,6 +54,16 @@ function saveScheduler()
                 $errors[] = sprintf(tra('%s is required'), $param['name']);
                 $addTask = false;
             }
+
+            $validateMethod = 'validate' . str_replace(' ', '', ucwords(str_replace('_', ' ', $key)));
+
+            if (method_exists($class, $validateMethod)) {
+                $validationResult = $class->$validateMethod($_POST[$httpParamName]);
+                if (is_string($validationResult)) {
+                    $errors[] = $validationResult;
+                    $addTask = false;
+                }
+            }
         }
 
         $params = $class->parseParams();



View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/c375a41b50102838a9219e4afe592baa70a0c4a7

-- 
View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/c375a41b50102838a9219e4afe592baa70a0c4a7
You're receiving this email because of your account on gitlab.com.

_______________________________________________
TikiWiki-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tikiwiki-cvs
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.