Merge pull request #147 from PGYER/dev/master

fix(Command): filter "`" for comamnd (shell inject)
This commit is contained in:
Carney Wu
2023-03-27 14:42:51 +08:00
committed by GitHub
2 changed files with 5 additions and 5 deletions

View File

@@ -42,8 +42,8 @@ class Command
// return '"' . $argument . '"';
$pattern = [
'/(^|[^\\\\])((\\\\\\\\)*[\s\'\"\$\|])/',
'/(^|[^\\\\])((\\\\\\\\)*\\\\([^\s\'\"\|\$\\\\]|$))/'
'/(^|[^\\\\])((\\\\\\\\)*[\s\`\'\"\$\|])/',
'/(^|[^\\\\])((\\\\\\\\)*\\\\([^\s\`\'\"\|\$\\\\]|$))/'
];
$replacement = [
'$1\\\\$2',

View File

@@ -1466,14 +1466,14 @@ class Repository_model extends CI_Model
return FALSE;
}
$branch = Command::wrapArgument($branch);
$filePath = Command::wrapArgument($filePath);
$command = GitCommand::getLastLog($branch, $filePath, $lastSha);
if (!$command) {
return FALSE;
}
$branch = Command::wrapArgument($branch);
$filePath = Command::wrapArgument($filePath);
$log = $this->execCommand($rKey, $uKey, GIT_COMMAND_QUERY, $command);
$log = rtrim($log, Helper::getDelimiter() . "\n");
$log = $this->_logStringToArray($log);