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

Offen Anfängerfreundlich
#6,399 1 Kommentar 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Maintainer antworten meist innerhalb von 1 Tag

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
2/5
Geschätzter Aufwand
1-3 Stunden
Anfängerfreundlichkeit
82/100
Issue-Typ
Bug
Klarheit
Klar beschrieben
Aktivitätsstatus
Aktiv
Tech-Stack
django, python

Rechercherichtung

Beginne mit den Actions channel_language_exists und get_languages_in_channel in contentcuration/contentcuration/viewsets/channel.py und vergleiche anschließend, wie die anderen Detail-Actions get_object() verwenden. Aktualisiere beide Actions, damit sie dieselbe Prüfung des Kanalzugriffs durchsetzen. Füge Regressionstests für ein Nichtmitglied, einen Viewer und eine nicht vorhandene Channel-ID hinzu; fertig ist die Änderung, wenn beide Actions für nicht zugängliche Channels 404 zurückgeben und die Antworten für Viewer und Editoren unverändert bleiben.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

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.

Vorherrschende Sprache
Python
Sterne
212
Forks
321
Ø Merge
1 T. 7 Std.
Gemergte PRs (30 T.)
14

Entwicklungsumgebung

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus learningequality/studio

Alle Issues in learningequality/studio

Ähnliche Issues

Weitere Issues zu Python

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.