EFForg / EFForg/cryptobot-email

Detecting pubkeys in encrypted emails fails the first time

Open
#18 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
63
Forks
11
PR merge metrics
No merged PRs in 30d

Description

If you completely the delete the test gpg homedir, some of the tests fail the first time. The tests that fail are ones where it's parsing an encrypted email, decrypting it, and searching for pubkeys.

```
(env)[micah@bones] (master) ~/eff_projects/cryptobot-email$ rm -rf test/homedir/
(env)[micah@bones] (master) ~/eff_projects/cryptobot-email$ ./test.py
..FFF.................
======================================================================
FAIL: test_encrypted_pubkey_included_attached_application_pgpkeys (__main__.BotTest)
----------------------------------------------------------------------
Traceback (most recent call last):
File "./test.py", line 149, in test_encrypted_pubkey_included_attached_application_pgpkeys
self.assertTrue(msg.pubkey_included)
AssertionError: False is not true

======================================================================
FAIL: test_encrypted_pubkey_included_attached_text_plain (__main__.BotTest)
----------------------------------------------------------------------
Traceback (most recent call last):
File "./test.py", line 144, in test_encrypted_pubkey_included_attached_text_plain
self.assertTrue(msg.pubkey_included)
AssertionError: False is not true

======================================================================
FAIL: test_encrypted_pubkey_included_inline (__main__.BotTest)
----------------------------------------------------------------------
Traceback (most recent call last):
File "./test.py", line 154, in test_encrypted_pubkey_included_inline
self.assertTrue(msg.pubkey_included)
AssertionError: False is not true

----------------------------------------------------------------------
Ran 22 tests in 5.885s

FAILED (failures=3)
```

But then if you run the same test a second time, it passes. I assume it's because the pubkeys are already in the keyring, but I need to look more into it:

```
(env)[micah@bones] (master) ~/eff_projects/cryptobot-email$ ./test.py
......................
----------------------------------------------------------------------
Ran 22 tests in 5.507s

OK
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by removing test/homedir/ and running ./test.py to reproduce the three failures in test.py around lines 144-154. Trace the encrypted-email parsing, decryption, and pubkey search on a fresh keyring; done means those tests pass on the first run, with all 22 tests still passing.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cryptography
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.