mirror of
https://github.com/element-hq/synapse.git
synced 2026-11-12 12:08:18 +00:00
### Pull Request Checklist A notary key query that leaves out minimum_valid_until_ts is rejected with errcode M_MISSING_PARAM and an error naming that field as required. Callers that follow the server-server API, where the timestamp is optional and the server is supposed to use the current time, cannot complete the query. The criteria model typed minimum_valid_until_ts as an integer or null but gave it no default, so validation treated the field as required and failed before the query ran. An explicit null was already a separate accepted value, used for half-lifetime cache behaviour, and was not the same as omitting the field. The field now defaults to null, so an omitted timestamp validates. After parsing, each key whose criteria did not include the field is replaced with a copy that sets minimum_valid_until_ts to the current time in milliseconds. Explicit null is left unchanged, and an empty key-id map is left unchanged so a request for every cached key still ignores validity. Tests cover the omitted timestamp against cache lifetime, mixed criteria including zero and null, non-integer timestamps, and a body without server_keys, and a bugfix newsfragment records the default. Ran `python3 -m pytest -q tests/rest/key/v2/test_remote_key_resource.py` in a Linux container (`python:3.12`) for the synapse RemoteKey change; 7 tests passed. The tests in `tests/rest/key/v2/test_remote_key_resource.py` fail without the fix in the synapse RemoteKey change (checked by reverting the source changes). Fixes #20466 --------- Co-authored-by: Matt Van Horn <455140+mvanhorn@users.noreply.github.com>