Skip to content

Commit 22ca537

Browse files
authored
Security Issue (#62)
It is currently possible to overwrite the `repoDir` by sending a repository name that starts with a "/", the `path.resolve` method prioritizes the second argument see the example below. path.resolve("/my/repo/folder","/etc"); // /etc This behavior gives an attacker the ability to create/write/pull repositories from an arbitrary absolute path, this issue could also impact authentication in some cases as it corrupts the repository name.
1 parent 879fec6 commit 22ca537

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/git.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ class Git extends EventEmitter {
143143
this.dirMap = repoDir;
144144
} else {
145145
this.dirMap = (dir) => {
146-
return (path.normalize(dir ? path.resolve(repoDir, dir) : repoDir));
146+
return (path.normalize(dir ? path.join(repoDir, dir) : repoDir));
147147
};
148148
}
149149

0 commit comments

Comments
 (0)