Skip to content

fix!: Merge commit from fork#836

Open
Kelketek wants to merge 1 commit intoopencraft-release/sumac.1-krach-institutefrom
fox/sumac-krach-survey-fix
Open

fix!: Merge commit from fork#836
Kelketek wants to merge 1 commit intoopencraft-release/sumac.1-krach-institutefrom
fox/sumac-krach-survey-fix

Conversation

@Kelketek
Copy link
Copy Markdown
Member

@Kelketek Kelketek commented Apr 6, 2026

cherry-pick from openedx#38274

The view_survey endpoint accepted a redirect_url GET parameter and passed it directly to HttpResponseRedirect() with no validation. If a non-existent survey name was requested, this produced an immediate 302 to an attacker-controlled URL. If a valid survey was requested, the same URL was embedded in a hidden _redirect_url form field; after submission, submit_answers echoed it back in JSON and client-side JS used it as location.href — a second unvalidated redirect path.

Fix both by ignoring user-supplied redirect URLs entirely:

  • view_survey no longer reads redirect_url from GET params
  • submit_answers always redirects to reverse('dashboard') rather than reading _redirect_url from the POST body

Note: view_student_survey retains its redirect_url parameter because it is also called from the courseware view (courseware/views/views.py), which passes a server-controlled course_home_url. That call path is unaffected.

Fixes: GHSA-2843-x998-f8r2

BREAKING CHANGE: The redirect_url GET parameter on /survey// is no longer honored. Requests that previously redirected to a caller-specified URL after survey completion will now always redirect to the dashboard.

cherry-pick from openedx#38274

The view_survey endpoint accepted a redirect_url GET parameter and passed
it directly to HttpResponseRedirect() with no validation. If a non-existent
survey name was requested, this produced an immediate 302 to an
attacker-controlled URL. If a valid survey was requested, the same URL was
embedded in a hidden _redirect_url form field; after submission, submit_answers
echoed it back in JSON and client-side JS used it as location.href — a second
unvalidated redirect path.

Fix both by ignoring user-supplied redirect URLs entirely:
- view_survey no longer reads redirect_url from GET params
- submit_answers always redirects to reverse('dashboard') rather than
  reading _redirect_url from the POST body

Note: view_student_survey retains its redirect_url parameter because it is
also called from the courseware view (courseware/views/views.py), which passes
a server-controlled course_home_url. That call path is unaffected.

Fixes: GHSA-2843-x998-f8r2

BREAKING CHANGE: The redirect_url GET parameter on /survey/<name>/ is no longer
honored. Requests that previously redirected to a caller-specified URL after
survey completion will now always redirect to the dashboard.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants