Skip to content

Migrate Studio video endpoints to authz permissions #605

Open
openedx/openedx-platform
#39400

Description

@BryanttV

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_permissions only 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_handler and video_encodings_download also 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): only view_auth_classes(), and it reads the course structure.
  • The comment in _get_and_validate_course says "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

  1. Log in as a user with an authz-only role (Editor or Auditor) and no legacy course role.
  2. Open /videos/course-v1:Ax+Ax+2026 (Studio, port 8001).
  3. Observe the 403.
  4. (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) uses user_has_course_permission with an authz permission and the legacy fallback.
  • GET videos_handler and video_encodings_download require the view permission; POST and generate_video_upload_link require create/edit; DELETE requires delete.
  • video_images_handler, transcript_preferences_handler and get_course_youtube_edx_videos_ids check 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_enabled and get_video_features only return feature flags and likely need no change.

Related Issues

Related to #286.

Activity

  1. added
    willow
    on Nov 5, 2026
  2. added theissue type on Nov 5, 2026
  3. moved this to Ready for Development in RBAC AuthZ Boardon Nov 5, 2026
  4. self-assigned this
    on Nov 11, 2026
  5. moved this from Ready for Development to In Progress in RBAC AuthZ Boardon Nov 18, 2026
  6. moved this from In Progress to In Review in RBAC AuthZ Boardon Nov 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

willow

Type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions