Skip to content

Commit bd93b8d

Browse files
jgriffithsgitster
authored andcommitted
credential-cache--daemon: disallow relative socket path
Relative socket paths are dangerous since the user cannot generally control when the daemon starts (initially, after a timeout, kill or crash). Since the daemon creates but does not delete the socket directory, this could lead to spurious directory creation relative to the users cwd. Suggested-by: Jeff King <[email protected]> Signed-off-by: Jon Griffiths <[email protected]> Signed-off-by: Jeff King <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent a6e5e28 commit bd93b8d

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

Documentation/git-credential-cache.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ OPTIONS
3636
cache daemon if one is not started). Defaults to
3737
`~/.git-credential-cache/socket`. If your home directory is on a
3838
network-mounted filesystem, you may need to change this to a
39-
local filesystem.
39+
local filesystem. You must specify an absolute path.
4040

4141
CONTROLLING THE DAEMON
4242
----------------------

credential-cache--daemon.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,9 @@ int main(int argc, const char **argv)
262262
if (!socket_path)
263263
usage_with_options(usage, options);
264264

265+
if (!is_absolute_path(socket_path))
266+
die("socket directory must be an absolute path");
267+
265268
init_socket_directory(socket_path);
266269
register_tempfile(&socket_file, socket_path);
267270

0 commit comments

Comments
 (0)