matrix-org / matrix-authentication-service

OAuth2.0 + OpenID Provider for Matrix Homeservers
https://matrix-org.github.io/matrix-authentication-service/
Apache License 2.0
112 stars 32 forks source link

Templates fail to render when authorization request doesn't contain a state parameter #2869

Open tonkku107 opened 3 months ago

tonkku107 commented 3 months ago

Example authorization request url (fill in the blanks): [mas_base_url]/authorize?response_type=code&client_id=[client_id]&scope=openid

When logged out, an error page is rendered with the following error displayed: image

Unexpected error
could not render template "pages/login.html"

Render { template: "pages/login.html", source: Error { kind: InvalidOperation, detail: "Could not serialize back parameters", name: "components/back_to_client.html", line: 41, source: Custom("unsupported value") } }

When logged in, an empty error 500 is returned with the following error in the logs:

ERROR http.server.request{otel.kind="server" otel.name="GET /consent/:grant_id" network.protocol.name="http" network.protocol.version="1.0" http.request.method="GET" url.path="/consent/01J0ZS9BWKQ35ZNN9P8ZW8KH5P" url.scheme="http" http.route="/consent/:grant_id" user_agent.original="Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/127.0.0.0 Safari/537.36"}:handlers.oauth2.consent.get{grant.id=01J0ZS9BWKQ35ZNN9P8ZW8KH5P}: mas_handlers::oauth2::consent: error=could not render template "pages/consent.html"
matrixbot commented 1 month ago

For your information, this issue has been copied over to the Element fork of matrix-authentication-service: https://github.com/element-hq/matrix-authentication-service/issues/2869