git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v4] git-send-email: Use sanitized address when reading mbox body

From
Junio C Hamano <gitster@pobox.com>
Date
Jul 1, 2024, 18:47 UTC
Message-ID
<xmqqy16lvtix.fsf@gitster.g>
In-Reply-To
<20240701090115.56957-1-csokas.bence@prolan.hu>
"Csókás, Bence" <csokas.bence@prolan.hu> writes:
Show 8 quoted lines
> Addresses that are mentioned on the trailers in the commit log
> ('Signed-off-by: ' etc.) are added to @cc (unless suppressed),
> passed to the SMTP server. However, these hand-written
> addresses may be malformed (e.g. having unquoted commas and
> other punctuation marks in the display-name part).
>
> The code was already calling `sanitize_address()` for suppression
> purposes, so we just have to use the result ($sc) for adding to @cc.

There is a leap between the description of the status quo and your conclusion. "we just have to" becomes valid only after explaining that sanitize_address turns the address-looking string into valid addresses (and we do not want to send to malformed addresses--but that goes without saying).

> Also note that
> `sanitize_address()` does not process the mailbox addresses,
> so it is up to `sendmail` to handle special characters there
> (e.g. there are mailboxes in regular use with '+'-es in them).

I do not quote see the point of this final note. mailboxes with 'q'es in them are also in regular use, and singling out '+' does not make much sense in the context of explaining this change.

>     Changes in v4:
>     * t9001: use ${SQ} instead of double quotes
>     * re-worded message again
OK.  The additional recipient address 
> +	Co-developed-by: "C. O. Developer" <codev@example.com>
to contrast with
> +	Signed-off-by: A. U. Thor <thor.au@example.com>

is a nice touch. We make sure that, with or without necessary quoting in the original, we produce the correct result ;-).

Let's mark it for 'next' soonish, with proposed log message rewritten somewhat.

Thanks.

----- >8 ----- git-send-email: use sanitized address when reading mbox body

Addresses that are mentioned on the trailers in the commit log messages (e.g., "Reviewed-by") are added to the "Cc:" list by "git send-email". These hand-written addresses, however, may be malformed (e.g., having unquoted "." and other punctutation marks in the display-name part) and can upset MTA.

The code does use the sanitize_address() helper on these address-looking strings to turn them into valid addresses, but it is used only to see if the address should be suppressed. The original string taken from the message is added to the @cc list if the code decides the address is not suppressed.

Because the addresses on trailer lines are hand-written and more likely to contain malformed addresses, when adding to the @cc list, use the result from sanitize_address, not the original. Note that we do not modify the behaviour for addresses taken from the e-mail headers, as they are more likely to be machine generated and well-formed.

Signed-off-by: Csókás, Bence <csokas.bence@prolan.hu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Previous: csókásNext: Csókás Bence
Message 2 of 4 in “git-send-email: Use sanitized address when reading mbox body”
  1. git-send-email: Use sanitized address when reading mbox bodycsókás, Jul 1, 2024
  2. Junio C HamanoJul 1, 2024
  3. Csókás BenceJul 3, 2024
  4. Junio C HamanoJul 3, 2024

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.