Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NO_MDC (not integrity protected) message produces empty screen #1144

Closed
tomholub opened this issue Dec 2, 2021 · 18 comments · Fixed by #1219
Closed

NO_MDC (not integrity protected) message produces empty screen #1144

tomholub opened this issue Dec 2, 2021 · 18 comments · Fixed by #1219
Assignees

Comments

@tomholub
Copy link
Collaborator

tomholub commented Dec 2, 2021

@tomholub, I have retested the latest master branch and there is only one that is not working properly at the moment.

This message has no description at all, where it should be flagged as NO_MDC - Missing integrity checks
263035028_427045735587244_8435958667037311091_n

Originally posted by @martgil in #704 (comment)

@tomholub tomholub added this to the 0.6.0: Maintenance milestone Dec 2, 2021
@tomholub
Copy link
Collaborator Author

tomholub commented Dec 2, 2021

@martgil can you confirm we have a message like this on e2e account and you can reproduce it there?

@martgil
Copy link
Collaborator

martgil commented Dec 3, 2021

Hi @tomholub, Yes sir, the message is also included on the e2e account. The same happens for the e2e account - with the latest ios build.

Screen Shot 2021-12-03 at 12 23 47 PM

@tomholub
Copy link
Collaborator Author

tomholub commented Dec 6, 2021

There's a test added in #1154 that needs to also be updated once fixed

@ivan-ushakov
Copy link
Contributor

@tomholub
Am I right that we just show alert about MDC and not decrypt message at all?

@tomholub
Copy link
Collaborator Author

tomholub commented Dec 7, 2021

We should render the error into the message body just like we do for other decrypt errors - no modals.

See related #1143 - we don't want a modal here (except for collecting pass phrase), we want to render the error into the body.

And set badge to "decrypt error" in both cases.

@ivan-ushakov ivan-ushakov added the in progress Work on the issue is in progress label Dec 10, 2021
@ivan-ushakov
Copy link
Contributor

@tomholub
Looks like Endpoints.parseDecryptMsg does not work right and returns plain type. I will try to find what is wrong.

@ivan-ushakov
Copy link
Contributor

ivan-ushakov commented Dec 10, 2021

} else {
  console.log('decrypt error = ' + decryptRes.error.type + ', subject = ' + subject);
  decryptRes.message = undefined;
  sequentialProcessedBlocks.push({
    type: 'decryptErr',
    content: decryptRes.error.type === DecryptErrTypes.noMdc ? decryptRes.content! : rawBlock.content,
    decryptErr: decryptRes,
    complete: true
  });
}

Here I get this - decrypt error = key_mismatch, subject = not integrity protected - should show a warning and not decrypt automatically. So error is key_mismatch, not noMdc

@tomholub
Copy link
Collaborator Author

If that's true, then key_mismatch should be showing a key_mismatch error, not empty result.

Should compare the behavior to Android app and browser extension, for that message.

@ivan-ushakov
Copy link
Contributor

If that's true, then key_mismatch should be showing a key_mismatch error, not empty result.

Should compare the behavior to Android app and browser extension, for that message.

OK, so this one is not about MDC?

@tomholub
Copy link
Collaborator Author

Check how browser extension and Android app renders it and paste screenshots here, then we'll be wiser.

@ivan-ushakov
Copy link
Contributor

Screenshot 2021-12-11 at 22 30 52

I don't have Android app, so here is browser extension

@tomholub
Copy link
Collaborator Author

That's not what I'm seeing. You are missing a key which I added to EKM a week ago. For now the apps don't support ongoing sync of private keys, so you need to reset the extension and go through setup again.

FlowCrypt Settings -> switch to e2e account on top right -> Additional Settings (notice there is just one key) -> Experimental -> scroll down -> reset on the bottom

Then go through setup of e2e account again. This time it should load two keys. Then view the message again. You should see this:

image

Then log out from e2e account on iOS, go through setup there, and continue debugging on iOS.

@ivan-ushakov
Copy link
Contributor

@tomholub
May I add this key to test-utils.ts and write test?

@tomholub
Copy link
Collaborator Author

Yes, it's ok to add this one. Thanks for asking.

@ivan-ushakov
Copy link
Contributor

ivan-ushakov commented Dec 12, 2021

@tomholub

I can reproduce MDC error only using this configuration:

'new-key': {
  pubKey: '-----BEGIN PGP PUBLIC KEY BLOCK-----\r\nVersion: FlowCrypt iOS 0.2 Gmail Encryption\r\nComment: Seamlessly send and receive encrypted email\r\n\r\nxsFNBFn7qV4BEACgKfufG6yseRP9jKXZ1zrM5sQtkGWiKLks1799m0KwIYuA\r\nQyYvw6cIWbM2dcuBNOzYHsLqluqoXaCDbUpK8wI/xnH/9ZHDyomk0ASdyI0K\r\nOgn2Dr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oGl9LjUGnF+AHnJioghMkdPFyhD1Z5yRlDO5jr4bhnR9GQtN2VD6iwIX1t\r\nnMXLIjnk0O7XPCy2k7t+PD8VbD5DdfUWwQARAQABwsFpBBgBCAATBQJZ+6lk\r\nCRCtrCeclQkyBwIbDAAKCRCtrCeclQkyB7m4D/40DjNX41ZE0imTJMM8PsUa\r\nLimYVwxSz3pbNx53Hbjhq7iLEsumtI6Jvl4DVQiaNFam0kgjqtkkIdWsH+sU\r\nlVCFIdolAKxJ3wrQ3UM46u/ihoasv3PLM90BNbyLNj2vMhFo2D1KLwO9Qt8o\r\niF4sjjb1FYN95gWMU9UnyfnmDBp/bw2m3GzKjiYRaF/6kX+XwdpC07MsHzY8\r\nTg1fCvN/YyiA3PdbkEy9xZmjVWZrgjPUgl8d02Vlgk7W8wLu7/slgDO3IfnS\r\nZdP0mHpTaOKbk4SUVE0RSHfkTUvYbpfNF04msRduCEXsQ76J6QjJFJx/akT6\r\n80GEvaLCcmz4KGAUMUgadH5mPCXesbya7HSLKSx7m85OiJ3xIRnXqe7tYX1v\r\nyEjE6szs0EAhpZUP2iqzDy76ffQynQMH6lzQyeHLTGMxZ1OYtyn5SvlHa5np\r\nAJnSVjMsViztlbhfqZPdPC0ZZrt4E0hGLIAGbmDeOFOLyzBBeG/wy0bp4uLH\r\nwfn9cM5lL3XLo+VR0CN8NLfj8h4yVLxIzVAiUGQseonXy+JA0erD2Jht/nns\r\n0DoFWqjcDY5U/LIJVopGhgfctNxISnExyKo4eyq1iVKjt1HIk4RRDptYREgA\r\nfm8L3l8EuB2q1535rkqr/uHHyx+th0vWUnK2IvRWAZZLQZUvVxkxTCG++7xv\r\nEg==\r\n=r2et\r\n-----END PGP PUBLIC KEY BLOCK-----\r\n',
  private: '-----BEGIN PGP PRIVATE KEY BLOCK-----\r\nVersion: FlowCrypt iOS 0.2 Gmail Encryption\r\nComment: Seamlessly send and receive encrypted email\r\n\r\nxcaGBFn7qV4BEACgKfufG6yseRP9jKXZ1zrM5s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\r\nyo4mEWhf+pF/l8HaQtOzLB82PE4NXwrzf2MogNz3W5BMvcWZo1Vma4Iz1IJf\r\nHdNlZYJO1vMC7u/7JYAztyH50mXT9Jh6U2jim5OElFRNEUh35E1L2G6XzRdO\r\nJrEXbghF7EO+iekIyRScf2pE+vNBhL2iwnJs+ChgFDFIGnR+Zjwl3rG8mux0\r\niykse5vOToid8SEZ16nu7WF9b8hIxOrM7NBAIaWVD9oqsw8u+n30Mp0DB+pc\r\n0Mnhy0xjMWdTmLcp+Ur5R2uZ6QCZ0lYzLFYs7ZW4X6mT3TwtGWa7eBNIRiyA\r\nBm5g3jhTi8swQXhv8MtG6eLix8H5/XDOZS91y6PlUdAjfDS34/IeMlS8SM1Q\r\nIlBkLHqJ18viQNHqw9iYbf557NA6BVqo3A2OVPyyCVaKRoYH3LTcSEpxMciq\r\nOHsqtYlSo7dRyJOEUQ6bWERIAH5vC95fBLgdqted+a5Kq/7hx8sfrYdL1lJy\r\ntiL0VgGWS0GVL1cZMUwhvvu8bxI=\r\n=rRS1\r\n-----END PGP PRIVATE KEY BLOCK-----\r\n',
  decrypted: '',
  passphrase: '?',
  longid: '4B5A2FFCE62D9501'
}

ava.default('verify not integrity protected message', async t => {
  const { keys, pubKeys } = getKeypairs('new-key');
  const { json: decryptJson } = parseResponse(await endpoints.parseDecryptMsg({ keys, isEmail: true, verificationPubkeys: pubKeys }, [await getCompatAsset('mime-email-not-integrity-protected')]));
  expect(decryptJson.replyType).equals('plain');
  expect(decryptJson.subject).equals('not integrity protected - should show a warning and not decrypt automatically');
  t.pass();
});

output:

parseDecryptMsg: subject = not integrity protected - should show a warning and not decrypt automatically
keys.encryptedFor: ["4B5A2FFCE62D9501","4B5A2FFCE62D9501"]
error: no_mdc, subject: not integrity protected - should show a warning and not decrypt automatically

But in code for this key we use first longid as primary:

Printing description of key.ids:
2 elements
 0 : KeyId
    - longid : "ADAC279C95093207"
    - fingerprint : "E8F0517BA6D7DAB6081C96E4ADAC279C95093207"
 1 : KeyId
    - longid : "4B5A2FFCE62D9501"
    - fingerprint : "F9CEDAA4BE95A0074343E0694B5A2FFCE62D9501"

in code:

extension PrvKeyInfo {
    init(keyInfo: KeyInfo, passphrase: String?) {
        self.private = keyInfo.private
        self.longid = keyInfo.primaryLongid
        self.passphrase = keyInfo.passphrase ?? passphrase
        self.fingerprints = keyInfo.allFingerprints
    }

    func copy(with passphrase: String) -> PrvKeyInfo {
        PrvKeyInfo(private: self.private,
                   longid: self.longid,
                   passphrase: self.passphrase ?? passphrase,
                   fingerprints: self.fingerprints)
    }
}

I guess this is the reason why we get key_mismatch instead of no_mdc.

@ivan-ushakov
Copy link
Contributor

@tomholub
Do you want to change this and provide all longid to Core?

@tomholub
Copy link
Collaborator Author

I'll have to take a look myself. You can move onto another issue until I have some feedback.

@tomholub
Copy link
Collaborator Author

Please make a draft PR if you wrote a new test that can be debugged. Thanks!

@ivan-ushakov ivan-ushakov removed the in progress Work on the issue is in progress label Dec 13, 2021
@ivan-ushakov ivan-ushakov removed their assignment Dec 19, 2021
tomholub added a commit that referenced this issue Dec 21, 2021
* Draft unit test for integrity check

* updated tests

* fix rendering blockParseErr

* fix no-mdc error

* fix attachment with mismatch key

* simplify

* rename test

* fix

* PR comments

Co-authored-by: tomholub <[email protected]>
Co-authored-by: Roma Sosnovsky <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants