Commit graph

118 commits

Author SHA1 Message Date
5d0c25a823 Simplify Simple Filter's failover delivery 2024-11-29 11:14:02 +01:00
82368f58c5 Make email lookup case-insensitive 2024-11-29 11:14:02 +01:00
ba23eeb8b3
Update expected cleartext output
Lacre no longer transforms cleartext payloads.
2024-08-23 14:16:28 +02:00
b6155ade96
Improve tests
- Always default to 'python' if PYTHON env. var. unset.
- Enable SQLAlchemy warnings in daemon tests.
- Commit changes in schema initialisation script.
2024-08-23 14:16:28 +02:00
4977185ba1
Add header-only parser and minor test improvements 2024-08-23 14:16:27 +02:00
474d20f32b
Add contract tests for headers-only parsing of email messages 2024-08-23 14:16:27 +02:00
95b1396ee0
Upgrade SQLAlchemy, enable warning capturing 2024-08-23 14:16:27 +02:00
abd3f923fb
Extract expiry calculation from KeyConfirmationQueue 2024-08-23 14:16:27 +02:00
110ea885f2
Deliver cleartext if Unicode encoding or message serialisation fail 2024-03-02 18:36:41 +01:00
3138864d32
Include exception in ExecutionTimeLogger log record
Also: cover ExecutionTimeLogger with a unit test.
2024-03-02 18:06:51 +01:00
04ca103494
Fix unencrypted delivery in case of message generation failure
When we fail to produce byte representation of the email message being
processed, we may end up bouncing a message.  An example of such case would be
a message with a Message-Id header that Python's email parser library cannot
process.

In such cases, just take whatever original content we have received and pass
it to the destination without touching it to minimise any chances of breaking
the overall flow.
2024-03-01 20:14:09 +01:00
bfd3541b18 Retrieve data from db result before returning from Context Manager
SQLAlchemy's connection is a Context Manager and if we return a result from
code wrapped in a Context Manager, its cursor might already be closed.
2024-01-20 18:52:47 +01:00
276e0d0cd4 Use one config for cron and daemon tests 2024-01-07 21:52:52 +01:00
260a3f3e9c Configure pooling for cron tests 2024-01-06 15:26:18 +01:00
a943b50adb Update test configuration after renaming 2024-01-06 15:06:36 +01:00
a98ff611ee Continue renaming: config files, tests, docs 2024-01-06 14:45:09 +01:00
ad3a54fcd7 Rename GPG-Mailgate to Lacre
Update naming in documentation and the source code.
2024-01-06 14:34:54 +01:00
a09fd67a59 Make keys unexpirable 2024-01-05 22:11:14 +01:00
90da933bf9 Make disconnect handling configuration explicit
- Provide a new reuqired parameter: [database]pooling_mode and use it during
  SQLAlchemy engine initialisation.

- Update tests and configuration (including sample configuration).

- Adjust repository unit test to load config during setup.

- Pass an engine instance to repository constructors instead of connections.
  Engine keeps a connection pool and we rely on it.
2023-12-17 14:03:20 +01:00
23a05c11ac Remove EncryptionException formatting test 2023-12-10 21:35:35 +01:00
75c48282b0 Rework encryption exception handling
Also: remove misleading comment about message.defects.
2023-12-09 20:38:46 +01:00
ac5dddfa98 Remove configuration options no longer used 2023-12-02 21:48:17 +01:00
052551072e Change table prefix from 'gpgmw' to 'lacre' 2023-12-02 20:02:59 +01:00
9b5c43b769 Fix crontest config, polish Makefile 2023-11-25 15:05:27 +01:00
becb39f139 Clean up database access
- Don't pass table definitions to repository constructors.

- Keep an internal reference to Engine in lacre.repository.

- Implement KeyConfirmationQueue.count_keys.
2023-11-25 14:04:32 +01:00
4950e0b9c3 Keep secondary keyring for test purposes 2023-11-25 01:13:43 +01:00
72217e38ea GnuPG module: make key-listing more thorough
- Flush key-collecting structures each time a new public key entry is found.
  This will avoid adding sub-keys and overwriting main keys with them.

- Use parseaddr from email.utils to parse emails (and drop realname part).

- Record logs produced during unit tests.

- Fix a small bug in test code.

Also: add basic information about available test identities to testing
documentation.
2023-11-25 01:08:15 +01:00
7c2d32bf3c Make IdentityRepository a KeyRing
- Keep only one class to provide access to identities stored in the database.

- Remove old code and its tests.

- Align KeyRing and IdentityRepository APIs.

- Implement a (very) simple unit test for IdentityRepository.
2023-11-24 22:59:21 +01:00
89affde0d5 Add tests for GnuPG parsing routines 2023-11-20 22:11:37 +01:00
bfa2643dc7 Implement identity repository
Also: rename key_id to fingerprint.
2023-11-20 22:11:25 +01:00
7ac928af76 Handle gpg-mailgate.py missing params better 2023-11-17 22:51:09 +01:00
5e108c189a Replace file-based identity store with a dedicated db table 2023-10-29 19:39:08 +01:00
3dd6913599 Initialise db connection lazily, use isolated asyncio test case 2023-10-23 22:44:53 +02:00
43f43a4137 Fix DatabaseKeyring tests 2023-10-23 20:26:23 +02:00
41442e5b59 Add basic support for RDBMS-based keyring 2023-09-30 22:38:33 +02:00
c570bcd383 Update Alice's key expiry date 2023-09-25 19:44:37 +02:00
624a335a41 GnuPG: clean up and collect more diagnostic info
- Use regular expressions instead of finding particular characters in gnupg
  output to decide whether confirmation line was found.

- Use tempfile.mkdtemp to create secure temporary directories.

- Record information about the key considered by GnuPG. When missing in
  exception, it means no key was found.
2023-09-21 20:21:01 +02:00
a30b5e7577 Handle missing Content-Type properly
- ContentManager sets default Content-Type even if it was missing in the
  original message.

- Make sure that when Content-Type is missing, copying parameters doesn't
  raise an error.

- Add a unit-test to check that.
2023-05-19 20:30:00 +02:00
5a5b6c27a4 Fix tests after rebase 2023-05-08 22:32:19 +02:00
3297bbfcca Clean up and document Advanced Mail Filter E2E test
- Remove unused code.
- Add docstrings.
2023-05-08 22:17:02 +02:00
b3c0235486 Make case-discovery code cleaner and more flexible 2023-05-08 22:17:02 +02:00
0cdbf5ba7d Add emoji test 2023-05-08 22:17:02 +02:00
c08d66ac80 Migrate daemon E2E tests to unittest framework 2023-05-08 22:17:02 +02:00
518b823b5c Fix simple filter: pass policy to as_bytes()
Also: adjust expected test output because it's now Base64-encoded.
2023-05-08 22:17:02 +02:00
459779bea6 Add more test cases 2023-05-08 22:17:02 +02:00
61cf50effe Fix MIME content sub-type handling for non-plain text messages 2023-05-08 22:17:02 +02:00
bc92d7a31c [e2e_test] Identify test cases by iteracting config sections 2023-05-08 22:17:02 +02:00
da0ffb4a51 Add a test message with Emoji 2023-05-08 22:17:02 +02:00
1acb330c02 Rewrite e2e_test to use unittest framework 2023-05-08 22:17:02 +02:00
ff6e0bfbdd Move recipient-processing code to a dedicated module 2023-05-08 22:17:02 +02:00