Skip to content

Commit 4d94409

Browse files
dschoGit for Windows Build Agent
authored andcommitted
Merge branch 'v2.53.0.windows.3'
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2 parents bbfe599 + 251424f commit 4d94409

2 files changed

Lines changed: 26 additions & 1 deletion

File tree

.github/workflows/main.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -420,7 +420,9 @@ jobs:
420420
CI_JOB_IMAGE: ${{matrix.vector.image}}
421421
CUSTOM_PATH: /custom
422422
runs-on: ubuntu-latest
423-
container: ${{matrix.vector.image}}
423+
container:
424+
image: ${{ matrix.vector.image }}
425+
options: ${{ github.repository_visibility == 'private' && '--pids-limit 16384 --ulimit nproc=16384:16384 --ulimit nofile=32768:32768' || '' }}
424426
steps:
425427
- name: prepare libc6 for actions
426428
if: matrix.vector.jobname == 'linux32'

compat/mingw.c

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -351,6 +351,29 @@ process_phantom_symlink(const wchar_t *wtarget, const wchar_t *wlink)
351351
wchar_t relative[MAX_PATH];
352352
const wchar_t *rel;
353353

354+
/*
355+
* Do not follow symlinks to network shares, to avoid NTLM credential
356+
* leak from crafted repositories (e.g. \\attacker-server\share).
357+
* Since paths come in all kind of enterprising shapes and forms (in
358+
* addition to the canonical `\\host\share` form, there's also
359+
* `\??\UNC\host\share`, `\GLOBAL??\UNC\host\share` and also
360+
* `\Device\Mup\host\share`, just to name a few), we simply avoid
361+
* following every symlink target that starts with a slash.
362+
*
363+
* This also catches drive-less absolute paths, of course. These are
364+
* uncommon in practice (and also fragile because they are relative to
365+
* the current working directory's drive). The only "harm" this does
366+
* is that it now requires users to specify via the Git attributes if
367+
* they have such an uncommon symbolic link and need it to be a
368+
* directory type link.
369+
*/
370+
if (is_wdir_sep(wtarget[0])) {
371+
warning("created file symlink '%ls' pointing to '%ls';\n"
372+
"set the `symlink` gitattribute to `dir` if a "
373+
"directory symlink is required", wlink, wtarget);
374+
return PHANTOM_SYMLINK_DONE;
375+
}
376+
354377
/* check that wlink is still a file symlink */
355378
if ((GetFileAttributesW(wlink)
356379
& (FILE_ATTRIBUTE_REPARSE_POINT | FILE_ATTRIBUTE_DIRECTORY))

0 commit comments

Comments
 (0)