You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: action/editcommit.php
+7Lines changed: 7 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -40,6 +40,8 @@ public function register(Doku_Event_Handler $controller) {
40
40
* @return GitRepo instance or null if there is no repo related to fileOrDirPath
41
41
*/
42
42
privatefunctioninitRepo($fileOrDirPath="") {
43
+
global$conf;
44
+
43
45
//set the path to the git binary
44
46
$gitPath = trim($this->getConf('gitPath'));
45
47
if ($gitPath !== '') {
@@ -57,6 +59,11 @@ private function initRepo($fileOrDirPath="") {
57
59
if (empty($repoPath)) {
58
60
returnnull;
59
61
}
62
+
// Validate that the git repoPath found is within or below the DokuWiki 'savedir' configured:
63
+
if (strpos(realpath($repoPath), realpath($conf['savedir'])) === false) {
64
+
//dbglog("GitBacked - WARNING: repoPath=".$repoPath." is above the configured savedir=".realpath($conf['savedir'])." => this git repo will be ignored!");
65
+
returnnull;
66
+
}
60
67
$repoWorkDir = '';
61
68
} else {
62
69
//get path to the repo root (by default DokuWiki's savedir)
0 commit comments