{"thread":{"id":"29543","subject":"[PATCH] send-email: add extra safetly in address sanitazion","startedAt":"2012-02-04T15:10:55Z","lastAt":"2012-02-05T21:20:03Z","messageCount":4,"participants":["Felipe Contreras","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"183827","messageId":"1328368255-10591-1-git-send-email-felipe.contreras@gmail.com","threadId":"29543","inReplyTo":null,"subject":"[PATCH] send-email: add extra safetly in address sanitazion","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2012-02-04T15:10:55Z","receivedAt":"2012-02-04T15:10:55Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"Otherwise, 'git send-email' would be happy to do:\n\n % git send-email --to '<foo@bar.com>>'\n\nAnd use '<foo@bar.com>>' in the headers.\n\nSigned-off-by: Felipe Contreras <felipe.contreras@gmail.com>\n---\n git-send-email.perl |    2 +-\n 1 files changed, 1 insertions(+), 1 deletions(-)\n\ndiff --git a/git-send-email.perl b/git-send-email.perl\nindex ef30c55..b8bf014 100755\n--- a/git-send-email.perl\n+++ b/git-send-email.perl\n@@ -889,7 +889,7 @@ sub is_rfc2047_quoted {\n # use the simplest quoting being able to handle the recipient\n sub sanitize_address {\n \tmy ($recipient) = @_;\n-\tmy ($recipient_name, $recipient_addr) = ($recipient =~ /^(.*?)\\s*(<.*)/);\n+\tmy ($recipient_name, $recipient_addr) = ($recipient =~ /^(.*?)\\s*(<.*?>)/);\n \n \tif (not $recipient_name) {\n \t\treturn $recipient;\n-- \n1.7.9\n"},{"id":"183828","messageId":"CAMP44s0xfbxLs_r81ppO9hYf3ML_gaYCaW3TKpLM=BjfaM8vHg@mail.gmail.com","threadId":"29543","inReplyTo":"1328368255-10591-1-git-send-email-felipe.contreras@gmail.com","subject":"Re: [PATCH] send-email: add extra safetly in address sanitazion","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2012-02-04T15:26:01Z","receivedAt":"2012-02-04T15:26:01Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"On Sat, Feb 4, 2012 at 5:10 PM, Felipe Contreras\n<felipe.contreras@gmail.com> wrote:\n> Otherwise, 'git send-email' would be happy to do:\n>\n>  % git send-email --to '<foo@bar.com>>'\n>\n> And use '<foo@bar.com>>' in the headers.\n\nEr, actually that's not correct: '<foo@bar.com>>' will remain the\nsame, but 'Foo <foo@bar.com>>' will be sanitized.\n\n-- \nFelipe Contreras\n"},{"id":"183919","messageId":"7v4nv5gf2n.fsf@alter.siamese.dyndns.org","threadId":"29543","inReplyTo":"CAMP44s0xfbxLs_r81ppO9hYf3ML_gaYCaW3TKpLM=BjfaM8vHg@mail.gmail.com","subject":"Re: [PATCH] send-email: add extra safetly in address sanitazion","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-02-05T21:12:16Z","receivedAt":"2012-02-05T21:12:16Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Felipe Contreras <felipe.contreras@gmail.com> writes:\n\n> On Sat, Feb 4, 2012 at 5:10 PM, Felipe Contreras\n> <felipe.contreras@gmail.com> wrote:\n>> Otherwise, 'git send-email' would be happy to do:\n>>\n>>  % git send-email --to '<foo@bar.com>>'\n>>\n>> And use '<foo@bar.com>>' in the headers.\n>\n> Er, actually that's not correct: '<foo@bar.com>>' will remain the\n> same, but 'Foo <foo@bar.com>>' will be sanitized.\n\nI suspect that this \"Er\" is merely a sympotom of a larger issue in the\napproach taken by this patch.  The code takes a potentially malformed\ninput, and applies a rewrite logic without telling the user what it is\ndoing.  If the rewrite logic is perfect, that may be OK, but if not, the\nlogic to rewrite may or may not trigger, or when it triggers it may or may\nnot produce a correct result, and it all depends on the nature of breakage\nin the input.\n\nWouldn't a better approach to detect problem on the input side and reject\na wrong one by erroring out, so that the user has a chance to fix?\n"},{"id":"183921","messageId":"CAMP44s1NrGkz7sKz2CTF2XV9uGUfethg2+pcybPe2KBY02cnwA@mail.gmail.com","threadId":"29543","inReplyTo":"7v4nv5gf2n.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH] send-email: add extra safetly in address sanitazion","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2012-02-05T21:20:03Z","receivedAt":"2012-02-05T21:20:03Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"On Sun, Feb 5, 2012 at 11:12 PM, Junio C Hamano <gitster@pobox.com> wrote:\n> Felipe Contreras <felipe.contreras@gmail.com> writes:\n>\n>> On Sat, Feb 4, 2012 at 5:10 PM, Felipe Contreras\n>> <felipe.contreras@gmail.com> wrote:\n>>> Otherwise, 'git send-email' would be happy to do:\n>>>\n>>>  % git send-email --to '<foo@bar.com>>'\n>>>\n>>> And use '<foo@bar.com>>' in the headers.\n>>\n>> Er, actually that's not correct: '<foo@bar.com>>' will remain the\n>> same, but 'Foo <foo@bar.com>>' will be sanitized.\n>\n> I suspect that this \"Er\" is merely a sympotom of a larger issue in the\n> approach taken by this patch.  The code takes a potentially malformed\n> input, and applies a rewrite logic without telling the user what it is\n> doing.\n\nThat's what the function is doing already: sanitizing the address.\n\n> Wouldn't a better approach to detect problem on the input side and reject\n> a wrong one by erroring out, so that the user has a chance to fix?\n\nPerhaps, but the code is not prepared for that. Anyway, feel free to\ndrop it, I am not interested in pursing this.\n\nCheers.\n\n-- \nFelipe Contreras\n"}]}