Skip to content

fix!: Merge commit from fork#838

Merged
samuelallan72 merged 1 commit intopooja/unpin-openai-versionfrom
fox/redwood-survey-patch
Apr 6, 2026
Merged

fix!: Merge commit from fork#838
samuelallan72 merged 1 commit intopooja/unpin-openai-versionfrom
fox/redwood-survey-patch

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.
Copy link
Copy Markdown
Member

@samuelallan72 samuelallan72 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Kelketek 👍

  • I tested this: verified the diff matched openedx#38274 and appeared to be cleanly applied
  • I read through the code
  • I checked for accessibility issues
  • Includes documentation

@samuelallan72
Copy link
Copy Markdown
Member

Unit tests are known to not work properly on this branch.

@samuelallan72 samuelallan72 merged commit d129d2d into pooja/unpin-openai-version Apr 6, 2026
16 of 75 checks passed
@samuelallan72 samuelallan72 deleted the fox/redwood-survey-patch branch April 6, 2026 23:26
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.

3 participants