Commit Graph
1 Commits
Author SHA1 Message Date
Willie ec9b3e688c fix(server): refuse dashboard changes sent from other sites (#810)
A web page can submit a form or a no-cors fetch to the local dashboard
without a CORS preflight, and the handlers accept a text/plain or empty
body. Only the MCP, Hooks and Plugins routes checked where a request
came from, so any site the user visited could add targets, install,
sync, commit, push or upgrade, whenever the browser let the request
reach localhost.

Every POST, PUT, PATCH and DELETE now needs Fetch Metadata, when sent,
to say same-origin, and Origin, when sent, to match the Host. A client
that sends neither, such as curl, is unchanged, because a page cannot
make a browser omit both on a cross-origin request. The update stream
runs updates over GET, as EventSource only opens GET, so it gets the
same check.

The nginx example now forwards $http_host, which keeps the port, since
a proxy that drops it would now fail every change, not only MCP.
2026-11-09 11:08:43 +08:00