Skip to content

Derive generated signing key IDs from public key content#19971

Draft
gamesguru wants to merge 19 commits into
element-hq:developfrom
gamesguru:guru/fix/msc4499-less-naive-key-ids
Draft

Derive generated signing key IDs from public key content#19971
gamesguru wants to merge 19 commits into
element-hq:developfrom
gamesguru:guru/fix/msc4499-less-naive-key-ids

Conversation

@gamesguru

Copy link
Copy Markdown

Fix accidental reuse of numeric signing key IDs, i.e., ed25519:1, which can break federation, by phasing in content-derived key IDs.

The generated IDs are normalized to stay compatible with homeservers that require spec-compliant key IDs (Dendrite, Conduit, and potentially more).

Synapse now logs a WARN when it loads existing purely numeric ID signing keys. It logs an ERROR (non-panicking) if the key ID is invalid per spec regex. It logs an INFO message if those keys appear non-content-derived.

Partially (see caveats below) closes issue: #8307

NOTE: Synapse admins who configured illegal key IDs and have not upgraded will need to troubleshoot the cause of their rejections. That means if an admin already has a non-compliant key ID, they still need to replace or regenerate that key manually. This PR does not clean it up for them.

TODO: phase out/reject newly introduced non-content-derived key IDs (loaded via signing_key or signing_key_path). So this PR only addresses cause 1 and there are still causes 2 and 3 left.

gamesguru and others added 19 commits July 15, 2026 05:32
The deprecated one-column format was previously auto-migrated in
place; a recent commit replaced that with a hard ConfigError, which
would break startup for any deployment still on that old format.
Restore the auto-migration, now writing the migrated key with the
new content-derived key id instead of a random suffix.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
generate_signing_key.py was importing a private, underscore-prefixed
helper from synapse.config.key, which drags in jsonschema and the
rest of the config module just to generate a key. Move the
content-derived key id logic into a small standalone module with no
heavy dependencies, and have both the config loader and the CLI
script import from there.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant