element-hq / element-hq/matrix-authentication-service

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

Open
#2,869 1 comment 2 reactions 0 assignees View on GitHub
A-Login-Flow T-Defect
Dominant language
Rust
Stars
280
Forks
111
Avg merge
3d 1h
Merged PRs (30d)
25

Description

*This issue was originally created by [**@tonkku107**](https://github.com/tonkku107) at .*

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](https://github.com/matrix-org/matrix-authentication-service/assets/4409524/55b1fc4b-b799-4b09-80ca-ee2571ea126d)
```
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"
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.