fix(matrix): allow configured homeserver login#40449
fix(matrix): allow configured homeserver login#40449gabrielrinaldi wants to merge 4 commits intoopenclaw:mainfrom
Conversation
Greptile SummaryThis PR fixes a Matrix password login failure on operator-controlled homeservers whose DNS resolves to private/internal IP addresses. Previously, the Key changes:
The implementation is well-scoped: the allowlist is exact-hostname-only, applied only to the login fetch, and the SSRF guard (including redirect SSRF checks) remains fully active for any other hostname. The hostname extraction uses standard URL API behavior, ensuring consistency with SSRF enforcement. No other request paths are affected. Confidence Score: 5/5
Last reviewed commit: 280d086 |
|
OpenClaw now uses a new Matrix plugin built on the official Closing this as potentially fixed in the new plugin. If this still reproduces after migrating, please open a new issue/PR against the new Matrix plugin and link back here. Migration/docs: |
Summary
fetchWithSsrFGuardwithout a homeserver-scoped SSRF policy, so configured homeservers that resolve to private/internal IPs can be blocked during fresh login.allowedHostnamesfrom the configured Matrix homeserver URL and attach that policy only to thematrix.loginguarded fetch; add a unit test covering the new login policy wiring.Change Type (select all)
Scope (select all touched areas)
User-visible / Behavior Changes
channels.matrix.userId+channels.matrix.passwordcan now log in against a configured homeserver whose DNS resolves to a private/internal IP, as long as the request stays on that configured hostname.Security Impact (required)
Yes/No) NoYes/No) NoYes/No) NoYes/No) NoYes/No) NoYes, explain risk + mitigation:Repro + Verification
Environment
channels.matrix.homeserver=https://matrix.cloud-city.dev,channels.matrix.userId=@clio:cloud-city.dev, password-based loginSteps
homeserver,userId, andpassword, using a homeserver hostname that resolves to a private/internal IP from the OpenClaw host./_matrix/client/v3/loginthrough the guarded fetch.Expected
Actual
Blocked: resolves to private/internal/special-use IP address.Evidence
Human Verification (required)
What you personally verified (not just CI), and how:
resolveMatrixAuthpassespolicy: { allowedHostnames: [configured-hostname] }to the guarded Matrix login fetch.pnpm vitest run extensions/matrix/src/matrix/client.test.tsand confirmed it passes.pnpm buildsuccessfully in a shell withpnpmavailable onPATH.matrix.loginrequest path is changed.pnpm checkandpnpm testare currently blocked by unrelated upstream issues in this checkout (for example a formatting issue insrc/cli/daemon-cli/lifecycle.test.tsand unrelated test failures outside Matrix).Review Conversations
Compatibility / Migration
Yes/No) YesYes/No) NoYes/No) NoFailure Recovery (if this breaks)
280d086b6extensions/matrix/src/matrix/client/config.ts,extensions/matrix/src/matrix/client.test.tsRisks and Mitigations
AI-assisted: yes. Testing: targeted unit test + local build.