Skip to content

Commit ff5ae89

Browse files
committed
Allow using several git repos
- editcommit.php: - added a restriction not to use auto determined git repos found in directories above the DokuWiki configured $conf['savedir'].
1 parent dbee1e7 commit ff5ae89

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

action/editcommit.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ public function register(Doku_Event_Handler $controller) {
4040
* @return GitRepo instance or null if there is no repo related to fileOrDirPath
4141
*/
4242
private function initRepo($fileOrDirPath="") {
43+
global $conf;
44+
4345
//set the path to the git binary
4446
$gitPath = trim($this->getConf('gitPath'));
4547
if ($gitPath !== '') {
@@ -57,6 +59,11 @@ private function initRepo($fileOrDirPath="") {
5759
if (empty($repoPath)) {
5860
return null;
5961
}
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+
return null;
66+
}
6067
$repoWorkDir = '';
6168
} else {
6269
//get path to the repo root (by default DokuWiki's savedir)

0 commit comments

Comments
 (0)