Use safer (not None) user argument default value in all functions where authenticated member is fallback
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 101
- Forks
- 62
- Avg merge
- 15h 15m
- Merged PRs (30d)
- 1
Description
plone.api.user.revoke_roles(user=plone.api.user.get(…)) can have dangerous side effects if the user value returned by Products.CMFPlone.RegistrationTool.get_member_by_login_name() returns None value for user (exceptions are supressed in call, this is possible). The same side-effect of unintentionally modifying or querying the authenticated user is possible in such cases.
Maybe using None as a default argument value for the user keyword argument is insufficient as a marker. I would suggest some other kind of marker be used to disambiguate intended omission from incidental NoneType value.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading plone.api.user.revoke_roles, plone.api.user.get, and the use of Products.CMFPlone.RegistrationTool.get_member_by_login_name() described in the report. Determine the marker and scope needed across the affected functions; done should prevent an incidental None from being treated as omission while preserving the authenticated-user fallback when omission is intentional.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- api, security
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100