-
Notifications
You must be signed in to change notification settings - Fork 246
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
fix(sdk): Can't assert identity without session #832
fix(sdk): Can't assert identity without session #832
Conversation
Codecov Report
@@ Coverage Diff @@
## main #832 +/- ##
=======================================
Coverage 78.20% 78.20%
=======================================
Files 101 101
Lines 14223 14223
=======================================
Hits 11123 11123
Misses 3100 3100
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I understand the patch avoids to fall in the else
branch with a session
set to None
, which will avoid to return an Err(HttpError::UserIdRequired)
(from session
). The new path could build a request without a user ID and with SendAccessToken::None
instead.
All of this sounds sensible to me. I don't know if it's correct though, and it could be comfortable to get a second review to validate this new flow.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is an appservice only feature, and I don't fully understand when and how the assert_identity is used by the service, but I assume you have better knowledge about that and know about the potential problems here. That said, it'd be great if 1) you could update the code docs of ClientBuilder.assert_identity
, as they say it would fail without a session (which it wouldn't anymore now) and 2) in a PR like this you'd give a bit more context, like stating that this is an appservice only feature and educate us more, why our current code is wrong :) (the issue linked also only describes the bug, not really why that behavior is considered a bug).
efc9654
to
420ca26
Compare
Thanks for the reviews and docs catch, updated accordingly. Right, I somehow was thinking about identity assertion as independent feature - but forgot that it actually is tied to appservices only, in terms of spec. It's considered a bug because using the appservice crate currently will error at runtime if you try to use it, regardless of what you try to do with it. That's because The given PR was the only fix I found without large refactorings, because a lot depends on |
In terms of correctness: It doesn't seem to make sense anyway to do identity assertion for endpoints that don't require authentication, since endpoints that don't require authentication don't have any knowledge about the user or session, and so wouldn't act differently either way. So maybe a refactoring including a test could take that into account. |
thanks for the clarifications! |
Fixes #821
Part of #228