Skip to content

Commit

Permalink
Fix command injection via malicious repository config
Browse files Browse the repository at this point in the history
This is a mitigation for #45 and is the same method that was implemented
by the fish shell maintainers in
fish-shell/fish-shell#8589
  • Loading branch information
jcharaoui committed Oct 9, 2022
1 parent 8000c7f commit fe8e963
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions powerline_gitstatus/segments.py
Expand Up @@ -27,13 +27,13 @@ def execute(self, pl, command):

def get_base_command(self, cwd, use_dash_c):
if use_dash_c:
return ['git', '-C', cwd]
return ['git', '-c', 'core.fsmonitor=', '-C', cwd]

while cwd and cwd != os.sep:
gitdir = os.path.join(cwd, '.git')

if os.path.isdir(gitdir):
return ['git', '--git-dir=%s' % gitdir, '--work-tree=%s' % cwd]
return ['git', '-c', 'core.fsmonitor=', '--git-dir=%s' % gitdir, '--work-tree=%s' % cwd]

cwd = os.path.dirname(cwd)

Expand Down

0 comments on commit fe8e963

Please sign in to comment.