git format-patch --in-reply-to allows header injection. Intended?
Hi,
I just wanted to ask if the --in-reply-to flag of git format-patch is supposed to write the given string unmodified into the email or whether it ought to perform some check against header injection.
For example, if you pass "--in-reply-to=<msgid>\nTo: <[email protected]" (notice lack of trailing >), then the generated email will actually contain a
To: <[email protected]>
header.
(Depending on your shell you might also use "--in-reply-to=cat" to get the above working more easily.)
Is this known and working as intended, or undesired?
Thanks!
Niklas
Quoted 5 lines · Niklas Hambüchen
For example, if you pass "--in-reply-to=<msgid>\nTo: <[email protected]" (notice lack of trailing
>), then the generated email will actually contain a
To: <[email protected]>
header.
While I do not think of a reason to specify such a string to the in-reply-to option (I'd rather edit the output in the editor if I wanted to do anything fancy [*1*]), I do not think there is a reason why you want to add a code to forbid such use, either.
[Footnote]
*1* For that matter, --in-reply-to option itself is superfluous.
Quoted 4 lines · Junio C Hamano
While I do not think of a reason to specify such a string to the in-reply-to option (I'd rather edit the output in the editor if I wanted to do anything fancy [*1*]), I do not think there is a reason why you want to add a code to forbid such use, either.
My question was to find out whether I can pass untrusted user input to --in-reply-to and expect that no header beyond "In-Reply-To" and "References" is modified, but your answer makes clear that I cannot.
A possible alternative might have been that git verifies that the input to --in-reply-to matches the format specified RFC2822 (section 3.6.4.).
Thanks!
Quoted 8 lines · Niklas Hambüchen
Quoted 4 lines · Junio C Hamano
While I do not think of a reason to specify such a string to the in-reply-to option (I'd rather edit the output in the editor if I wanted to do anything fancy [*1*]), I do not think there is a reason why you want to add a code to forbid such use, either.
My question was to find out whether I can pass untrusted user input to
...
Ah, in general, anybody who passes unvetted user input to any Git Porcelain deserves what s/he gets, so perhaps you would want to at least make sure that the input is a single line, or something.