Skip to content

Commit 6651baf

Browse files
actually fix the security rules :)
1 parent 1566d0f commit 6651baf

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

src/services/ChallengeService.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -945,8 +945,7 @@ async function getChallenge (currentUser, id) {
945945

946946
// Check if challenge is task and apply security rules
947947
if (_.get(challenge, 'task.isTask', false) && _.get(challenge, 'task.isAssigned', false)) {
948-
const skipAccessCheck = !currentUser ? false : currentUser.isMachine || helper.hasAdminRole(currentUser)
949-
if (!skipAccessCheck && currentUser && _.toString(currentUser.userId) !== _.toString(_.get(challenge, 'task.memberId'))) {
948+
if (!currentUser || !(currentUser.isMachine || helper.hasAdminRole(currentUser)) || _.toString(currentUser.userId) !== _.toString(_.get(challenge, 'task.memberId'))) {
950949
throw new errors.ForbiddenError(`You don't have access to view this challenge`)
951950
}
952951
}

0 commit comments

Comments
 (0)