-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
server: proper error handling in sessions API #78176
Conversation
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.
thank you! Please make sure this is backported too.
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.
Reviewable status:
complete! 1 of 0 LGTMs obtained
Fixes cockroachdb#76288 Previously, part of the code in the sessions API that handles privelege checking would swallow non-privelege related server errors. The function `requireViewActivityOrViewActivityRedactedPermission` was being used to check if the user has either of the above roles. This function returns an error as a single value, which can be either a privelege or non-privelege related error. It is intended for use when either role is required to use the API, with the error returned immediately, however the sessions API is should work for users without these permissions if given the correct request parameters. This commit replaces the use of `requireViewActivityOrViewActivityRedactedPermission` with `hasRoleOption` to check for the possession of the VIEWACTIVITY or VIEWACTIVITYREDACTED roles. This allows us to use both the result of the role check and return errors encountered immediately. Release justification: bug fix Release note: None
6a32a21
to
3c0aaa1
Compare
TFTR! + thanks for adding the backport label, Marylia. |
Build failed (retrying...): |
Build succeeded: |
Fixes #76288
Previously, part of the code in the sessions API that handles
privelege checking would swallow non-privelege related server
errors. The function
requireViewActivityOrViewActivityRedactedPermission
was being used to check if the user has either of the above
roles. This function returns an error as a single value, which
can be either a privelege or non-privelege related error.
It is intended for use when either role is required to use the API,
with the error returned immediately, however the sessions API is
should work for users without these permissions if given the
correct request parameters.
This commit replaces the use of
requireViewActivityOrViewActivityRedactedPermission
withhasRoleOption
to check for the possession of the VIEWACTIVITYor VIEWACTIVITYREDACTED roles. This allows us to use both the
result of the role check and return errors encountered immediately.
Release note: None