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

fix: session referer rewritten in iframe tasks #2813

Merged
merged 1 commit into from Nov 21, 2022

Conversation

naggingant
Copy link
Contributor

@naggingant naggingant commented Nov 10, 2022

Closes DevExpress/testcafe#7376

Purpose

This partially undoes 55209a5 so that the session referer option does not get rewritten by iframe tasks.

Approach

I simply added the condition before this rewrite happens, but I am not familiar enough with the codebase nor proxies in general to fully justify the change.
Let me know if it makes sense as well as the test. I can close it otherwise.

References

DevExpress/testcafe#7376

Pre-Merge TODO

  • Write tests for your proposed changes
  • Make sure that existing tests do not fail

Copy link
Collaborator

@Aleksey28 Aleksey28 left a comment

Choose a reason for hiding this comment

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

Thank you for the PR. You will need to refactor it a bit.

@@ -211,7 +211,7 @@ export default class Proxy extends Router {
const windowId = refererDest && refererDest.windowId || void 0;

if (session) {
session.options.referer = referer || session.options.referer;
if (!isIframe) session.options.referer = referer || session.options.referer;
Copy link
Collaborator

Choose a reason for hiding this comment

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

I suggest you do this as follows:

Suggested change
if (!isIframe) session.options.referer = referer || session.options.referer;
if (!isIframe && referer)
session.options.referer = referer;

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sounds good, thanks

@naggingant naggingant temporarily deployed to authentication November 11, 2022 09:35 Inactive
@naggingant
Copy link
Contributor Author

Applied the suggestion. Thank you for the prompt response!

@naggingant naggingant temporarily deployed to CI November 11, 2022 10:14 Inactive
@AndreyBelym AndreyBelym merged commit d1cba7b into DevExpress:master Nov 21, 2022
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.

Ajax request referrer header altered after iframe loads
3 participants