On Mon, May 16, 2022 at 02:46:55PM -0400, Derrick Stolee wrote: > On 5/13/2022 7:37 PM, Glen Choo via GitGitGadget wrote: > > From: Glen Choo <chooglen@xxxxxxxxxx> > > > > Add a config variable, `discovery.bare`, that tells Git whether or not > > it should work with the bare repository it has discovered i.e. Git will > > die() if it discovers a bare repository, but it is not allowed by > > `discovery.bare`. This only affects repository discovery, thus it has no > > effect if discovery was not done (e.g. `--git-dir` was passed). > > > This config is an enum of: > > > > - ["always"|(unset)]: always recognize bare repositories (like Git does > > today) > > - "never": never recognize bare repositories > > > > More values are expected to be added later, and the default is expected > > to change (i.e. to something other than "always"). > > I think it is fine to include the "never" option for users to opt-in to > this super-protected state, but I want to make it very clear that we > should never move to it as a new default. This phrasing of 'something > other than "always"' is key, but it might be good to point out that > "never" is very unlikely to be that default. I am confused, then. What does a user who has some legitimate (non-embedded) bare repositories do if they are skeptical of other bare repositories? I suspect the best answer we would be able to provide with these patches is "use `--git-dir`". What happens to a user who has a combination of legitimate bare repositories, embedded bare repositories that they trust, and other embedded bare repositories that they don't? As far as I can tell, our recommendation with these tools would be to: - run `git config --global discovery.bare never`, and - include `--git-dir=$(pwd)` in any git invocations in bare repositories that they do trust This gets at my concerns from [1] and [2] (mostly [2], in this case) that we're trying to close the embedded bare repos problem with an overly broad solution, at the expense of usability. I can't shake the feeling that something like I described towards the bottom of [2] would give you all of the security guarantees you're after without compromising on usability for non-embedded bare repositories. I'm happy to explore this direction more myself if you don't want to. I would just much rather see us adopt an approach that doesn't break more use-cases than it has to if such a thing can be avoided. I cannot endorse these patches as-is. Thanks, Taylor [1]: https://lore.kernel.org/git/Ylobp7sntKeWTLDX@nand.local/ [2]: https://lore.kernel.org/git/YnmKwLoQCorBnMe2@nand.local/