learningequality / learningequality/studio

Validate channel_id as UUID in remove_self endpoint

Open
#5,780 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

  • #5776 by @ashnaaseth2325-oss — closed without merging
bug TODO: needs review
Dominant language
Python
Stars
191
Forks
307
Avg merge
5d 6h
Merged PRs (30d)
10

Description

This issue is not open for contribution. Visit Contributing guidelines to learn about the contributing process and how to find suitable issues.

Target branch: develop

Observed behavior

The remove_self endpoint in ChannelUserViewSet does not explicitly validate channel_id as a UUID before querying the database.

When a malformed UUID (e.g., not-a-valid-uuid) is provided, it results in an unhandled exception and results in a 500 Internal Server Error response.

Errors and logs

ValueError: badly formed hexadecimal UUID string

User-facing consequences

Users receive a 500 Internal Server Error when providing invalid input instead of a proper validation error (400 Bad Request). This leads to a poor user experience and unclear API behavior.

Steps to reproduce

  1. Call the remove_self endpoint
  2. Provide an invalid channel_id (e.g., not-a-valid-uuid)
  3. Observe that the response is a 500 error instead of a 400 Bad Request

Context

  • Application version: current develop branch
  • Operating system: any
  • Browser: any

AI usage

I used AI assistance to help structure and refine this issue description. The issue itself was identified, reproduced, and validated manually.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Locate the ChannelUserViewSet and its remove_self endpoint, then reproduce the request with channel_id set to not-a-valid-uuid. Trace the input through the endpoint and verify that malformed UUIDs receive a 400 Bad Request instead of an unhandled 500 response.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api, backend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.