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

GET from MsisdnValidateCodeServlet broken? #445

Closed
DMRobertson opened this issue Oct 28, 2021 · 3 comments · Fixed by #446
Closed

GET from MsisdnValidateCodeServlet broken? #445

DMRobertson opened this issue Oct 28, 2021 · 3 comments · Fixed by #446
Labels

Comments

@DMRobertson
Copy link
Contributor

DMRobertson commented Oct 28, 2021

Inside render_GET we call get_args and destructure the result to a 2-tuple:

err, args = get_args(request, ("token", "sid", "client_secret"))

get_args returns a dictionary, and has done since 687d774. The destructing will fail unless the dictionary contains two keys.

request: Request, args: Iterable[str], required: bool = True
) -> Dict[str, Any]:
"""

Everywhere else, we use args = get_args with no destructuring. I guess we missed this servelet in that change and either nobody noticed or the endpoint is unused.

@DMRobertson
Copy link
Contributor Author

@clokep
Copy link
Member

clokep commented Oct 28, 2021

sentry.matrix.org/sentry/sydent/issues/16284 spotted by @clokep

I think this might actually be unrelated. I would have expected "not enough values to unpack" while that error is "too many values to unpack".

@DMRobertson
Copy link
Contributor Author

DMRobertson commented Oct 28, 2021

I would have expected "not enough values to unpack" while that error is "too many values to unpack".

A dictionary with N keys will happily desugar into an N-tuple:

>>> d = {"a": 1, "b": 2, "c": 3}
>>> x, y, z = d
>>> x, y, z
('a', 'b', 'c')

So if get_args returned 3 or more args, we'd see "too many values to unpack".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants