Re: [Extra] Email header / address parsing

John Levine <johnl@taugh.com> Tue, 01 September 2020 17:41 UTC

Return-Path: <johnl@iecc.com>
X-Original-To: extra@ietfa.amsl.com
Delivered-To: extra@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id D87603A0BED for <extra@ietfa.amsl.com>; Tue, 1 Sep 2020 10:41:54 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.851
X-Spam-Level:
X-Spam-Status: No, score=-1.851 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.249, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (2048-bit key) header.d=iecc.com header.b=XH2F6fTA; dkim=pass (2048-bit key) header.d=taugh.com header.b=hmrCMGI4
Received: from mail.ietf.org ([4.31.198.44]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id NoBFRZyG_hAM for <extra@ietfa.amsl.com>; Tue, 1 Sep 2020 10:41:53 -0700 (PDT)
Received: from gal.iecc.com (gal.iecc.com [IPv6:2001:470:1f07:1126:0:43:6f73:7461]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 2AE783A0C07 for <extra@ietf.org>; Tue, 1 Sep 2020 10:41:53 -0700 (PDT)
Received: (qmail 20824 invoked from network); 1 Sep 2020 17:41:52 -0000
DKIM-Signature: v=1; a=rsa-sha256; c=simple; d=iecc.com; h=date:message-id:from:to:cc:subject:in-reply-to:mime-version:content-type:content-transfer-encoding; s=5155.5f4e87e0.k2009; bh=+LxHDqGHBwXLfdWrHOcPtmot2/Two9EJt3Xos4De8Ss=; b=XH2F6fTABz51X13s3IQmu293ffCpj4yreca9Q56PD1DvyInYBxC0YX8lo4q42Ee9AdVMM9AD1m9dD6/m+XF2vuuuOFDeF43DSCmsBzMzE19wsyrV2nL6+JLBvSzFXKe9tgVecCMYQyEKn892T3yiiWCB02JB4sM9VvhNWBU7ZfokoM/H/nvCISJVzpeRcVvjpYKE3s3Y0gPwoKcilLEsROprKAuisj/cu170b/0X3jtwGeLWw5PaC8QTvMZGuZzJ7+AR4gEIzhvNWDm6BXzSN5ycOWbE+V++wz0U1XYzgogaz3vEB/lequOnt7T28sclrxDD62EFXf80S496P39zwQ==
DKIM-Signature: v=1; a=rsa-sha256; c=simple; d=taugh.com; h=date:message-id:from:to:cc:subject:in-reply-to:mime-version:content-type:content-transfer-encoding; s=5155.5f4e87e0.k2009; bh=+LxHDqGHBwXLfdWrHOcPtmot2/Two9EJt3Xos4De8Ss=; b=hmrCMGI4pEJwF2yeUYQi6Na8yQGyz7LsaKLo0IYe93YcJHPwKu2qCZjtCV5u6febdpjU3iRVRrRCrBheQ48M3f1aE8ztaKao6BhjCi2vmFz9e0g/RSz6gvStC2gXPozKl7eTiuGORr3kVCsBx6SQ6RXle5aUJ1PCSpoD/EQjMBEIqequ8MruniC1vpnxaH7umijC1ZRsaC/1/G9w3HhpS/H7wy+SA5vZZEeBES/TeTXmgJbvpZ+WUpXLpdtFjAKi+cmIgFCgnyZtWe/h25KHrkqvyCZw2fT7nIIAe7ymq0iWzRkooIiBqszNSca6vctDrjW6xcRKK6G9m0GuseqLdQ==
Received: from ary.qy ([IPv6:2001:470:1f07:1126::78:696d:6170]) by imap.iecc.com ([IPv6:2001:470:1f07:1126::78:696d:6170]) with ESMTPS (TLS1.2 ECDHE-RSA AES-256-GCM AEAD) via TCP6; 01 Sep 2020 17:41:52 -0000
Received: by ary.qy (Postfix, from userid 501) id C75881F59628; Tue, 1 Sep 2020 13:41:51 -0400 (EDT)
Date: Tue, 01 Sep 2020 13:41:51 -0400
Message-Id: <20200901174151.C75881F59628@ary.qy>
From: John Levine <johnl@taugh.com>
To: extra@ietf.org
Cc: timo@sirainen.com
In-Reply-To: <483BC400-403A-43CE-AEB5-EAE3B5B73080@sirainen.com>
Organization: Taughannock Networks
X-Headerized: yes
Mime-Version: 1.0
Content-type: text/plain; charset="utf-8"
Content-transfer-encoding: 8bit
Archived-At: <https://mailarchive.ietf.org/arch/msg/extra/jdlGk2-adl8TkSslPlhZcRStqT8>
Subject: Re: [Extra] Email header / address parsing
X-BeenThere: extra@ietf.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Email mailstore and eXtensions To Revise or Amend <extra.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/extra>, <mailto:extra-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/extra/>
List-Post: <mailto:extra@ietf.org>
List-Help: <mailto:extra-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/extra>, <mailto:extra-request@ietf.org?subject=subscribe>
X-List-Received-Date: Tue, 01 Sep 2020 17:41:55 -0000

In article <483BC400-403A-43CE-AEB5-EAE3B5B73080@sirainen.com> you write:
>Hi,
>
>I was reading https://www.usenix.org/system/files/sec20-chen-jianjun.pdf and started wondering if IMAP should be
>handling some of this better. Especially for generating ENVELOPE. We could even still have time to add
>recommendations to IMAP4rev2?
>
>For example:
> - From: user@attacker.com <user@real.com>
> - From: <user@attacker.com, <user@real.com>

But the former is completely valid and occasionally useful, and the
latter is a syntax error. Don't we already have a "don't do that" rule
for invalid syntax?

>2a) Space preceding the first header name

That's a continuation line.

>2b) Space after From header: Again

Not sure what you mean but that's probably valid.

>2c) Folding space before ":"

Not valid but I don't think I've ever seen it.

Over in DMARC land people have been arguing for years about what to do
about misleading display names, and getting nowhere. 

While I certainly believe that it's possible to do spam filtering
looking for patterns that are likely to be phishes, I really don't
think that the IMAP address parser is the place to do it.

R's,
John