Repository navigation
fix(docker): keep Synapse's admin API off the all-in-one image's port - #161
Merged
Merged
Conversation
argiad
force-pushed
the
fix/allinone-block-synapse-admin
branch
from
November 8, 2026 22:07
cf7acb6 to
fb9095d
Compare
The all-in-one try-it image's nginx sent every path it does not route elsewhere to Synapse, so /_synapse/admin/* was reachable on the published port 8008. /_synapse/admin/v1/server_version answered without a token. nginx now returns 404 for /_synapse/admin, as Synapse's reverse-proxy guidance asks and as PR #160 does for the Traefik stack. Nothing in the image needs it through nginx: mm-core's homeserver URL and the init's SYNAPSE_URL are both http://127.0.0.1:8009. The image smoke test now asserts /_matrix/client/versions is 200 and /_synapse/admin/v1/server_version (plain and percent-encoded) is 404 through :8008. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
argiad
force-pushed
the
fix/allinone-block-synapse-admin
branch
from
November 8, 2026 22:13
fb9095d to
0e61809
Compare
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The all-in-one try-it image (
matrixmedia-allinone:dev, from #152) ends its nginx config withlocation / { proxy_pass http://127.0.0.1:8009; }. Every path nginx doesn't route elsewhere goes to Synapse,/_synapse/admin/*included, on the published port 8008./_synapse/admin/v1/server_versionanswers without a token. #160 closed the same hole in the Traefik stack and the Helm chart; this image has its own nginx, so #160 didn't cover it.Change
infra/docker/allinone/nginx.conf:location ^~ /_synapse/admin { return 404; }, next to the existing 404s for/_mm/switch/metricsand/_mm/. This follows Synapse's reverse-proxy guidance./_matrix,/_synapse/clientand/.well-known/matrixstill reach Synapse..github/workflows/allinone-image.ymlsmoke test: a smallexpect_statushelper asserts these through:8008:/_matrix/client/versions→ 200/_synapse/admin/v1/server_version→ 404/_synapse/%61dmin/v1/server_version→ 404 (nginx matches the decoded path; this keeps it that way)CHANGELOG.md:[Unreleased]→ Security entry. It goes at the end of the section, so it won't conflict with fix(deploy): keep Synapse's admin API off the internet #160's entry at the top.Nothing in the image needs it through nginx
mm-allinone.sh:SYNAPSE_URL=http://127.0.0.1:8009. mm-core getsMM_MATRIX_HOMESERVER_URL=$SYNAPSE_URL. The public URL (MM_MATRIX_PUBLIC_HOMESERVER_URL) is only handed back to clients after signup.matrix.homeserver_url:SynapseAdminClient(startup.rs), moderation, rooms, membership and the/_mm/admin/v1/synapse/*proxy.register_new_matrix_userand the init's admin login both use$SYNAPSE_URL.web/references_synapse.Verification (local, Docker Desktop, arm64)
Ran the workflow's own "Smoke test" step, extracted from the YAML unchanged with only the image tag swapped:
matrixmedia-allinoneimage built fromdevelopment: itsnginx.conf,supervisord.confandmm-allinone.share byte-identical todevelopment. The step fails:GET /_synapse/admin/v1/server_version through :8008 gave HTTP 200, want 404.nginx.conf. The step passes: both starts reach healthy,smoke test passed.Extra probes on the fixed container:
/_synapse/admin,/_synapse/admin/,/_synapse/admin/v2/users/_synapse/%61dmin/…,/_synapse%2Fadmin/…,//_synapse/admin/…,/_synapse/./admin/…,/_matrix/../_synapse/admin/…(--path-as-is)/_SYNAPSE/admin/…,/_synapse/ADMIN/…/_matrix/client/versions,/.well-known/matrix/client/_synapse/client/…127.0.0.1:8009/_synapse/admin/v1/server_version/_mm/admin/v1/synapse/users(mm-core → Synapse admin on :8009)actionlintis clean. Test containers and volumes were removed afterwards.After merge
The push to
developmentrepublishes:devand:sha-<short>. Anyone running the image should pull:devagain.🤖 Generated with Claude Code