Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Handlers don't work from remote services

オープン
#13 コメント 4 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
5/5
見積もり時間
1週間以上
初心者へのやさしさ
30/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
django, python
領域
backend, security

調査の方向性

workbench/views.py の handler function から始め、XBlock handlers が POST リクエストを受け取る仕組みと、CSRF exemption が適用される仕組みを追跡してください。認証済みブラウザからアクセスされる handlers と、settings、outcomes、memberships services で使用される handlers を比較してください。issue で要求された区別を、すべての handler を exempt にすることなくサポートし、関連するテストが存在する場合はその動作をテストでカバーできれば完了です。

索引モデルが issue の本文から書いたものです。

説明

From a developer:

[quote]
All the handlers I am creating that are accessed by remote tools using POST requests (settings service, outcomes service and memberships service) are all blocked by django's CSRF protection. Adding the @csrf_exempt decorator to the handlers in the XBlock has no effect. I have only been able to get it working by adding @csrf_exempt to the handler function in workbench/views.py

diff --git a/workbench/views.py b/workbench/views.py
index b8f97e6..72037a5 100644
--- a/workbench/views.py
+++ b/workbench/views.py@@ -75,7 +76,9 @@ def show_scenario(request, scenario_id, view_name='student_view'):
})

+from django.views.decorators.csrf import csrf_exempt
+@csrf_exempt
def handler(request, usage_id, handler_slug):
student_id = get_student_id(request)
log.info("Start handler %s/%s for student %s", usage_id, handler_slug, student_id)
usage = Usage.find_usage(usage_id)

[end quote]

Clearly, we don't want to exempt all handlers from CSRF protection, so we need a way to indicate which handlers are from the authenticated browser, and which are not.

主要言語
Python
スター
470
フォーク
231
平均マージ
2日 22時間
マージ済み PR(30日)
7

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

openedx/XBlock のほかの issue

openedx/XBlock の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。