git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Damien Miller <djm@mindrot.org>
To: Fabian Stelzer <fs@gigacodes.de>
Cc: Jeff King <peff@peff.net>,
	Johannes Schindelin via GitGitGadget <gitgitgadget@gmail.com>,
	git@vger.kernel.org,
	Johannes Schindelin <johannes.schindelin@gmx.de>,
	pedro martelletto <pedro@yubico.com>
Subject: Re: [PATCH] gpg-interface: trim CR from ssh-keygen -Y find-principals
Date: Mon, 6 Dec 2021 10:06:27 +1100 (AEDT)	[thread overview]
Message-ID: <70cee773-9547-e3cf-9327-ac0213d327e@mindrot.org> (raw)
In-Reply-To: <20211204131149.cvyu7dvf6p66dotq@fs>

On Sat, 4 Dec 2021, Fabian Stelzer wrote:

> > I'm guessing probably not, but when it comes to something with security
> > implications like this, it pays to be extra careful. I'm hoping somebody
> > familiar with the ssh-keygen side and how the rest of the parsing works
> > (like Fabian) can verify that this is OK.
> > 
> 
> A good point. I just tested this and CR is a valid character to use in a
> principal name in the allowed signers file and as of now the principal will be
> passed to the verify call `as is` and everything works just fine. When we
> introduce the patch above a principal with a CR in it will fail to verify.

Are you sure? I thought that we split principals in allowed_signers on
most whitespace, including \r. Follow:

https://github.com/openssh/openssh-portable/blob/e9c7149/sshsig.c#L742
https://github.com/openssh/openssh-portable/blob/e9c7149/misc.c#L452
https://github.com/openssh/openssh-portable/blob/e9c7149/misc.c#L408

> I've added Damien Miller to this thread. He knows more about what the expected
> behaviour for the principal would/should be. I think at the moment almost
> everything except \n or \0 goes. Maybe restricting \r as well would make life
> easier for other uses too?

IMO sensible content for the principals section would be printable, non-
whitespace characters, excluding wildcards ('*', '?'). ssh-keygen mostly
assumes that the file is in good order, but maybe it could be stricter.

> If we add `trust on first use` in a future series I would assume we use the
> email address from the commit/tag author ident when adding a new principal to
> the file. Can the ident contain a CR?
> Even if it did, I would only allow a list of allowed alphanumeric chars to be
> added anyway since a principal can contain wildcards which we obviously don't
> want to trust on first use ;).

Yeah. my mental model for the allowed_signers file is that it's similar
to ~/.ssh/authorized_keys in that it directly controls authn/authz
decisions, and if you put bad stuff in there then you're going to have
a bad day...

-d

  parent reply	other threads:[~2021-12-05 23:13 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-03 13:31 [PATCH] gpg-interface: trim CR from ssh-keygen -Y find-principals Johannes Schindelin via GitGitGadget
2021-12-03 14:18 ` Fabian Stelzer
2021-12-03 15:58 ` Jeff King
2021-12-04 13:11   ` Fabian Stelzer
2021-12-05  5:50     ` Junio C Hamano
     [not found]       ` <CABPYr=y+sDDko9zPxQTOM6Tz4E7CafH7hJc6oB1zv7XYA9KH1A@mail.gmail.com>
2021-12-09 16:33         ` Fabian Stelzer
     [not found]           ` <CABPYr=xfotWvTQK9k1eKHa0kP4SsB=TKKuM0d8cpMb5BtuUZLA@mail.gmail.com>
2021-12-09 17:20             ` Fabian Stelzer
2021-12-30 10:25             ` Fabian Stelzer
2021-12-05 23:06     ` Damien Miller [this message]
2021-12-06  8:39       ` Fabian Stelzer
2022-01-03  9:53 ` [PATCH v2] gpg-interface: trim CR from ssh-keygen Fabian Stelzer
2022-01-03 17:17   ` Eric Sunshine
2022-01-03 23:34     ` Junio C Hamano
2022-01-04  0:41       ` Eric Sunshine
2022-01-04  1:19         ` Junio C Hamano
2022-01-04  3:06           ` Eric Sunshine
2022-01-04 12:55             ` Fabian Stelzer
2022-01-04 19:33               ` Junio C Hamano
2022-01-05  7:09                 ` Eric Sunshine
2022-01-05 10:36                   ` Fabian Stelzer
2022-01-05 20:40                     ` Junio C Hamano
2022-01-06 10:26                       ` Fabian Stelzer
2022-01-06 17:50                         ` Junio C Hamano
2022-01-09 20:49                     ` Eric Sunshine
2022-01-10 12:28                       ` Fabian Stelzer
2022-01-07  9:07   ` [PATCH v3] " Fabian Stelzer
2022-01-09 21:37     ` Eric Sunshine
2022-01-10 12:59       ` Fabian Stelzer
2022-01-10 17:51         ` Junio C Hamano
2022-01-10 17:03       ` Junio C Hamano

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

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=70cee773-9547-e3cf-9327-ac0213d327e@mindrot.org \
    --to=djm@mindrot.org \
    --cc=fs@gigacodes.de \
    --cc=git@vger.kernel.org \
    --cc=gitgitgadget@gmail.com \
    --cc=johannes.schindelin@gmx.de \
    --cc=pedro@yubico.com \
    --cc=peff@peff.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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).