Repository navigation
Description
Description
The Studio video endpoints (/videos/<course_key> and related) do not use authz permissions. The ones that check access go through get_course_and_check_access, which only looks at legacy roles, so users with authz-only roles (e.g. Editor, Auditor) get 403. Even for legacy users, one check covers list, upload and delete, with no read/write distinction. Several related endpoints do not check course access at all.
Current Behavior
videos_handler(views/videos.py:97) →handle_videos→_get_and_validate_course(video_storage_handlers.py:634) →get_course_and_check_access(views/course.py:167) →has_studio_read_access→get_user_permissions(common/djangoapps/student/auth.py:83).get_user_permissionsonly considers legacy roles (GlobalStaff,OrgInstructorRole,CourseInstructorRole, etc.).- GET (list), POST (upload) and DELETE share the same check. An Auditor would be able to upload and delete if they passed it.
generate_video_upload_link_handlerandvideo_encodings_downloadalso go through_get_and_validate_course, with the same legacy check.- Some endpoints have no course permission check, only login or authentication:
video_images_handler(handle_video_images): only@login_required; the course key is used only for the upload path.transcript_preferences_handler(handle_transcript_preferences): only@login_required.get_course_youtube_edx_videos_ids(get_course_youtube_edx_video_ids): onlyview_auth_classes(), and it reads the course structure.
- The comment in
_get_and_validate_coursesays "assume all studio users that have access to the course can upload videos".
Expected Behavior
All video endpoints enforce authz permissions, with read separated from write:
- Listing videos and downloading encodings requires view permission.
- Uploading, changing images/transcript preferences and deleting require the matching edit/create/delete permission.
- Users with authz-only roles work according to their permissions. Legacy behavior is unchanged when authz is not enabled for the course.
Steps to reproduce
- Log in as a user with an authz-only role (Editor or Auditor) and no legacy course role.
- Open
/videos/course-v1:Ax+Ax+2026(Studio, port 8001). - Observe the 403.
- (No-check endpoints) Log in as any authenticated user with no access to a course and POST to
/video_images/<course_key>/<edx_video_id>or/transcript_preferences/<course_key>; the request is not rejected for lack of course access.
Acceptance Criteria
- The permission model for videos is decided (see Proposed Solution) and any missing permissions are added to
openedx-authz. -
_get_and_validate_course(or its callers) usesuser_has_course_permissionwith an authz permission and the legacy fallback. - GET
videos_handlerandvideo_encodings_downloadrequire the view permission; POST andgenerate_video_upload_linkrequire create/edit; DELETE requires delete. -
video_images_handler,transcript_preferences_handlerandget_course_youtube_edx_videos_idscheck course permission. - Users without the right permission get 403; an Auditor cannot upload or delete.
- Legacy roles keep their current access when authz is disabled for the course.
- Tests are added or updated for each role and method.
Proposed Solution
Follow the pattern used by the assets handler (_authz_enforce_file_permissions in asset_storage_handlers.py:100): a minimum view permission, then create/edit/delete checks on top when enable_authz_course_authoring(course_key) is on, each with a LegacyAuthoringPermission fallback.
Open question: reuse the existing files permissions (COURSES_VIEW_FILES, COURSES_CREATE_FILES, COURSES_EDIT_FILES, COURSES_DELETE_FILES) or add dedicated video permissions. Videos live in the same "Files & Uploads"-style area for users, but the code comment mentions a future dedicated video-uploader role, so this needs a product/authz decision.
Technical Notes
- Files:
cms/djangoapps/contentstore/views/videos.py,cms/djangoapps/contentstore/video_storage_handlers.py,cms/urls.py:181. video_images_upload_enabledandget_video_featuresonly return feature flags and likely need no change.
Related Issues
Related to #286.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsIn Review
Activity