You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is first found by Sourcery-AI, and it generated two issue tickets related to these methods #51#52
For methods addMethod() and removeMethod() in OscarGroup.java, below are the current codes:
/**
* Adds a member to the group.
*
* @param user the Principal to be added
* @return true whether the member was added
*/
public boolean addMember(Principal user) {
if (!principals.contains(user))
principals.add(user);
return true;
}
/**
* Removes a member from the group.
*
* @param user the Principal to be removed
* @return true whether the member was removed
*/
public boolean removeMember(Principal user) {
principals.remove(user);
return true;
}
We can see that the logic in these two methods are - return true whether the member was added / the member was removed.
Sourcery-AI suggested us to modify the logic to - return true when the member was not added, otherwise return false / return true when the member is existed to remove, otherwise return false. In this way, it will be better for us to maintain the security issue.
This won't be a hard fix, but the thing is, we don't know why the previous team set up the logic in the current way (return true anyhow). We feel like to discuss with Magenta first before we modify the codes.
The text was updated successfully, but these errors were encountered:
This is first found by Sourcery-AI, and it generated two issue tickets related to these methods #51 #52
For methods
addMethod()
andremoveMethod()
inOscarGroup.java
, below are the current codes:/**
* Adds a member to the group.
*
* @param user the Principal to be added
* @return true whether the member was added
*/
public boolean addMember(Principal user) {
if (!principals.contains(user))
principals.add(user);
return true;
}
We can see that the logic in these two methods are - return true whether the member was added / the member was removed.
Sourcery-AI suggested us to modify the logic to - return true when the member was not added, otherwise return false / return true when the member is existed to remove, otherwise return false. In this way, it will be better for us to maintain the security issue.
This won't be a hard fix, but the thing is, we don't know why the previous team set up the logic in the current way (return true anyhow). We feel like to discuss with Magenta first before we modify the codes.
The text was updated successfully, but these errors were encountered: