Repository navigation
v1.7.1
Changes since v1.7.0.
1.7.1 has the security fixes of 2.0 that break nothing of 1.6. Where 2.0 refuses every option,
1.7.1 only refuses what reads or writes a file: the other options of git log as revisions stay
deprecated, and work. The checks of a URL keep returning false, and clones keep throwing a
RuntimeException, where 2.0 throws an InvalidArgumentException.
Security
- Refuse
--outputas a revision, which made git write a file:getRevision('--output=/path')
and everything reading a revision through it,getLog(),getDiff(),getMergeBase()or
Branch::moveTo()for instance. - Refuse the options of
git blamereading or writing a file as a revision:
getBlame('--contents=/path', 'README.md')returned the lines of any file, and the error of
--ignore-revs-fileor-Sprinted its first line. - Refuse a URL starting with a dash, which git read as an option:
Admin::isValidRepository('--upload-pack=...')ran the command in a repository with a remote,
Admin::isValidRepositoryAndBranch()and the clones when the second argument was a
repository. A path may start with a dash:init()and the clones end the options of git with
--, ascloneFrom($url, '--upload-pack=...')ran the command too. - Refuse a hash starting with a dash in
ReferenceBag::createBranch()andcreateTag():
createBranch('foo', '-d')deleted the branch. So do the branch and the start point of
WorkingCopy::checkoutNewBranch(). - Refuse an
fd::URL, which makes git talk through a file descriptor it inherits from PHP, like
the socket of a database, and wait on it. - Refuse an ssh URL whose host or user starts with a dash, even encoded (
%2D), like
ssh://-oProxyCommand=.../repository: git before 2.14.1 passes it to ssh, which reads it as an
option and runs the command (CVE-2017-1000117). Agit://URL whose host starts with a dash
is refused too: git passes it to the command ofcore.gitProxy. - Hide the credentials of URLs (
https://user:token@host), a password holding a#or a?
included, in the messages ofProcessExceptionand of failed clones, in the logs, and in the
messages of the exceptions of Symfony Process, a timeout for instance, which keep their class.
From PHP 8.2, the traces hide them too (#[\SensitiveParameter]). - Refuse a hook name leading out of the hooks directory:
Hooks::set('../../file', ...),
remove('../config')andget('../config')wrote, deleted and read files of the repository.
The names staying in the directory, likepost-receive.d/notify, still work. - Fix
Hookswriting through a symbolic link to a missing file, out of the hooks directory:
has()returnedfalsefor it, andset()followed it. - Ignore
core.fsmonitor: git ran the command the configuration of a repository names there to
read the working tree, and even to diff a commit. - Fix deleting a symbolic reference, which deleted the branch it points to instead:
ReferenceBag::delete('refs/remotes/origin/HEAD')deletedorigin/main. - Fix
ReferenceBag::delete('HEAD')deleting a detachedHEAD, which left no repository: it
throws anInvalidArgumentException. - Require
symfony/process5.4.51, 6.4.33, 7.3.11, 7.4.5 or 8.0.5 and later: the older versions
escape the arguments wrongly on Windows (CVE-2024-51736, CVE-2026-24739).
Not fixed
These fixes of 2.0 would break code written for 1.6. An application giving gitlib values it can't
trust has to check them itself:
ext::URLs stay accepted, as an application may use this transport on purpose. git refuses
them by default since 2.12: before that,ext::sh -c ...runs the command.- The replacements of objects (
git replace,refs/replace/) stay read, asgit replace --graft
relies on them: whoever can push such a reference changes the message of a commit, or the
content of a blob, gitlib reads for a hash. SetGIT_NO_REPLACE_OBJECTSto1in the
environmentVariablesofCliDriverto ignore them. WorkingCopy::checkout()still takes a path or an option:checkout('README.md')discards the
changes of the file, andcheckout('--force')all of them.- Moving a symbolic reference, with
Branch::moveTo()orReferenceBag::update(), still moves
the branch it points to.