Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
91 commits
Select commit Hold shift + click to select a range
b3de383
refs: add function to translate errors to strings
KarthikNayak May 19, 2025
0e358de
fetch: use batched reference updates
KarthikNayak May 19, 2025
77188b5
send-pack: fix memory leak around duplicate refs
KarthikNayak May 19, 2025
9d2962a
receive-pack: use batched reference updates
KarthikNayak May 19, 2025
b966b73
gitk: treat file names beginning with "|" as relative paths
j6t Mar 17, 2025
6eb797f
gitk: have callers of diffcmd supply pipe symbol when necessary
j6t Mar 17, 2025
9f0d1c2
gitk: sanitize 'exec' arguments: simple cases
j6t Mar 17, 2025
88139a6
gitk: sanitize 'exec' arguments: 'eval exec'
j6t Mar 29, 2025
6b631ee
gitk: sanitize 'exec' arguments: redirections
j6t Mar 29, 2025
7a0493e
gitk: sanitize 'exec' arguments: redirections and background
j6t Mar 29, 2025
30846b4
gitk: sanitize 'exec' arguments: redirect to process
j6t Mar 29, 2025
fe32bf3
gitk: sanitize 'open' arguments: simple commands
j6t Mar 20, 2025
42a64b4
gitk: sanitize 'open' arguments: simple commands with redirections
j6t Mar 20, 2025
2aeb448
gitk: sanitize 'open' arguments: simple commands, readable and writable
j6t Mar 21, 2025
79a3ef5
gitk: collect construction of blameargs into a single conditional
j6t Mar 23, 2025
026c397
gitk: sanitize 'open' arguments: command pipeline
j6t Mar 23, 2025
8e3070a
gitk: encode arguments correctly with "open"
avih Mar 7, 2025
d7bc50c
Merge branch 'js/fix-open-exec-2.40.0' into js/fix-open-exec
ttaylorr May 23, 2025
37b9230
git-gui: _which, only add .exe suffix if not present
mark987 Apr 3, 2025
c5c3278
git-gui: use [is_Windows], not bad _shellpath
mark987 Apr 2, 2025
dcda716
Merge branch 'ml/git-gui-exec-path-fix'
j6t May 5, 2024
10637fc
git-gui: make _shellpath usable on startup
mark987 Apr 1, 2025
4774c70
git-gui: remove Tcl 8.4 workaround on 2>@1 redirection
mark987 Sep 20, 2023
02dd866
git-gui: use only the configured shell
mark987 Apr 6, 2025
f9a2e8a
git-gui: remove HEAD detachment implementation for git < 1.5.3
mark987 May 2, 2025
4eb9b11
git-gui: remove special treatment of Windows from open_cmd_pipe
j6t May 18, 2025
8255167
git-gui: remove git config --list handling for git < 1.5.3
j6t May 3, 2025
2c66188
git-gui: remove unused proc is_shellscript
mark987 Apr 4, 2025
c2e8904
git-gui: treat file names beginning with "|" as relative paths
j6t Apr 21, 2025
411cd49
git-gui: avoid auto_execok for git-bash menu item
mark987 Apr 2, 2025
4f3e0a4
git-gui: sanitize 'exec' arguments: simple cases
j6t Apr 21, 2025
00c7aa8
git-gui: avoid auto_execok in do_windows_shortcut
mark987 Apr 3, 2025
e883ceb
git-gui: sanitize 'exec' arguments: background
j6t Apr 26, 2025
676c495
git-gui: cleanup git-bash menu item
mark987 Apr 7, 2025
23ba432
git-gui: remove option --stderr from git_read
j6t May 3, 2025
8fe7861
git-gui: assure PATH has only absolute elements.
mark987 Apr 11, 2025
aa42e87
git-gui: break out a separate function git_read_nice
j6t May 3, 2025
384b140
git-gui: sanitize $PATH on all platforms
mark987 Apr 11, 2025
074c2b9
git-gui: use git_read in githook_read
j6t May 3, 2025
67a128b
gitk: sanitize 'open' arguments: revisit recently updated 'open' calls
j6t Mar 29, 2025
a1ccd25
git-gui: override exec and open only on Windows
mark987 Apr 11, 2025
dc9ecb1
git-gui: convert git_read*, git_write to be non-variadic
j6t May 3, 2025
1e0a93c
git-gui: pass redirections as separate argument to _open_stdout_stderr
j6t May 4, 2025
60b0ba0
git-gui: pass redirections as separate argument to git_read
j6t May 4, 2025
99f7bc1
git-gui: introduce function git_redir for git calls with redirections
j6t May 4, 2025
44e3935
git-gui: do not mistake command arguments as redirection operators
j6t May 4, 2025
afca9a4
Merge branch 'ml/replace-auto-execok' into js/fix-open-exec
ttaylorr May 23, 2025
4e7e3b7
Merge branch 'ah/fix-open-with-stdin'
j6t May 14, 2025
27fbab4
Merge branch 'js/fix-open-exec'
j6t May 14, 2025
a437f5b
git-gui: sanitize 'exec' arguments: convert new 'cygpath' calls
j6t May 14, 2025
a7d1716
Merge branch 'ml/replace-auto-execok'
j6t May 20, 2025
311d9ad
Merge branch 'js/fix-open-exec'
j6t May 20, 2025
05e9cd6
config: quote values containing CR character
jltobler May 20, 2025
35cb1bb
bundle-uri: fix arbitrary file writes via parameter injection
May 14, 2025
d61cfed
Merge branch 'js/gitk-git-gui-harden-exec-open' into maint-2.43
ttaylorr May 23, 2025
d2bc61f
Merge branch 'ps/bundle-uri-arbitrary-writes' into maint-2.43
ttaylorr May 28, 2025
2d22f0c
Merge branch 'jt/config-quote-cr' into maint-2.43
ttaylorr May 28, 2025
9de345c
wincred: avoid buffer overflow in wcsncat()
ttaylorr May 19, 2025
32c93d5
Merge branch 'tb/wincred-buffer-overflow' into maint-2.43
ttaylorr May 28, 2025
7a1903a
Git 2.43.7
ttaylorr May 28, 2025
a162459
Sync with 2.43.7
ttaylorr May 28, 2025
080b728
Git 2.44.4
ttaylorr May 28, 2025
3e10fb5
Sync with 2.44.4
ttaylorr May 28, 2025
f94b90a
Git 2.45.4
ttaylorr May 28, 2025
199837c
Sync with 2.45.4
ttaylorr May 28, 2025
47d3b50
Git 2.46.4
ttaylorr May 28, 2025
0991bd0
Sync with 2.46.4
ttaylorr May 28, 2025
a52a24e
Git 2.47.3
ttaylorr May 28, 2025
856b515
Sync with 2.47.3
ttaylorr May 28, 2025
fbae1f0
Git 2.48.2
ttaylorr May 28, 2025
a97f313
Sync with 2.48.2
gitster Jun 13, 2025
aadf8ae
Git 2.49.1
gitster Jun 13, 2025
e1775c0
Sync with 2.49.1
gitster Jun 16, 2025
d82adb6
Git 2.50.1
gitster Jun 16, 2025
15c45c7
refs/files: skip updates with errors in batched updates
KarthikNayak Jun 20, 2025
5c697f0
receive-pack: handle reference deletions separately
KarthikNayak Jun 20, 2025
038143d
Sync with Git 2.50.1
gitster Jul 7, 2025
7f5dd14
Documentation/RelNotes: use .adoc extension for new security releases
ttaylorr Jul 8, 2025
463c211
Merge branch 'maint-2.49' into maint-2.50
gitster Jul 8, 2025
428c924
t: avoid git config syntax from newer releases
tmzullinger Jul 8, 2025
18e6be8
Merge branch 'tz/avoid-newer-config-syntax-in-older-maint-tracks' int…
gitster Jul 8, 2025
09669c7
Merge branch 'maint-2.43' into maint-2.44
gitster Jul 8, 2025
a98e34b
Merge branch 'maint-2.44' into maint-2.45
gitster Jul 8, 2025
3d6d129
Merge branch 'maint-2.45' into maint-2.46
gitster Jul 8, 2025
515a060
Merge branch 'maint-2.46' into maint-2.47
gitster Jul 8, 2025
a1cf0cf
Merge branch 'maint-2.47' into maint-2.48
gitster Jul 8, 2025
47243ee
Merge branch 'maint-2.48' into maint-2.49
gitster Jul 8, 2025
f368df4
Merge branch 'maint-2.49' into maint-2.50
gitster Jul 8, 2025
0ba1a58
Merge branch 'maint-2.50'
gitster Jul 8, 2025
cdb7872
Merge branch 'kn/fetch-push-bulk-ref-update'
gitster Jul 8, 2025
a30f80f
The eighth batch
gitster Jul 8, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
73 changes: 73 additions & 0 deletions Documentation/RelNotes/2.43.7.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
Git v2.43.7 Release Notes
=========================

This release includes fixes for CVE-2025-27613, CVE-2025-27614,
CVE-2025-46334, CVE-2025-46835, CVE-2025-48384, CVE-2025-48385, and
CVE-2025-48386.

Fixes since v2.43.6
-------------------

* CVE-2025-27613, Gitk:

When a user clones an untrusted repository and runs Gitk without
additional command arguments, any writable file can be created and
truncated. The option "Support per-file encoding" must have been
enabled. The operation "Show origin of this line" is affected as
well, regardless of the option being enabled or not.

* CVE-2025-27614, Gitk:

A Git repository can be crafted in such a way that a user who has
cloned the repository can be tricked into running any script
supplied by the attacker by invoking `gitk filename`, where
`filename` has a particular structure.

* CVE-2025-46334, Git GUI (Windows only):

A malicious repository can ship versions of sh.exe or typical
textconv filter programs such as astextplain. On Windows, path
lookup can find such executables in the worktree. These programs
are invoked when the user selects "Git Bash" or "Browse Files" from
the menu.

* CVE-2025-46835, Git GUI:

When a user clones an untrusted repository and is tricked into
editing a file located in a maliciously named directory in the
repository, then Git GUI can create and overwrite any writable
file.

* CVE-2025-48384, Git:

When reading a config value, Git strips any trailing carriage
return and line feed (CRLF). When writing a config entry, values
with a trailing CR are not quoted, causing the CR to be lost when
the config is later read. When initializing a submodule, if the
submodule path contains a trailing CR, the altered path is read
resulting in the submodule being checked out to an incorrect
location. If a symlink exists that points the altered path to the
submodule hooks directory, and the submodule contains an executable
post-checkout hook, the script may be unintentionally executed
after checkout.

* CVE-2025-48385, Git:

When cloning a repository Git knows to optionally fetch a bundle
advertised by the remote server, which allows the server-side to
offload parts of the clone to a CDN. The Git client does not
perform sufficient validation of the advertised bundles, which
allows the remote side to perform protocol injection.

This protocol injection can cause the client to write the fetched
bundle to a location controlled by the adversary. The fetched
content is fully controlled by the server, which can in the worst
case lead to arbitrary code execution.

* CVE-2025-48386, Git:

The wincred credential helper uses a static buffer (`target`) as a
unique key for storing and comparing against internal storage. This
credential helper does not properly bounds check the available
space remaining in the buffer before appending to it with
`wcsncat()`, leading to potential buffer overflows.
7 changes: 7 additions & 0 deletions Documentation/RelNotes/2.44.4.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Git v2.44.4 Release Notes
=========================

This release merges up the fixes that appears in v2.43.7 to address
the following CVEs: CVE-2025-27613, CVE-2025-27614, CVE-2025-46334,
CVE-2025-46835, CVE-2025-48384, CVE-2025-48385, and CVE-2025-48386.
See the release notes for v2.43.7 for details.
7 changes: 7 additions & 0 deletions Documentation/RelNotes/2.45.4.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Git v2.45.4 Release Notes
=========================

This release merges up the fixes that appears in v2.43.7, and v2.44.4
to address the following CVEs: CVE-2025-27613, CVE-2025-27614,
CVE-2025-46334, CVE-2025-46835, CVE-2025-48384, CVE-2025-48385, and
CVE-2025-48386. See the release notes for v2.43.7 for details.
7 changes: 7 additions & 0 deletions Documentation/RelNotes/2.46.4.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Git v2.46.4 Release Notes
=========================

This release merges up the fixes that appears in v2.43.7, v2.44.4, and
v2.45.4 to address the following CVEs: CVE-2025-27613, CVE-2025-27614,
CVE-2025-46334, CVE-2025-46835, CVE-2025-48384, CVE-2025-48385, and
CVE-2025-48386. See the release notes for v2.43.7 for details.
8 changes: 8 additions & 0 deletions Documentation/RelNotes/2.47.3.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Git v2.47.3 Release Notes
=========================

This release merges up the fixes that appears in v2.43.7, v2.44.4,
v2.45.4, and v2.46.4 to address the following CVEs: CVE-2025-27613,
CVE-2025-27614, CVE-2025-46334, CVE-2025-46835, CVE-2025-48384,
CVE-2025-48385, and CVE-2025-48386. See the release notes for v2.43.7
for details.
8 changes: 8 additions & 0 deletions Documentation/RelNotes/2.48.2.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Git v2.48.2 Release Notes
=========================

This release merges up the fixes that appears in v2.43.7, v2.44.4,
v2.45.4, v2.46.4, and v2.47.3 to address the following CVEs:
CVE-2025-27613, CVE-2025-27614, CVE-2025-46334, CVE-2025-46835,
CVE-2025-48384, CVE-2025-48385, and CVE-2025-48386. See the release
notes for v2.43.7 for details.
12 changes: 12 additions & 0 deletions Documentation/RelNotes/2.49.1.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
Git v2.49.1 Release Notes
=========================

This release merges up the fixes that appear in v2.43.7, v2.44.4,
v2.45.4, v2.46.4, v2.47.3, and v2.48.2 to address the following CVEs:
CVE-2025-27613, CVE-2025-27614, CVE-2025-46334, CVE-2025-46835,
CVE-2025-48384, CVE-2025-48385, and CVE-2025-48386. See the release
notes for v2.43.7 for details.

It also contains some updates to various CI bits to work around
and/or to adjust to the deprecation of use of Ubuntu 20.04 GitHub
Actions CI, updates to to Fedora base image.
8 changes: 8 additions & 0 deletions Documentation/RelNotes/2.50.1.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Git v2.50.1 Release Notes
=========================

This release merges up the fixes that appear in v2.43.7, v2.44.4,
v2.45.4, v2.46.4, v2.47.3, v2.48.2, and v2.49.1 to address the
following CVEs: CVE-2025-27613, CVE-2025-27614, CVE-2025-46334,
CVE-2025-46835, CVE-2025-48384, CVE-2025-48385, and
CVE-2025-48386. See the release notes for v2.43.7 for details.
6 changes: 6 additions & 0 deletions Documentation/RelNotes/2.51.0.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,16 @@ Performance, Internal Implementation, Development Support etc.

* A lot of stale stuff has been removed from the contrib/ hierarchy.

* "git push" and "git fetch" are taught to update refs in batches to
gain performance.


Fixes since v2.50
-----------------

Unless otherwise noted, all the changes in 2.50.X maintenance track,
including security updates, are included in this release.

* A memory-leak in an error code path has been plugged.
(merge 7082da85cb ly/commit-graph-graph-write-leakfix later to maint).

Expand Down
127 changes: 73 additions & 54 deletions builtin/fetch.c
Original file line number Diff line number Diff line change
Expand Up @@ -640,17 +640,13 @@ static struct ref *get_ref_map(struct remote *remote,
return ref_map;
}

#define STORE_REF_ERROR_OTHER 1
#define STORE_REF_ERROR_DF_CONFLICT 2

static int s_update_ref(const char *action,
struct ref *ref,
struct ref_transaction *transaction,
int check_old)
{
char *msg;
char *rla = getenv("GIT_REFLOG_ACTION");
struct ref_transaction *our_transaction = NULL;
struct strbuf err = STRBUF_INIT;
int ret;

Expand All @@ -660,43 +656,10 @@ static int s_update_ref(const char *action,
rla = default_rla.buf;
msg = xstrfmt("%s: %s", rla, action);

/*
* If no transaction was passed to us, we manage the transaction
* ourselves. Otherwise, we trust the caller to handle the transaction
* lifecycle.
*/
if (!transaction) {
transaction = our_transaction = ref_store_transaction_begin(get_main_ref_store(the_repository),
0, &err);
if (!transaction) {
ret = STORE_REF_ERROR_OTHER;
goto out;
}
}

ret = ref_transaction_update(transaction, ref->name, &ref->new_oid,
check_old ? &ref->old_oid : NULL,
NULL, NULL, 0, msg, &err);
if (ret) {
ret = STORE_REF_ERROR_OTHER;
goto out;
}

if (our_transaction) {
switch (ref_transaction_commit(our_transaction, &err)) {
case 0:
break;
case REF_TRANSACTION_ERROR_NAME_CONFLICT:
ret = STORE_REF_ERROR_DF_CONFLICT;
goto out;
default:
ret = STORE_REF_ERROR_OTHER;
goto out;
}
}

out:
ref_transaction_free(our_transaction);
if (ret)
error("%s", err.buf);
strbuf_release(&err);
Expand Down Expand Up @@ -1139,7 +1102,6 @@ N_("it took %.2f seconds to check forced updates; you can use\n"
"to avoid this check\n");

static int store_updated_refs(struct display_state *display_state,
const char *remote_name,
int connectivity_checked,
struct ref_transaction *transaction, struct ref *ref_map,
struct fetch_head *fetch_head,
Expand Down Expand Up @@ -1277,11 +1239,6 @@ static int store_updated_refs(struct display_state *display_state,
}
}

if (rc & STORE_REF_ERROR_DF_CONFLICT)
error(_("some local refs could not be updated; try running\n"
" 'git remote prune %s' to remove any old, conflicting "
"branches"), remote_name);

if (advice_enabled(ADVICE_FETCH_SHOW_FORCED_UPDATES)) {
if (!config->show_forced_updates) {
warning(_(warn_show_forced_updates));
Expand Down Expand Up @@ -1365,9 +1322,8 @@ static int fetch_and_consume_refs(struct display_state *display_state,
}

trace2_region_enter("fetch", "consume_refs", the_repository);
ret = store_updated_refs(display_state, transport->remote->name,
connectivity_checked, transaction, ref_map,
fetch_head, config);
ret = store_updated_refs(display_state, connectivity_checked,
transaction, ref_map, fetch_head, config);
trace2_region_leave("fetch", "consume_refs", the_repository);

out:
Expand Down Expand Up @@ -1687,6 +1643,36 @@ static int set_head(const struct ref *remote_refs, struct remote *remote)
return result;
}

struct ref_rejection_data {
int *retcode;
int conflict_msg_shown;
const char *remote_name;
};

static void ref_transaction_rejection_handler(const char *refname,
const struct object_id *old_oid UNUSED,
const struct object_id *new_oid UNUSED,
const char *old_target UNUSED,
const char *new_target UNUSED,
enum ref_transaction_error err,
void *cb_data)
{
struct ref_rejection_data *data = cb_data;

if (err == REF_TRANSACTION_ERROR_NAME_CONFLICT && !data->conflict_msg_shown) {
error(_("some local refs could not be updated; try running\n"
" 'git remote prune %s' to remove any old, conflicting "
"branches"), data->remote_name);
data->conflict_msg_shown = 1;
} else {
const char *reason = ref_transaction_error_msg(err);

error(_("fetching ref %s failed: %s"), refname, reason);
}

*data->retcode = 1;
}

static int do_fetch(struct transport *transport,
struct refspec *rs,
const struct fetch_config *config)
Expand Down Expand Up @@ -1807,6 +1793,24 @@ static int do_fetch(struct transport *transport,
retcode = 1;
}

/*
* If not atomic, we can still use batched updates, which would be much
* more performant. We don't initiate the transaction before pruning,
* since pruning must be an independent step, to avoid F/D conflicts.
*
* TODO: if reference transactions gain logical conflict resolution, we
* can delete and create refs (with F/D conflicts) in the same transaction
* and this can be moved above the 'prune_refs()' block.
*/
if (!transaction) {
transaction = ref_store_transaction_begin(get_main_ref_store(the_repository),
REF_TRANSACTION_ALLOW_FAILURE, &err);
if (!transaction) {
retcode = -1;
goto cleanup;
}
}

if (fetch_and_consume_refs(&display_state, transport, transaction, ref_map,
&fetch_head, config)) {
retcode = 1;
Expand Down Expand Up @@ -1838,16 +1842,31 @@ static int do_fetch(struct transport *transport,
free_refs(tags_ref_map);
}

if (transaction) {
if (retcode)
goto cleanup;
if (retcode)
goto cleanup;

retcode = ref_transaction_commit(transaction, &err);
retcode = ref_transaction_commit(transaction, &err);
if (retcode) {
/*
* Explicitly handle transaction cleanup to avoid
* aborting an already closed transaction.
*/
ref_transaction_free(transaction);
transaction = NULL;
goto cleanup;
}

if (!atomic_fetch) {
struct ref_rejection_data data = {
.retcode = &retcode,
.conflict_msg_shown = 0,
.remote_name = transport->remote->name,
};

ref_transaction_for_each_rejected_update(transaction,
ref_transaction_rejection_handler,
&data);
if (retcode) {
/*
* Explicitly handle transaction cleanup to avoid
* aborting an already closed transaction.
*/
ref_transaction_free(transaction);
transaction = NULL;
goto cleanup;
Expand Down
Loading