Skip to content

fix!: fix survey redirections#834

Merged
Agrendalath merged 1 commit intoopencraft-release/redwood.1-echofrom
agrendalath/security-fix-redwood
Apr 6, 2026
Merged

fix!: fix survey redirections#834
Agrendalath merged 1 commit intoopencraft-release/redwood.1-echofrom
agrendalath/security-fix-redwood

Conversation

@Agrendalath
Copy link
Copy Markdown
Member

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 picked from commit fca21c9)

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.

(cherry picked from commit fca21c9)
@Agrendalath Agrendalath self-assigned this Apr 6, 2026
@Agrendalath Agrendalath merged commit 87ef2af into opencraft-release/redwood.1-echo Apr 6, 2026
47 checks passed
@Agrendalath Agrendalath deleted the agrendalath/security-fix-redwood branch April 6, 2026 15:29
@Agrendalath
Copy link
Copy Markdown
Member Author

Merging as a clean cherry-pick.

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