Closed Bug 1509586 Opened 6 years ago Closed 6 years ago

ReferenceError: reference to undefined property "securityInfo" msgCompSecurityInfo.js:48:5

Categories

(MailNews Core :: Composition, enhancement)

enhancement
Not set
normal

Tracking

(thunderbird_esr6064+ fixed, thunderbird64 fixed, thunderbird65 fixed)

RESOLVED FIXED
Thunderbird 65.0
Tracking Status
thunderbird_esr60 64+ fixed
thunderbird64 --- fixed
thunderbird65 --- fixed

People

(Reporter: aceman, Assigned: aceman)

Details

Attachments

(1 file)

Just opening a compose window and using View->"message security info" produces
ReferenceError: reference to undefined property "securityInfo" msgCompSecurityInfo.js:48:5

The code is:
  try {
    if (params.compFields.securityInfo.requireEncryptMessage) {
      allow_ldap_cert_fetching = true;
    }
  }
  catch (e)
  {
  }

If the attribute is optional in params.compFields, we could check for it properly.
Flags: needinfo?(mkmelin+mozilla)
Yes looks like just bad code
Flags: needinfo?(mkmelin+mozilla)
Attached patch 1509586.patchSplinter Review
Looks like a typo or not migrated code, see
https://searchfox.org/comm-central/search?q=requireEncryptMessage&case=true&regexp=false&path=
and
https://searchfox.org/comm-central/source/suite/extensions/smime/content/msgCompSMIMEOverlay.js#223

Further in the msgCompSecurityInfo.js we check for params.smFields.requireEncryptMessage.
Assignee: nobody → acelists
Status: NEW → ASSIGNED
Attachment #9027410 - Flags: review?(mkmelin+mozilla)
I have tested that params.smFields.requireEncryptMessage does properly return 'false' when not composing encrypted message (I have no SMIME cert).
Right, when the code was landed at https://bug119394.bmoattachments.org/attachment.cgi?id=87208 it had .compFields.securityInfo.requireEncryptMessage at at least 2 places.

These days, in msgCompSMIMEOverlay.js params.smFields and params.compFields.composeSecure seems to be the same, due to
https://searchfox.org/comm-central/source/mail/extensions/smime/content/msgCompSMIMEOverlay.js#38 and then https://searchfox.org/comm-central/source/mail/extensions/smime/content/msgCompSMIMEOverlay.js#229 .
Comment on attachment 9027410 [details] [diff] [review]
1509586.patch

Review of attachment 9027410 [details] [diff] [review]:
-----------------------------------------------------------------

Sure, though I'd prefer if you don't declare it a all. It's only used once. There's the strange while loop which only is ever exercised once. You could remove the loop and have and do the rest in 
if (params.smFields.requireEncryptMessage)
Attachment #9027410 - Flags: review?(mkmelin+mozilla) → review+
I have now even imported a SMIME certificate and can toggle to encrypted message and then params.smFields.requireEncryptMessage is 'true'.

I have noticed the strange loop that you say and there is more potential cleanup to do.
Can I do it in a new bug?

The fix here actually allows the following code in the loop to run when params.smFields.requireEncryptMessage is true (encrypted message) and that code tries fetch SMIME certificates for the recipients from LDAP server.
That code was dead due to the error for a long time it seems so that feature was broken.
Fortunately there is another fetch of missing certs when the message is sent so that may be why this went unnoticed.
But this is and enterprise feature which I would propose for ESR60 so the patch should be minimal.
Can we agree on that?
Severity: trivial → normal
Sure, go ahead.
Thanks.
Keywords: checkin-needed
Pushed by mozilla@jorgk.com:
https://hg.mozilla.org/comm-central/rev/fab70cf9e354
Look for requireEncryptMessage in params.smFields in msgCompSecurityInfo.js. r=mkmelin
Status: ASSIGNED → RESOLVED
Closed: 6 years ago
Keywords: checkin-needed
Resolution: --- → FIXED
Target Milestone: --- → Thunderbird 65.0
Comment on attachment 9027410 [details] [diff] [review]
1509586.patch

Uplift, right?
Attachment #9027410 - Flags: approval-comm-esr60+
Attachment #9027410 - Flags: approval-comm-beta+

Hi,

has this fix been applied in 68.* or 78.* ? As I commented in Bug #1275180 fetching S/MIME certificates from an ldap won't work...

You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: