Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Preserve parameters during interstitial redirect #2004

Merged
merged 3 commits into from
Feb 23, 2024

Conversation

taylor-steve
Copy link
Contributor

Fixes #1934.

This seems to occur in both Rails 7.0 and 7.1:
https://app.honeybadger.io/projects/49963/faults/101591418/01HDEW0GXPZ486GB2K9862T6WT
https://app.honeybadger.io/projects/49963/faults/101723263/01HE0QQMPMVWHHTNX50KW496GQ

As suggested in #1934 it appears this was happening when going through bounce_request_through_sso, when the interstitial show ERB was escaping the URL in the script tag. This led to the parameter rewriting behavior. All previous tests passed because none had parameters that would be escaped.

As for safety, the only uses of interstitial use internally created redirect_to paths. This is my first time dealing with this in rails, if there is a better way, I am happy to hear it.

@taylor-steve taylor-steve marked this pull request as ready for review February 6, 2024 16:42
@corylown corylown self-requested a review February 22, 2024 22:50
The InterstitialController show route is public so we should
not use html_safe. For the redirect to work correctly,
window.location.href needs unencoded ampersands.
Copy link
Contributor

@corylown corylown left a comment

Choose a reason for hiding this comment

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

@taylor-steve I believe the issue has been fixed upstream in Rails (I am still looking for what exactly got fixed between 7.1.1 and 7.1.3.2). I can duplicate the problem on requests-dev with this request https://requests-dev.stanford.edu/requests/new?item_id=in00000001563&origin=SAL3&origin_location=SAL3-STACKS with Rails 7.1.1 but 7.1.3.2 works fine. I think we should close this PR and open a new PR that updates Rails to latest version of 7.1 to fix #1934

Amendment: the issue appears to be in Rack and not Rails and the behavior persists if we update rack from 2 to 3.

@corylown
Copy link
Contributor

Here's a draft PR to update Rails to 7.1.3: #2022

@corylown corylown merged commit 6314af7 into main Feb 23, 2024
2 checks passed
@corylown corylown deleted the 1934-fix-param-rewriting branch February 23, 2024 16:21
@corylown corylown mentioned this pull request Feb 23, 2024
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.

Fix request parameter rewriting in rails 7.1.x
2 participants