Most active commenters

    ←back to thread

    349 points dgl | 12 comments | | HN request time: 0.435s | source | bottom
    1. Lockal ◴[] No.44503273[source]
    "trivial modification of an existing exploit"...

    Why git does not use Landlock? I know it is Linux-only, but why? "git clone" should only have r/o access to config directory and r/w to clone directory. And no subprocesses. In every exploit demo: "Yep, <s>it goes to a square hole</s> it launches a calculator".

    replies(3): >>44503412 #>>44504345 #>>44506823 #
    2. TheDong ◴[] No.44503412[source]
    > no subprocesses

    I guess you're okay with breaking all git hooks, including post-checkout, because those are subprocesses as a feature.

    You can always run your git operations in a container with seccomp or such if you're not using any of the many features that it breaks

    replies(1): >>44503646 #
    3. Spivak ◴[] No.44503646[source]
    This would also break custom commands. Which if you don't know about it, is a pretty cool feature.

    Drop a git-something executable in your path and you can execute it as git something.

    replies(1): >>44503677 #
    4. byearthithatius ◴[] No.44503677{3}[source]
    Why is this helpful? Just add the executable itself to path and execute it with "something" instead of "git something". Why are we making git an intermediary ? I am kind of stupid and this is genuine.
    replies(6): >>44503817 #>>44503825 #>>44503854 #>>44504029 #>>44504157 #>>44504231 #
    5. wbl ◴[] No.44503817{4}[source]
    Because something might make less sense on its own or conflict with another tool.
    6. mkesper ◴[] No.44503825{4}[source]
    Because it's thematically a part of a git workflow.
    7. joseda-hg ◴[] No.44503854{4}[source]
    Because if it's part of the repo, you don't depend on the host to take the extra step, which, if you're working from ephemeral instances or places where that step would have to be repeated, is a god send
    8. pirates ◴[] No.44504029{4}[source]
    Because the joke doesn’t land if typing “git gud” doesn’t actually do something.

    To your point, I would say that it’s “easy” rather than strictly helpful. There is a plugin I maintain internally that can be invoked by calling “helm <thing>” if I go through the necessary steps to have it installable by the helm plugin command. Under the hood it’s just a small binary that you can put in your $PATH and it’ll work fine, but there are tons of developers and PMs and other people at the company who don’t know what a path variable is, or how to set it, or what a terminal is, or what shell they’re running, or who know that they can do “helm X” and “helm Y”, so why not “helm Z” for my plugin, etc … It would be a hell of a lot easier to just ship the raw executable, but to those people and execs and mangers and stuff, it looks good if I can show it off next to the native stuff.

    Whenever I have to help users with it, I notice that nearly everyone uses it with helm and not calling by the binary directly. It just comes down to the fact that presentation and perceived ease of use counts for a lot when people evaluate whether they want to make a tool part of their workflow.

    9. Izkata ◴[] No.44504157{4}[source]
    It allows things to be added and removed from the main executable without changing the interface. This means if someone has a good idea everyone starts using, and they implemented it as a subcommand like this, it could eventually be integrated into git without anyone having to migrate. Also all the subcommands are implemented as separate executables like this anyway.

    For example in /usr/lib/git-core/ with git 2.25.1 on Ubuntu, "git-rebase" is a symlink to "git". But on an older Centos VM I have access to, in /usr/libexec/git-core/ with git 2.16.5, "git-rebase" is a separate shell script.

    10. sophacles ◴[] No.44504231{4}[source]
    Git itself uses this functionality. On my ubuntu system the path is `/usr/lib/git-core/` and in it you see all sorts of bins for "git commands", e.g `git-rm`, `git-mv`, `git-difftool`, etc. A lot of these are just links back to the git binary these days, but many features begin life as a standalone `git-$X` executable, and back in early git days much more functionality was split across executables. (The ones that are now links back to git are largely for scripting purposes, a lot of git "plugins" and various CI type scripts will call `git-mv` rather than trying to get quoting right around calling `git mv` for example.

    It also helps make plugins easier to distribute. I don't want to have to type `git-x` sometimes and `git y` others, and if I want my plugin to get adoption, I really really don't want that. So things like git-lfs, git-annex, etc can easily be distributed, documented as a plugin, and generally be considered as "a part of git", rather than a separate command.

    This pattern is also not unique to git. Other softwares have followed it, notably cargo.

    11. SSLy ◴[] No.44504345[source]
    > And no subprocesses.

    have you never used git over ssh?

    12. wahern ◴[] No.44506823[source]
    The problem with Landlock, AFAIU, is that it's inherited across exec. OpenBSD's pledge and unveil were deliberately designed to reset across exec by default precisely because the "more secure" behavior makes it difficult or impossible to add to alot of existing code that needs to invoke other programs. It could be done in theory--e.g. by forking a helper process prior to locking down--but that requires a significant refactor all its own, so what ends up happening is that people just abstain from using seccomp or Landlock. Whereas all OpenBSD core utils were quickly modified to make use of pledge and unveil to some extent, and then over time improved to tighten things further; they were designed to permit and promote this sort of easy, incremental deployment.

    I don't know the extent to which Landlock or even unveil would have helped here; maybe they would have only prevented the hook from running during the clone, but not subsequently when it's expected trusted hooks to run. But I'd bet adding unveil support to Git would be an easier task, notwithstanding (or even because of) the way Git invokes subprocesses.