Node details endpoint returns nodes outside public channels

未关闭
#6,421 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
1/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
django, python
领域
api, backend, security

调研方向

Read get_node_details and get_channel_details in contentcuration/contentcuration/views/nodes.py, then inspect the ContentNode.filter_view_queryset approach referenced in #6398. Add regression tests for each acceptance criterion, including anonymous and logged-in access, and check that out-of-scope and nonexistent ids return 404 while public nodes retain their current details. The issue explicitly says it is not open for contribution.

由索引模型根据 Issue 内容生成。

描述

DEV: backend

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

Overview

/api/get_node_details/<node_id> needs no login, and refuses a node only when it belongs to an existing channel that isn't public. Nodes in a user's clipboard, orphaned nodes and nodes in deleted public channels all return their full details. A node id that doesn't exist raises DoesNotExist and returns 500 (#5784). The sibling get_channel_details looks channels up through Channel.filter_view_queryset.

Complexity: Low
Target branch: hotfixes

Context
  • get_node_details uses ContentNode.objects.get and checks only channel and not channel.public. get_channel_details uses get_object_or_404 on the view queryset.
  • Reproduced, anonymously: 200 with full details for a node in a user's clipboard tree, for an orphaned node, and for a node in a deleted public channel. get_channel_details returns 404 for that deleted channel.
The Change
  • get_node_details should look the node up through ContentNode.filter_view_queryset, following the strategy in #6398, and return 404 for anything outside it, including ids that don't exist.
Acceptance Criteria
General
  • Each reproduced case in Context returns 404.
  • A nonexistent node id returns 404.
  • Nodes in public channels return the same details as before.
  • A logged-in user gets details for nodes in non-public channels they can view, as get_channel_details already allows for those channels.
Testing
  • Regression tests cover each criterion.

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.

主要语言
Python
星标
212
派生
321
平均合并
1 天 7 小时
30 天内合并 PR
14

环境准备

  • 提供 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

learningequality/studio 的其他 Issue

查看 learningequality/studio 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。