Skip to content

Commit

Permalink
- show proper error message on ill-formed from (lieser#238)
Browse files Browse the repository at this point in the history
- ignore ill-formed list-id (lieser#262)
  • Loading branch information
dodmi authored and lieser committed Feb 7, 2022
1 parent 499b87e commit 95b6a13
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 3 deletions.
1 change: 1 addition & 0 deletions chrome/locale/de/dkim.properties
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ DKIM_INTERNALERROR = DKIM Verifier: Interner Fehler
DKIM_INTERNALERROR_NAME = Interner Fehler
DKIM_INTERNALERROR_DEFAULT = Fehler";
DKIM_INTERNALERROR_INCORRECT_EMAIL_FORMAT = E-Mail ist nicht richtig formatiert
DKIM_INTERNALERROR_INCORRECT_FROM = Absenderadresse ist falsch formatiert
# DKIM_INTERNALERROR - DNS
DKIM_DNSERROR_UNKNOWN = Fehler im DNS-Resolver
DKIM_DNSERROR_SERVER_ERROR = Fehler bei der Verbindung zum DNS-Server
Expand Down
1 change: 1 addition & 0 deletions chrome/locale/en-US/dkim.properties
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ DKIM_INTERNALERROR = DKIM verifier internal error
DKIM_INTERNALERROR_NAME = Internal error
DKIM_INTERNALERROR_DEFAULT = error
DKIM_INTERNALERROR_INCORRECT_EMAIL_FORMAT = E-mail is not correctly formatted
DKIM_INTERNALERROR_INCORRECT_FROM = From address is ill-formed
# DKIM_INTERNALERROR - DNS
DKIM_DNSERROR_UNKNOWN = Error in the DNS resolver
DKIM_DNSERROR_SERVER_ERROR = Error connecting to the DNS server
Expand Down
1 change: 1 addition & 0 deletions chrome/locale/fr/dkim.properties
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ DKIM_INTERNALERROR = Validation DKIM erreur interne
DKIM_INTERNALERROR_NAME = Erreur interne
DKIM_INTERNALERROR_DEFAULT = erreur
DKIM_INTERNALERROR_INCORRECT_EMAIL_FORMAT = Le courriel n'est pas correctement formaté
DKIM_INTERNALERROR_INCORRECT_FROM = From address is ill-formed
# DKIM_INTERNALERROR - DNS
DKIM_DNSERROR_UNKNOWN = Erreur de résolution DNS
DKIM_DNSERROR_SERVER_ERROR = Erreur de connexion au serveur DNS
Expand Down
1 change: 1 addition & 0 deletions chrome/locale/hu/dkim.properties
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ DKIM_INTERNALERROR = DKIM ellenőrző belső hiba
DKIM_INTERNALERROR_NAME = Belső hiba
DKIM_INTERNALERROR_DEFAULT = hiba
DKIM_INTERNALERROR_INCORRECT_EMAIL_FORMAT = Az e-mail hibás formázott
DKIM_INTERNALERROR_INCORRECT_FROM = From address is ill-formed
# DKIM_INTERNALERROR - DNS
DKIM_DNSERROR_UNKNOWN = A DNS-feloldó hibás
DKIM_DNSERROR_SERVER_ERROR = Hiba történt a DNS-kiszolgálóhoz való csatlakozáskor
Expand Down
1 change: 1 addition & 0 deletions chrome/locale/it/dkim.properties
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ DKIM_INTERNALERROR = Errore interno di DKIM verifier
DKIM_INTERNALERROR_NAME = Errore interno
DKIM_INTERNALERROR_DEFAULT = errore
DKIM_INTERNALERROR_INCORRECT_EMAIL_FORMAT = L’email non è formattata correttamente
DKIM_INTERNALERROR_INCORRECT_FROM = From address is ill-formed
# DKIM_INTERNALERROR - DNS
DKIM_DNSERROR_UNKNOWN = Errore nel risolutore DNS
DKIM_DNSERROR_SERVER_ERROR = Errore durante la connessione al server DNS
Expand Down
1 change: 1 addition & 0 deletions chrome/locale/ja-JP/dkim.properties
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ DKIM_INTERNALERROR = DKIM verifier 内部エラー
DKIM_INTERNALERROR_NAME = 内部エラー
DKIM_INTERNALERROR_DEFAULT = エラー
DKIM_INTERNALERROR_INCORRECT_EMAIL_FORMAT = メールの形式が不正です
DKIM_INTERNALERROR_INCORRECT_FROM = From address is ill-formed
# DKIM_INTERNALERROR - DNS
DKIM_DNSERROR_UNKNOWN = DNS エラー
DKIM_DNSERROR_SERVER_ERROR = DNS サーバ接続エラー
Expand Down
1 change: 1 addition & 0 deletions chrome/locale/zh-CN/dkim.properties
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ DKIM_INTERNALERROR=DKIM 验证内部错误
DKIM_INTERNALERROR_NAME=内部错误
DKIM_INTERNALERROR_DEFAULT=错误
DKIM_INTERNALERROR_INCORRECT_EMAIL_FORMAT=邮件不是正确的格式
DKIM_INTERNALERROR_INCORRECT_FROM = From address is ill-formed
# DKIM_INTERNALERROR - DNS
DKIM_DNSERROR_UNKNOWN=DNS 解析器出错
DKIM_DNSERROR_SERVER_ERROR=连接到 DNS 服务器出错
Expand Down
18 changes: 15 additions & 3 deletions modules/dkimVerifier.jsm
Original file line number Diff line number Diff line change
Expand Up @@ -1462,16 +1462,28 @@ var that = {
// @ts-ignore
let author = msg.headerFields.get("from")[numFrom-1];
author = author.replace(/^From[ \t]*:/i,"");
msg.from = msgHeaderParser.extractHeaderAddressMailboxes(author);
let from;
try {
from = msgHeaderParser.extractHeaderAddressMailboxes(author);
} catch (error) {
throw new DKIM_InternalError("From address is ill-formed", "DKIM_INTERNALERROR_INCORRECT_FROM");
}
msg.from = from;
} else {
throw new DKIM_InternalError("E-Mail has no from address");
}

// get list-id
if (msg.headerFields.has("list-id")) {
// @ts-ignore
msg.listId = msg.headerFields.get("list-id")[0];
msg.listId = msgHeaderParser.extractHeaderAddressMailboxes(msg.listId);
let listId = "";
try {
listId = msg.headerFields.get("list-id")[0];
listId = msgHeaderParser.extractHeaderAddressMailboxes(listId);
} catch (error) {
log.error("Ignoring error in parsing of list-id header", error);
}
msg.listId = listId;
}

// check if msg should be signed by DKIM
Expand Down

0 comments on commit 95b6a13

Please sign in to comment.