From: Michael Lohmann <git@lohmann.sh>
To: sandals@crustytoothpaste.net
Cc: git@lohmann.sh, git@vger.kernel.org
Subject: Re: Re: [RCF] Secure git against involuntary arb. code execution without feature loss
Date: Thu, 9 Oct 2025 00:25:12 +0200 [thread overview]
Message-ID: <20251008222512.70500-1-git@lohmann.sh> (raw)
In-Reply-To: <aObZPJ3JK-YVI-g7@fruit.crustytoothpaste.net>
(Sorry @Brian, the first time I forgot to add the mailing list in cc,
and the second time I didn't have my mail client under control adding
HTML... Now trying with send-mail again in order to try and reduce the
possible errors. I am sorry, I am still quite inexperienced with the
mailing list and you need to suffer from my stupid mistakes!)
On Wed, 8 Oct 2025 21:35:56, brian m. carlson wrote:
> This has all of the downsides of our existing per-Unix user approach and
> is also more complicated. You'll notice that when we changed to the
> per-Unix user approach, that broke containers, shared repositories, and
> even the detection of whether a directory _is_ a repository, and this
> would do the same thing. It would be even worse for containers because
> if you copied a token into the container from the container user, you'd
> end up polluting that directory with lots of useless tokens that never
> get cleaned up.
Since I never worked in such a scenario, I think I am missing the full
implications. Instead of always requiring that, you could simply set
something like GIT_ALLOW=true or pass `--allow` (or maybe even a _global
only_ config `safe.allow = *` and then you explicitly opt out of this
protection for cases like this.
> It is also easy to bypass, since if we share multiple repositories as
> collaborators, as soon as I can read the secret from one of them, I can
> then write it into any other location.
Then instead of having a single file with all the tokens of users,
create different files with the respective user as the only one allowed
to read.
> It would even be sufficient if we were users on the same system (such
> as is common in universities or some businesses) and I could read the
> repository. Many websites even accidentally expose their `.git`
> directories, which would not only expose their repository but also
> allow attacks against all of the administrator's repositories.
What is different to the current situation then, apart from that you
specifically have to leak that secret and you now have to be targeted
individually and if you notice it being compromised you can rotate it?
Maybe instead of a shared global secret, create individuals you can
revoke independently?
> What would be better to see instead is a config option that restricts
> which external commands (via config options or hooks) can be executed
> from local config. Then it would be possible to say, "Never honour
> local config to execute code." With `includeIf`, this can allowlist
> certain repositories to do that and leave the rest disabled.
>
> Maybe something like this:
>
> [safe]
> config = core.editor
> config = core.fsmonitor
> hook = pre-receive
Interesting idea!
next prev parent reply other threads:[~2025-10-08 22:25 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-08 21:02 [RCF] Secure git against involuntary arb. code execution without feature loss Michael Lohmann
2025-10-08 21:30 ` Taylor Blau
2025-10-08 21:34 ` rsbecker
2025-10-08 21:49 ` Taylor Blau
2025-10-08 22:09 ` Michael Lohmann
2025-10-08 21:35 ` brian m. carlson
2025-10-08 22:25 ` Michael Lohmann [this message]
2025-10-09 5:24 ` Jeff King
2025-10-09 22:43 ` Michael Lohmann
2025-10-13 9:57 ` Submitted patches for "assume unsafe" Michael Lohmann
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20251008222512.70500-1-git@lohmann.sh \
--to=git@lohmann.sh \
--cc=git@vger.kernel.org \
--cc=sandals@crustytoothpaste.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).