-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Don't check permissions for the target resource when canceling requests #8369
Conversation
…quests IMO, these checks are not very useful. The permission logic for requests already checks that the request is being canceled by the same user that created it. Therefore, these additional checks can only fail if a user creates a request for some action, loses the permissions to do the same action again, and then tries to cancel the request. But cancelling a request does not do anything to the target resource (in fact, it _prevents_ some future actions from taking place), so I really don't see why this shouldn't be allowed. In addition, these checks create some problems: * If the creator of the request is no longer able to cancel it, we now have a request that _nobody_ is allowed to cancel. That seems wrong. * To implement these checks, `RequestPermission` has to know which actions require which permissions. This creates code duplication between it and the other permission classes. It also causes a dependency on those classes, which could create problems if we want to use the request API for actions from the Enterprise version.
Important Review skippedAuto incremental reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the WalkthroughThis update modifies the request cancellation process by changing the permission requirements for users. Users can now cancel requests without needing specific permissions tied to the original action. Additionally, the permission handling logic within the Changes
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configuration File (
|
6de27fd
to
4e33b4b
Compare
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.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (2)
- changelog.d/20240828_053041_roman_rm_extra_checks.md (1 hunks)
- cvat/apps/engine/permissions.py (1 hunks)
Additional comments not posted (2)
changelog.d/20240828_053041_roman_rm_extra_checks.md (1)
1-5
: LGTM!The changelog entry is clear and concise.
The code changes are approved.
cvat/apps/engine/permissions.py (1)
Line range hint
1-1
: Verify the impact on security and functionality.The changes simplify the permission checks, but the removal of detailed checks might impact security and functionality. Ensure that the new implementation does not introduce security vulnerabilities or functional issues.
Run the following script to verify the impact of the changes:
Also applies to: 32-36
4e33b4b
to
3366618
Compare
Quality Gate passedIssues Measures |
…ts (cvat-ai#8369) IMO, these checks are not very useful. The permission logic for requests already checks that the request is being canceled by the same user that created it. Therefore, these additional checks can only fail if a user creates a request for some action, loses the permissions to do the same action again, and then tries to cancel the request. But cancelling a request does not do anything to the target resource (in fact, it _prevents_ some future actions from taking place), so I really don't see why this shouldn't be allowed. In addition, these checks create some problems: * If the creator of the request is no longer able to cancel it, we now have a request that _nobody_ is allowed to cancel. That seems wrong. * To implement these checks, `RequestPermission` has to know which actions require which permissions. This creates code duplication between it and the other permission classes. It also causes a dependency on those classes, which could create problems if we want to use the request API for actions from the Enterprise version.
Motivation and context
IMO, these checks are not very useful. The permission logic for requests already checks that the request is being canceled by the same user that created it. Therefore, these additional checks can only fail if a user creates a request for some action, loses the permissions to do the same action again, and then tries to cancel the request. But cancelling a request does not do anything to the target resource (in fact, it prevents some future actions from taking place), so I really don't see why this shouldn't be allowed.
In addition, these checks create some problems:
If the creator of the request is no longer able to cancel it, we now have a request that nobody is allowed to cancel. That seems wrong.
To implement these checks,
RequestPermission
has to know which actions require which permissions. This creates code duplication between it and the other permission classes. It also causes a dependency on those classes, which could create problems if we want to use the request API for actions from the Enterprise version.How has this been tested?
Checklist
develop
branch[ ] I have updated the documentation accordingly[ ] I have added tests to cover my changes[ ] I have linked related issues (see GitHub docs)[ ] I have increased versions of npm packages if it is necessary(cvat-canvas,
cvat-core,
cvat-data and
cvat-ui)
License
Feel free to contact the maintainers if that's a concern.
Summary by CodeRabbit
New Features
Bug Fixes
Chores