Skip to content

Merge commit from fork#38274

Merged
feanil merged 1 commit intorelease/ulmofrom
feanil/update_survey_endpoints
Apr 2, 2026
Merged

Merge commit from fork#38274
feanil merged 1 commit intorelease/ulmofrom
feanil/update_survey_endpoints

Conversation

@feanil
Copy link
Copy Markdown
Contributor

@feanil feanil commented Apr 2, 2026

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.

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.
@feanil feanil force-pushed the feanil/update_survey_endpoints branch from 37643f8 to 452bfb9 Compare April 2, 2026 14:04
@feanil feanil marked this pull request as ready for review April 2, 2026 14:05
@feanil feanil requested a review from kdmccormick April 2, 2026 14:05
@feanil feanil merged commit fca21c9 into release/ulmo Apr 2, 2026
53 of 54 checks passed
@feanil feanil deleted the feanil/update_survey_endpoints branch April 2, 2026 14:40
@feanil
Copy link
Copy Markdown
Contributor Author

feanil commented Apr 2, 2026

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.

1 participant