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

Aberta Para iniciantes
#6,399 1 comentário 0 reações 0 responsáveis Ver no GitHub

Mantenedores costumam responder em até 1 dia

Ninguém assumiu esta issue ainda.

Avaliação

Dificuldade
2/5
Tempo estimado
1-3 horas
Facilidade para iniciantes
82/100
Tipo de issue
Bug
Clareza
Claramente especificada
Status de atividade
Ativa
Stack de tecnologia
django, python

Direção de pesquisa

Comece pelas actions channel_language_exists e get_languages_in_channel em contentcuration/contentcuration/viewsets/channel.py e, em seguida, compare como as outras actions de detalhe usam get_object(). Atualize ambas as actions para aplicar a mesma verificação de acesso ao channel. Adicione testes de regressão para um não membro, um viewer e um ID de channel inexistente; a tarefa estará concluída quando ambas as actions retornarem 404 para channels inacessíveis e preservarem as respostas para viewers e editores.

Escrita pelo modelo de indexação a partir do texto da issue.

Descrição

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.

Linguagem predominante
Python
Estrelas
212
Forks
321
Merge médio
1d 7h
PRs com merge (30d)
14

Preparar o ambiente

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Mais de learningequality/studio

Todas as issues de learningequality/studio

Issues semelhantes

Mais issues de Python

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.