| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
The library container and xblock embed endpoints used by the "review pending changes" modal only checked direct library permissions, so a Course Auditor (or any role holding courses.view_library_updates) got a 403 even though they should be able to review changes from their course. Accept an optional course_id query param on these three endpoints and grant access via courses.view_library_updates when it points to a course the user can review from, falling back to the existing library-level check otherwise. Same pattern already used for the sync endpoint in openedx#39009 and openedx#39055. Related to openedx/openedx-authz#441
|
Thanks for the pull request, @efortish! This repository is currently maintained by @openedx/wg-maintenance-openedx-platform-oncall. Once you've gone through the following steps feel free to tag them in a comment and let them know that your changes are ready for engineering review. 🔘 Get product approvalIf you haven't already, check this list to see if your contribution needs to go through the product review process.
To help your reviewers and other members of the community understand the purpose and larger context of your changes, feel free to add as much of the following information to the PR description as you can:
If one or more checks are failing, continue working on your changes until this is no longer the case and your build turns green. DetailsWhere can I find more information? If you'd like to get more details on all aspects of the review process for open source pull requests (OSPRs), check out the following resources:
Our goal is to get community contributions seen and reviewed as efficiently as possible. However, the amount of time that it takes to review and merge a PR can vary significantly based on factors such as:
💡 As a result it may take up to several weeks or months to complete a review and merge your PR. |
Sorry, something went wrong.
mypy needs check_permission annotated as CheckPerm | None explicitly, since the first assignment alone made it infer plain CheckPerm. Move the embed view's authz bypass test out of test_runtime.py (a plain TestCase, missing CORS_ORIGIN_WHITELIST in the CMS test environment) into test_embed_block.py, next to the other embed view tests, using the same override_settings(CORS_ORIGIN_WHITELIST=[]) workaround already in place there for the same reason.
| request.user, | ||
| permissions.CAN_VIEW_THIS_CONTENT_LIBRARY, | ||
| ) | ||
| if not user_has_course_permission_from_query_param( |
There was a problem hiding this comment.
Is this a decorator or a utility function? I ask because it is implemented in the decorator modules so I'd expect it could be used as a decorator. Although I see we've been using the pattern of defining non-decorator helpers in that module.
Sorry, something went wrong.
| self.lib = self._create_library(slug="library-updates-lib", title="Library Updates Test Library") | ||
| self.unit = self._create_container(self.lib["id"], "unit", display_name="Reviewable Unit", slug=None) | ||
|
|
||
| def test_container_detail_denied_without_course_id(self): |
There was a problem hiding this comment.
Can we please add docstrings so we follow the same conventions as the other test suites?
Sorry, something went wrong.
| def test_container_children_denied_without_course_id(self): | ||
| with self.as_user(self.authorized_user): | ||
| response = self.client.get(URL_LIB_CONTAINER_CHILDREN.format(container_key=self.unit["id"])) | ||
| assert response.status_code == 403 |
There was a problem hiding this comment.
So how does this hold "Without it, or if the check fails, the existing library-level permission check runs exactly as before, so nothing changes for callers that don't pass it." ? What are the cases when the this is backward compatible without the course ID param? Can we add a test for it?
Sorry, something went wrong.
|
|
||
|
|
||
| @skip_unless_cms | ||
| @override_settings(CORS_ORIGIN_WHITELIST=[]) # For some reason, this setting isn't defined in our test environment? |
There was a problem hiding this comment.
I don't think this is the correct approach. Can you please attach the error that's raised without this setting? Thanks!
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Description
The library container endpoints and the xblock embed endpoint used by the "review pending changes" modal (opened from a course unit when a library-sourced component has updates available) only checked direct library permissions. That means a Course Auditor, or anyone else holding courses.view_library_updates at the course level, gets a 403 trying to review changes even though they can view everything else about that course.
This adds an optional course_id query param to the three affected endpoints:
When course_id is present and the requesting user holds courses.view_library_updates in that course, access is granted without requiring direct library permissions. Without it, or if the check fails, the existing library-level permission check runs exactly as before, so nothing changes for callers that don't pass it.
This is the same approach already used for the sync endpoint in #39009 and #39055.
The companion frontend change (threading the course id through to these three calls) is in openedx/frontend-app-authoring#3251.
Related to openedx/openedx-authz#441
Testing
Deadline
None