From ca27938257bd9915de15b88d1748cf4075c95b9f Mon Sep 17 00:00:00 2001 From: Eric Eastwood Date: Tue, 7 Oct 2025 10:44:56 -0500 Subject: [PATCH] Align Synapse version string to use `SYNAPSE_VERSION` (#19011) See https://github.com/matrix-org/synapse/pull/12973 where we previously used `version_string="Synapse/" + get_distribution_version_string("matrix-synapse")` everywhere; and then updated to use `version_string=f"Synapse/{SYNAPSE_VERSION}"` for every other place except `synapse/app/homeserver.py` (why?!?!?!). This seems more like a typo than something on purpose especially without any context in the comments or PR. The whole point of that PR was trying to solve the missing git info in version strings. For reference, here is what both variables look like for me locally on the latest `develop`: - `SYNAPSE_VERSION`: `1.139.0 (b=develop,1d2ddbc76e,dirty)` - `VERSION`: `1.139.0` Only reason we may want to do this is to hide the branch name (some sensitive name that exposes a security fix, etc). But we don't hide anything: `https://matrix.org/_matrix/federation/v1/version` ```json { "server": { "name": "Synapse", "version": "1.139.0rc3 (b=matrix-org-hotfixes-priv,f538ed5ac3)" } } ``` On `matrix.org`, the `Server` response header is masked as `cloudflare` which would otherwise show `1.139.0rc3` for everything from the main process. --- This is spawning from looking at the way we setup and start Synapse for homeserver tenant provisioning in the Synapse Pro for Small Hosts project (https://github.com/element-hq/synapse-small-hosts/issues/221) --- changelog.d/19011.bugfix | 1 + synapse/app/homeserver.py | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) create mode 100644 changelog.d/19011.bugfix diff --git a/changelog.d/19011.bugfix b/changelog.d/19011.bugfix new file mode 100644 index 000000000..460c71856 --- /dev/null +++ b/changelog.d/19011.bugfix @@ -0,0 +1 @@ +Update Synapse main process version string to include git info. diff --git a/synapse/app/homeserver.py b/synapse/app/homeserver.py index 3c691906c..c45251d58 100644 --- a/synapse/app/homeserver.py +++ b/synapse/app/homeserver.py @@ -71,7 +71,8 @@ from synapse.rest.well_known import well_known_resource from synapse.server import HomeServer from synapse.storage import DataStore from synapse.types import ISynapseReactor -from synapse.util.check_dependencies import VERSION, check_requirements +from synapse.util import SYNAPSE_VERSION +from synapse.util.check_dependencies import check_requirements from synapse.util.httpresourcetree import create_resource_tree from synapse.util.module_loader import load_module @@ -399,7 +400,7 @@ def setup( hs = SynapseHomeServer( config.server.server_name, config=config, - version_string=f"Synapse/{VERSION}", + version_string=f"Synapse/{SYNAPSE_VERSION}", reactor=reactor, )