Skip to content

Commit

Permalink
ignore ill-formed list-id (#262)
Browse files Browse the repository at this point in the history
  • Loading branch information
lieser committed Jul 3, 2021
1 parent 7c59f12 commit 01418e0
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
- show proper error message on ill-formed from (#238)
- ignore ill-formed list-id (#262)

4.0.0 [2021-04-18]
------------------
Expand Down
6 changes: 5 additions & 1 deletion modules/authVerifier.mjs.js
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,11 @@ export default class AuthVerifier {
const listIdHeader = msgParsed.headers.get("list-id");
let listId = "";
if (listIdHeader) {
listId = MsgParser.parseListIdHeader(listIdHeader[0]);
try {
listId = MsgParser.parseListIdHeader(listIdHeader[0]);
} catch (error) {
log.error("Ignoring error in parsing of list-id header", error);
}
}

// read Authentication-Results header
Expand Down
23 changes: 23 additions & 0 deletions test/data/rfc6376-A.2-ill_formed-list_id.eml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
DKIM-Signature: v=1; a=rsa-sha256; s=brisbane; d=example.com;
c=simple/simple; q=dns/txt; i=joe@football.example.com;
h=Received : From : To : Subject : Date : Message-ID;
bh=2jUSOH9NhtVGCQWNr9BrIAPreKQjO6Sn7XIkfJVOzv8=;
b=AuUoFEfDxTDkHlLXSZEpZj79LICEps6eda7W3deTVFOk4yAUoqOB
4nujc7YopdG5dWLSdNg6xNAZpOPr+kHxt1IrE+NahM6L/LbvaHut
KVdkLLkpVaVVQPzeRDI009SO2Il5Lu7rDNH6mZckBdrIx0orEtZV
4bmp/YzhwvcubU4=;
Received: from client1.football.example.com [192.0.2.1]
by submitserver.example.com with SUBMISSION;
Fri, 11 Jul 2003 21:01:54 -0700 (PDT)
From: Joe SixPack <joe@football.example.com>
To: Suzie Q <suzie@shopping.example.net>
Subject: Is dinner ready?
Date: Fri, 11 Jul 2003 21:00:37 -0700 (PDT)
Message-ID: <20030712040037.46341.5F8J@football.example.com>
List-ID: missing-angle-brackets.example.com

Hi.

We lost the game. Are you hungry yet?

Joe.
6 changes: 6 additions & 0 deletions test/unittest/authVerifierSpec.mjs.js
Original file line number Diff line number Diff line change
Expand Up @@ -346,5 +346,11 @@ describe("AuthVerifier [unittest]", function () {
expect(res.dkim[0].result).to.be.equal("PERMFAIL");
expect(res.dkim[0].result_str).to.be.equal("From address is ill-formed");
});

it("ill-formed list-id is ignored", async function () {
const message = await createMessageHeader("rfc6376-A.2-ill_formed-list_id.eml");
const res = await authVerifier.verify(message);
expect(res.dkim[0].result).to.be.equal("SUCCESS");
});
});
});

0 comments on commit 01418e0

Please sign in to comment.