1
0
Fork 0

Merge branch '1.1'

pull/5301/head
Jordi Boggiano 2016-05-08 17:22:30 +01:00
commit a31d0826f0
2 changed files with 14 additions and 2 deletions

View File

@ -251,7 +251,13 @@ class Git
public static function sanitizeUrl($message) public static function sanitizeUrl($message)
{ {
return preg_replace('{://([^@]+?):.+?@}', '://$1:***@', $message); return preg_replace_callback('{://(?P<user>[^@]+?):(?P<password>.+?)@}', function ($m) {
if (preg_match('{^[a-f0-9]{12,}$}', $m[1])) {
return '://***:***@';
}
return '://'.$m[1].':***@';
}, $message);
} }
private function throwException($message, $url) private function throwException($message, $url)

View File

@ -44,7 +44,13 @@ class ProcessExecutor
public function execute($command, &$output = null, $cwd = null) public function execute($command, &$output = null, $cwd = null)
{ {
if ($this->io && $this->io->isDebug()) { if ($this->io && $this->io->isDebug()) {
$safeCommand = preg_replace('{(://[^:/\s]+:)[^@\s/]+}i', '$1****', $command); $safeCommand = preg_replace('{(://)(?P<user>[^:/\s]+):(?P<password>[^@\s/]+)}i', function ($m) {
if (preg_match('{^[a-f0-9]{12,}$}', $m[1])) {
return '://***:***';
}
return '://'.$m[1].':***';
}, $command);
$this->io->writeError('Executing command ('.($cwd ?: 'CWD').'): '.$safeCommand); $this->io->writeError('Executing command ('.($cwd ?: 'CWD').'): '.$safeCommand);
} }