lieser / dkim_verifier

DKIM Verifier Extension for Mozilla Thunderbird
MIT License
213 stars 36 forks source link

Exception (NS_ERROR_MALFORMED_URI) while looking for favicon #229

Closed alevesely closed 3 years ago

alevesely commented 3 years ago

Here's the log:

12/4/2020, 09:34:42 DKIM_Verifier.ARHParser DEBUG   ({resinfo:[{method:"spf", method_version:1, result:"pass", propertys:{smtp:{mailfrom:"ietf.org"}, header:{}, body:{}, policy:{}}}, {method:"dkim", method_version:1, result:"pass", reason:"transformed", propertys:{smtp:{}, header:{i:"\"dkim+MSA-tls@aegee.org\""}, body:{}, policy:{}}}, {method:"dkim", method_version:1, result:"pass", propertys:{smtp:{}, header:{d:"ietf.org", b:"n9lJrH6R"}, body:{}, policy:{}}}, {method:"dkim", method_version:1, result:"pass", propertys:{smtp:{}, header:{d:"ietf.org", b:"DzY7W1bb"}, body:{}, policy:{}}}], authserv_id:"wmail.tana.it", authres_version:1})
ARHParser.jsm:176
12/4/2020, 09:34:42 DKIM_Verifier.ARHParser DEBUG   ({resinfo:[{method:"dnswl", method_version:1, result:"pass", propertys:{smtp:{}, header:{}, body:{}, policy:{ip:"127.0.9.2", txt:"\"ietf.org https://dnswl.org/s/?s=1703\""}, dns:{zone:"list.dnswl.org"}}}], authserv_id:"wmail.tana.it", authres_version:1})
ARHParser.jsm:176
12/4/2020, 09:34:42 DKIM_Verifier.Policy    DEBUG   Warning: DKIM_SIGWARNING_FROM_NOT_IN_SDID
3 dkimPolicy.jsm:405
12/4/2020, 09:34:42 DKIM_Verifier.Policy    WARN    [Exception... "Component returned failure code: 0x804b000a (NS_ERROR_MALFORMED_URI) [nsIIOService.newURI]"  nsresult: "0x804b000a (NS_ERROR_MALFORMED_URI)"  location: "JS frame :: resource://dkim_verifier/helper.jsm :: getBaseDomainFromAddr :: line 204"  data: no] Stack trace: getBaseDomainFromAddr()@resource://dkim_verifier/helper.jsm:204
Policy_getFavicon/promise<()@resource://dkim_verifier/dkimPolicy.jsm:430
Policy_getFavicon()@resource://dkim_verifier/dkimPolicy.jsm:437
addFavicons()@resource://dkim_verifier/AuthVerifier.jsm:689
dkimPolicy.jsm:440
12/4/2020, 09:34:42 DKIM_Verifier.AuthVerifier  WARN    [Exception... "Component returned failure code: 0x804b000a (NS_ERROR_MALFORMED_URI) [nsIIOService.newURI]"  nsresult: "0x804b000a (NS_ERROR_MALFORMED_URI)"  location: "JS frame :: resource://dkim_verifier/helper.jsm :: getBaseDomainFromAddr :: line 204"  data: no] Stack trace: getBaseDomainFromAddr()@resource://dkim_verifier/helper.jsm:204
Policy_getFavicon/promise<()@resource://dkim_verifier/dkimPolicy.jsm:430
Policy_getFavicon()@resource://dkim_verifier/dkimPolicy.jsm:437
addFavicons()@resource://dkim_verifier/AuthVerifier.jsm:689
AuthVerifier.jsm:189
12/4/2020, 09:34:42 DKIM_Verifier.Display   FATAL   [Exception... "Component returned failure code: 0x804b000a (NS_ERROR_MALFORMED_URI) [nsIIOService.newURI]"  nsresult: "0x804b000a (NS_ERROR_MALFORMED_URI)"  location: "JS frame :: resource://dkim_verifier/helper.jsm :: getBaseDomainFromAddr :: line 204"  data: no] Stack trace: getBaseDomainFromAddr()@resource://dkim_verifier/helper.jsm:204
Policy_getFavicon/promise<()@resource://dkim_verifier/dkimPolicy.jsm:430
Policy_getFavicon()@resource://dkim_verifier/dkimPolicy.jsm:437
addFavicons()@resource://dkim_verifier/AuthVerifier.jsm:689

A-R fields seem to parse correctly:

Authentication-Results: wmail.tana.it;
  spf=pass smtp.mailfrom=ietf.org;
  dkim=pass reason="transformed" (whitelisted) header.i="dkim+MSA-tls@aegee.org";
  dkim=pass (whitelisted) header.d=ietf.org
    header.b=n9lJrH6R;
  dkim=pass (whitelisted) header.d=ietf.org
    header.b=DzY7W1bb

Authentication-Results: wmail.tana.it;
    dnswl=pass dns.zone=list.dnswl.org
    policy.ip=127.0.9.2
    policy.txt="ietf.org https://dnswl.org/s/?s=1703"

Signatures:

DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ietf.org; s=ietf1;
    t=1607022701; bh=QbMOJm7uHAq8EpeiTc4ebag+pPln+AzfMia2Ul+F7Oo=;
    h=From:To:Date:In-Reply-To:References:Subject:List-Id:
     List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe;
    b=n9lJrH6RWyJF+KbwCJCrMvsO2uVy4ZluneADuUDvqoTlXa36OLMxfaiFrkrUx7tQQ
     TQHBXJVJCfADfrw3cLwyavAtirf0/zG6Rlnmu5EelqmEVeWti6LcFoDvbvKkzDDhFz
     9Zfkkfjpjrc6zlNPNNCHKT65Y+Knks658ZZDbxkM=

DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ietf.org; s=ietf1;
    t=1607022685; bh=QbMOJm7uHAq8EpeiTc4ebag+pPln+AzfMia2Ul+F7Oo=;
    h=From:To:Date:In-Reply-To:References:Subject:List-Id:
     List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe;
    b=DzY7W1bbgrwCBj9UQky/bUkOuiQiA9P9wCBshl7mY4f8Rmyg85v3YOA4QH7LMoHkV
     ZKjenRtnnzVjk/Gp9LSjPXXbOi7kOxH39GTh40lmJHNA+iIqjv6w9Y0/oXn9DacEvx
     ohb4UgcA4NYg5oWlWl6csF1mVDUA0uWb1p5R1rUY=

DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=aegee.org; s=k4096;
 t=1607022676; i=dkim+MSA-tls@aegee.org;
 bh=JIS1rtHHpYfx9EuisOB168LQiUYvJJ5JdcNeJXC0TQE=;
 h=Subject:From:To:Date:In-Reply-To:References;
 b=qDSXLgUISDWEUL2+8V3aLC44MG4dAOPltfs0skt9XZ3pzb6KzZS7Y0+BC/Ic0Kiew
 RBXLenq+UJUd6p8a6zzy3NmhBYi6h3FdZE0Ug19/G1rxwHZEbZ78MDbMKf5O58a8eD
 eWjEXJpzs54nlCJQkclt3y7hbxX4+PMrmEj+Z3nBL5dU+L5AC487Sy25RsnVXWpJs+
 ZMcpRKFIEOWsN8HU69exSo63CBTG+Qp6GXz+vc6SYGKIqLQxNviDTmyHhPiYIcPPfy
 gSqLwCgeF7mI2QTDRiejN+LA9VLgLI5oARC6f8ncblseYzGwb9lmE8CxXv30oW22kQ
 NMiXOb+8Crb84W1tze6FWL5D6LY9tlwFwz96pmAOsCqKJ0Rlfk3PFVOxBzFUCVMN6x
 Mg6id3bmt4hbbqFqj+YoJ2AxPooqvOJUITZWftZ4ExmBHjpQs845+BUurrgy+2SReT
 rlLNZSkHx3lS9cc8P7g5YuVYremzBjzmnkaVkoftzYlwzC41OTNhqix+FO6T10mA40
 X19A/UrYXIwjKc+H28ky0bfJjTk5c+E5wkvUwymsGfpEOefqoeyMRFRSp2m+58YGBz
 I2NnkpZQv6TCbZ49P5i5VDRKZacZ7LVYypTKo5KGdzIdFVS1XOELx5pq9R756pyqU5
 VEC5xlBdUUQ75ReCfJNsIQes=
lieser commented 3 years ago

Thanks a lot for reporting. Seems to be a bug how the quoted AUID (header.i="dkim+MSA-tls@aegee.org") inside one of the ARHs is handled by the add-on.

Note as ARHs that cause this bug do not seem to be common, I do not plan to fix it in an 3.x.x version, but only in the upcoming 4.0.0.

lieser commented 3 years ago

Note that if ARH reading is not enabled just to avoid local DKIM verifications, try disabling Reading the Authentication-Results header replaces the add-ons verification in the advanced option as a woraround,

alevesely commented 3 years ago

Now I'm running DKIM Verifier 4.0.0pre4 of December 29, 2020, with TB 78.6.0 .

I tried to open the same message that caused that error. Although I have debug enabled, the error console shows only this:

WebExtensions: DKIM: from address not found (no firstChild) 2 dkimHeader.js:620
DKIM_Verifier.background    FATAL    Unexpected error during onMessageDisplayed Error: expected errorType on PERMFAIL result
    dkimSigResultV2_to_AuthResultDKIM moz-extension://694bf5d4-0ccd-4013-88d6-a4fdb3a218aa/modules/AuthVerifier.mjs.js:532
    SavedAuthResult_to_AuthResult moz-extension://694bf5d4-0ccd-4013-88d6-a4fdb3a218aa/modules/AuthVerifier.mjs.js:640
    verify moz-extension://694bf5d4-0ccd-4013-88d6-a4fdb3a218aa/modules/AuthVerifier.mjs.js:172
background.mjs.js:164:7
    <anonymous> moz-extension://694bf5d4-0ccd-4013-88d6-a4fdb3a218aa/content/background.mjs.js:164

FWIW, the From: line was:

From: =?UTF-8?B?0JTQuNC70Y/QvSDQn9Cw0LvQsNGD0LfQvtCy?=
 <dilyan.palauzov@aegee.org>

Curiously, I cannot reach DKIM Verifier's options. It doesn't show in Tools/ Add-on Options. I have to use Config Editor and search for dkim_verifier. I have this (using grep on prefs.js):

user_pref("extensions.dkim_verifier.arh.read", true);
user_pref("extensions.dkim_verifier.colorFrom", true);
user_pref("extensions.dkim_verifier.debug", true);
user_pref("extensions.dkim_verifier.dns.libunbound.path", "/usr/lib/x86_64-linux-gnu/libunbound.so.8");
user_pref("extensions.dkim_verifier.dns.libunbound.path.relToProfileDir", false);
user_pref("extensions.dkim_verifier.dns.nameserver", "172.25.197.1");
user_pref("extensions.dkim_verifier.dns.resolver", 2);
user_pref("extensions.dkim_verifier.error.detailedReasons", true);
user_pref("extensions.dkim_verifier.error.illformed_i.treatAs", 2);
user_pref("extensions.dkim_verifier.error.key_testmode.ignore", true);
user_pref("extensions.dkim_verifier.showDKIMFromTooltip", 50);
user_pref("extensions.dkim_verifier.showDKIMStatusbarpanel", 40);
user_pref("mail.server.server2.dkim_verifier.arh.allowedAuthserv", "wmail.tana.it tana.it");
user_pref("mail.server.server2.dkim_verifier.arh.read", 1);
user_pref("mail.server.server2.dkim_verifier.dkim.enable", 1);

I'm not clear what should I try to change...

lieser commented 3 years ago

I only go to fix this issue yesterday, so in 4.0.0pre4 it is still broken. Just uploaded a 4.0.0pre4.1 at https://github.com/lieser/dkim_verifier/issues/199#issuecomment-774676192, there the issue with quoted AUID is fixed.

The issue you just reported seems to be something else, will look into it.

Regarding the options: I know it is a little confusing, but the normal way add-ons options are shown in TB 78 is no longer the Tools > Add-on Options menu, like it was in TB 68. You do that now in the add-on manager, see https://support.mozilla.org/en-US/kb/thunderbird-add-ons-frequently-asked-questions#w_how-do-i-configure-add-ons

The prefs.js is the old storage location for the options, and no longer accessible by normal means in WebExtensions. The new location is storage.local, a WebExtension API (https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/storage/local). prefs.js is only used ones at the beginning to migrate the options to the new location, and is afterwards ignored. For now, I decided against an automatic cleanup. Something similar applies to the dkimKey.sqlite and dkimPolicy.sqlite store the add-on added to the profile in previous versions.

lieser commented 3 years ago

The error you saw seems to be a duplicate of #232, which should also be fixed in 4.0.0pre4.1.

alevesely commented 3 years ago

Yup, version 4.0.0pre4.1 of February 8, 2021 works well. Thank you very much!

I copy some text from the console, in case it's useful.

WebExtensions: DKIM: from address not found (no firstChild) 2 dkimHeader.js:620
DKIM_Verifier.AuthVerifier  DEBUG    ARH result: 
{…}
​
dkim: (3) […]
​​
0: {…}
​​​
auid: "dkim+MSA-tls@aegee.org"
​​​
favicon: undefined
​​​
res_num: 10
​​​
result: "SUCCESS"
​​​
result_str: "Valid (Signed by aegee.org)"
​​​
sdid: "aegee.org"
​​​
version: "2.0"
​​​
warnings: []
​​​​
length: 0
​​​​
<prototype>: Array []
​​​
warnings_str: Array []
​​​
<prototype>: Object { … }
​​
1: Object { version: "2.0", result: "SUCCESS", sdid: "ietf.org", … }
​​
2: Object { version: "2.0", result: "SUCCESS", sdid: "ietf.org", … }
​​
length: 3
​​
<prototype>: Array []
​
dmarc: Array []
​
spf: Array [ {…} ]
​
version: "3.0"
​
<prototype>: Object { … }
AuthVerifier.mjs.js:271:6
DKIM_Verifier.AuthVerifier  DEBUG    authResult:  
{…}
​
dkim: (3) […]
​​
0: {…}
​​​
auid: "dkim+MSA-tls@aegee.org"
​​​
favicon: undefined
​​​
res_num: 10
​​​
result: "SUCCESS"
​​​
result_str: "Valid (Signed by aegee.org)"
​​​
sdid: "aegee.org"
​​​
version: "2.0"
​​​
warnings: Array []
​​​
warnings_str: Array []
​​​
<prototype>: Object { … }
​​
1: Object { version: "2.0", result: "SUCCESS", sdid: "ietf.org", … }
​​
2: Object { version: "2.0", result: "SUCCESS", sdid: "ietf.org", … }
​​
length: 3
​​
<prototype>: Array []
​
dmarc: Array []
​
spf: Array [ {…} ]
​
version: "2.1"
​
<prototype>: Object { … }
AuthVerifier.mjs.js:173:7
lieser commented 3 years ago

Thanks for letting me know that it work now. Will close this issue.

The last log you posted seems fine. The DKIM: from address not found (no firstChild) is nothing to worry about.