Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clarify that an access token is optional on /account/password and /account/deactivate #1843

Merged
merged 3 commits into from
Jun 18, 2024

Conversation

zecakeh
Copy link
Contributor

@zecakeh zecakeh commented Jun 5, 2024

The descriptions of the endpoints clearly state that the access token is not required, but it also says:

Requires Authentication: Yes

This changes it to show:

Requires Authentication: Optional

Fixes #1807.

Pull Request Checklist

Preview: https://pr1843--matrix-spec-previews.netlify.app

…ount/deactivate

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
@zecakeh zecakeh requested a review from a team as a code owner June 5, 2024 11:01
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
@uhoreg
Copy link
Member

uhoreg commented Jun 11, 2024

Looking at the synapse code, /account/password indeed doesn't seem to require authentication, but /account/deactivate does, AFAICT. I haven't checked what other servers do yet. I think we may need to untangle whether the discrepancy in /account/deactivate is a spec bug or a synapse bug.

@zecakeh
Copy link
Contributor Author

zecakeh commented Jun 12, 2024

From what I can tell both Dendrite and Conduit seem to require authentication for both endpoints.

@richvdh
Copy link
Member

richvdh commented Jun 18, 2024

It took me quite a while to grok what was going on here. Clearly, both endpoints require authentication of some form -- anything else would be anarchy where people go around changing other peoples' passwords -- so the phrasing of the PR is a bit confusing.

So, for the record: both endpoints require authentication via UIA. The question at stake is whether they also need an Authorization header with an access token. The spec is inconsistent. As @uhoreg says, Synapse's implementation of /account/deactivate requires an access token, but that of /account/password does not.

@richvdh
Copy link
Member

richvdh commented Jun 18, 2024

Doing some archaeology:

/password was implemented in https://github.com/matrix-org/synapse/pull/126/files#diff-20445d423fa1657115c589560de173027dbba8b9a866b21fb3592cd55e30dc50R31
and specced in matrix-org/matrix-spec-proposals#190. We can see from the start that the access token was not required if you did UIA with m.login.email.identity, which remains the case today; however the swagger implied that an access token was required. @zecakeh's change seems correct here and corrects a 9-year-old spec bug!

/deactivate was implemented in matrix-org/synapse#921 and specced in matrix-org/matrix-spec-proposals#361. The spec implies that an access token may not be required, but in practice, an access token was required (https://github.com/matrix-org/synapse/pull/921/files#diff-20445d423fa1657115c589560de173027dbba8b9a866b21fb3592cd55e30dc50R150).

My impression is that a server could implement /deactivate without the access token, for example by allowing UIA with m.login.token, and be spec-compliant. The fact that no implementation has yet done so isn't important.

In short: LGTM

@zecakeh
Copy link
Contributor Author

zecakeh commented Jun 18, 2024

It took me quite a while to grok what was going on here. Clearly, both endpoints require authentication of some form -- anything else would be anarchy where people go around changing other peoples' passwords -- so the phrasing of the PR is a bit confusing.

In that case, should we consider that the phrasing of the spec is also confusing? Do we need to change "Requires Authentication" to "Requires Access Token"?

Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>
@zecakeh zecakeh changed the title Clarify that authentication is optional on /account/password and /account/deactivate Clarify that an access token is optional on /account/password and /account/deactivate Jun 18, 2024
@richvdh
Copy link
Member

richvdh commented Jun 18, 2024

In that case, should we consider that the phrasing of the spec is also confusing? Do we need to change "Requires Authentication" to "Requires Access Token"?

I think something like that would be good, yes. Not sure exactly what words to use though.

@richvdh richvdh merged commit 4e32fca into matrix-org:main Jun 18, 2024
12 checks passed
@zecakeh zecakeh deleted the password-optional-auth branch June 18, 2024 16:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants