-
Notifications
You must be signed in to change notification settings - Fork 673
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
Can't interact with websites that require CSRF Tokens #2106
Comments
Hi @bramroop, |
Hi @LavrovArtem thanks for your help. Unfortunately I'm still getting the same issue even after upgrading to v0.18.6
Is there any other difference in the way we're running things that you can think of that might be causing the issue? Thanks again |
Hi @bramroop, It's seem I can reproduce the issue on my side. I run it 6 times. It was failed 5 times but it was passed once. We'll investigate with @LavrovArtem why it happens |
I've reproduced the issue and created a separate issue in our proxy server repo. |
Great! Let's keep this issue opened to track the progress. |
I am facing similar issue for one of our application : |
Getting maybe a related issue, with both 0.17.2 and 0.18.6. Our client side js has code xhr.setRequestHeader('XSRF-Token', $.cookie("myCookie") in an AJAX prefilter. This works fine from manual user operation, but when testcafe runs, we get XSRF error. I dug a bit and am going to post what I found, even though I don't fully understand it. We see three requests to the server, the first is NOT intercepted by testcafe, the second one is, and then the third one fails:
The first 401 is because our "logged in" cookie is not present at all in the browser's session for example.com. Testcafe is not proxying this request for some reason. Then it seems to "notice" this and it sends the second request. I would expect the third request to succeed, since both it and the immediately preceding request were correctly proxied, but somehow our client Javascript is no longer accessing the latest cookie. I don't fully understand why, but in any case I'd bet that if testcafe did not allow request 1 through, the problem would not happen. Maybe someone more familiar with how testcafe does request interception could comment? |
Hi @SolaTest, |
Anything on this?? |
@LavrovArtem All right, that post says image requests are not proxied. That's unfortunate in our case, as we serve some of our images behind authentication, and have not implemented a separate CSRF pathway for those. We can work around it, but it would be better if there were at least an option to just let image requests go through the same pathway. Is there a ticket for this? Or were there actually measured performance issues with that approach? |
Hi @SolaTest |
@bramroop @vigneshwar-v @shiveshyadav @SolaTest The cause of the problem is described in DevExpress/testcafe-hammerhead#1486. Track it to stay informed about our progress. |
Hi @bramroop @SolaTest @shiveshyadav, thanks for sharing your problems. I close this because it's duplicated by DevExpress/testcafe-hammerhead#1486. You can use DevExpress/testcafe-hammerhead#1486 to track the progress in resolving this issue, and I will inform you when a fix is available on NPM. |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs or feature requests. For TestCafe API, usage and configuration inquiries, we recommend asking them on StackOverflow. |
Are you requesting a feature or reporting a bug?
Bug
What is the current behavior?
Interaction is blocked on certain websites that require CSRF Tokens (website warns that cookies need to be enabled before you can submit forms)
What is the expected behavior?
Interactions on such websites should be allowed even through testcafe
How would you reproduce the current behavior (if this is a bug)?
Use testcafe to try to submit a form (eg, try to login to the website below) by executing
testcafe chrome <test_file>
Provide the test code and the tested page URL (if applicable)
Tested page URL: https://mypharmacy.shoppersdrugmart.ca/en/login
Test code
Specify your
The text was updated successfully, but these errors were encountered: