Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Assumes entry point is equal to git #30

Open
rickmark opened this issue Mar 22, 2024 · 0 comments
Open

Assumes entry point is equal to git #30

rickmark opened this issue Mar 22, 2024 · 0 comments

Comments

@rickmark
Copy link

// FindGit finds the second git executable on the path, the first being this one.

It seems to me there's a potential defect here as there's more than one "name" for a git operation's executable. For example, if the entry point is git-fetch it will not strictly match git.

Also cases where the first found item is a symlink/hard-link to the second doesn't seem handled. (This case would actually require the true answer be the third on the path - or the second executable not equal to the current executable, don't even get me started on overlays lol)

An answer here is to get the entry executable, find its true location (realpath), test if it a git-* name, and compare if any of the path entries are hard or soft links. Sadly, it can still be that the other is a non-linked copy, and so on and so on...

I think the truth is that this handling of executable chains is more dangerous then is immediately obvious and there's things that can be at play that no defensive coding exists.

Perhaps another mitigation is to allow the direct specification of the "true git client" via an env var, a known path (such as /etc/git/git_shim_binary` that shows the correct value... Lots of options, but navigating the path this way seems very scary (TM)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant