Skip to content
This repository was archived by the owner on Apr 26, 2024. It is now read-only.
This repository was archived by the owner on Apr 26, 2024. It is now read-only.

StoreKeyFetcher seems to do nothing if not using a trusted key server #15171

Closed
@DMRobertson

Description

@DMRobertson

Suppose we try to fetch keys from some homeserver we've never heard of.

We'll first try to use StoreKeyFetcher, which calls

res = await self.store.get_server_verify_keys(key_ids_to_fetch)
to read from server_signature_keys:
sql = (
"SELECT server_name, key_id, verify_key, ts_valid_until_ms "
"FROM server_signature_keys WHERE 1=0"
) + " OR (server_name=? AND key_id=?)" * len(batch)

That will return no keys. So next we'll try the PerspectivesKeyFetcher, but that will do nothing because we have no trusted key server configured.

So next we try the ServerKeyFetcher. That will fetch keys via

keys = await self.get_server_verify_keys_v2_direct(server_name)

and

return await self.process_v2_response(
from_server=server_name,
response_json=response,
time_added_ms=time_now_ms,
)

before caling

self.store.store_server_keys_json,

which writes to server_keys_json.

If we try to re-fetch keys for that server, we'll try the StoreKeyFetcher. But as we saw above, that reads from a different table (server_signature_keys). So we'll end up repeating the same steps and making another federation request via ServerKeyFetcher.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-FederationA-PerformancePerformance, both client-facing and admin-facingS-TolerableMinor significance, cosmetic issues, low or no impact to users.T-DefectBugs, crashes, hangs, security vulnerabilities, or other reported issues.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions