Channel `language_exists` and `languages` actions skip the channel permission check

Aperta Adatta ai principianti
#6,399 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
82/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
django, python

Direzione di ricerca

Inizia con le azioni channel_language_exists e get_languages_in_channel in contentcuration/contentcuration/viewsets/channel.py, poi confronta come le altre azioni di dettaglio usano get_object(). Aggiorna entrambe le azioni affinché applichino lo stesso controllo di accesso al channel. Aggiungi test di regressione per un non membro, un viewer e un ID di channel inesistente; il lavoro è completato quando entrambe le azioni restituiscono 404 per i channel non accessibili e mantengono le risposte per viewer ed editor.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

DEV: backend good first issue help wanted

🙂 Looking for an issue? Welcome! This issue is open for contribution. If this is the first time you’re requesting an issue, please:

  • Read Contributing guidelines carefully. Pay extra attention to Using generative AI. Pull requests and comments that don’t follow the guidelines won’t be answered.
  • Confirm that you’ve read the guidelines in your comment.

Overview

The channel language_exists and languages actions load the channel through Channel.objects rather than get_object(). Any logged-in user can read the content languages of a private channel they can't view, given its id, and the response also shows whether that channel id exists. The other detail actions on the viewset use get_object().

Complexity: Low
Target branch: hotfixes

Context
The Change
  • Both actions should load the channel through get_object(), following the strategy in #6398, so a user who can't view the channel gets the same 404 as GET /api/channel/<id>.
Acceptance Criteria
General
  • A logged-in user who can't view a channel gets 404 from both GET /api/channel/<id>/languages and GET /api/channel/<id>/language_exists, the same as for a nonexistent channel id.
  • Editors and viewers of the channel get the same responses as before.
Testing
  • Regression tests cover a non-member, a viewer and a nonexistent id for both actions.

AI usage

I chose which audit findings belong in #6398 and set the access pattern. Claude Code found and reproduced this gap and drafted this issue.

Lingua principale
Python
Stelle
212
Fork
321
Merge medio
1g 7h
PR unite (30g)
14

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di learningequality/studio

Tutte le issue di learningequality/studio

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.