-
Notifications
You must be signed in to change notification settings - Fork 52
Issue 5069 fix #329
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
Issue 5069 fix #329
Conversation
@rootelement Can you check if we able to filter without auth? Thanks. |
@luizrrodrigues we are able to filter without auth. |
I mean filter by groups without auth. |
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.
Please see my comments
@@ -306,10 +306,6 @@ async function searchChallenges (currentUser, criteria) { | |||
|
|||
// Filter all groups from the criteria to make sure the user can access those | |||
if (!_.isUndefined(criteria.group) || !_.isUndefined(criteria.groups)) { | |||
// check group access | |||
if (_.isUndefined(currentUser)) { | |||
throw new errors.BadRequestError('Authentication is required to filter challenges based on groups') |
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.
The fix is clearly wrong.
Currently, if the currentUser
is not set, we're throwing an error.
By removing that code, you are making the rest of the code prone to cannot get property "<prop>" of undefined
errors.
Also, there's currently no check on whether a group is public or not which means, even if you bypass the above errors, you will still get wrong results back as the accessibleGroups
, which is used to determine if the user has access to the requested groups, will be empty (since the user is not authenticated).
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.
Thanks @ThomasKranitsas , I'll remove this from Bug Bash.
topcoder-platform/community-app#5069