-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
Prepending Stale Cookies to requests after 10.3 #22751
Comments
Right now there doesn't seem to be enough information to reproduce the problem on our end, but it's possible this is fixed by #22594, which will be in the next release. If possible, could you try your tests against the latest pre-release version of Cypress. Here are instructions on how to install it. You can use this commit. |
@chrisbreiding Thanks, but I think I’ll just wait for the next release and report back afterwards. There were seven Cypress releases in June, so I suppose the next one is already waiting around the corner. |
Should be out early next week, so it won't be too long. Look forward to hearing if it fixes your issue. |
@iomedico-beyer, 10.3.1 released today, could you give it a try? |
I did. Same problem. |
@iomedico-beyer, I'm sorry to hear 10.3.1 didn't address your issue. I will bet that your issue was caused by this change #20685, and this is where i'll need your help. I'm sure that some how cookies are not being passed correctly in your circumstance. Would it be possible for you to put together a reproduction that we could test against? Or baring that could you look into what cookies aren't getting passed and how they're being set? |
I have a similar problem and did some investigation on what's changed between v10.2 and v10.3 for my test case. I found that a POST request in its request header has a The content of the cookie in cypress 10.3.0 and 10.3.1 has the same value twice in it, separated by a Not sure if this is related to this issue, or if it's a new one. |
10.3.1 (and probably also 10.3) stores two additional cookies which interestingly have no value. But removing them seems to work for me!
|
@sebkasanzew @iomedico-beyer Thanks for the debugging! I'm sure we must be storing cookies that we shouldn't. Would there be any way you guys could provide a reproduction? It will be hard for us to debug the issue without code to work off. 🤔 |
@mjhenkes I want to give you something to play with, but run into a strange problem. https://edc6.iomedico.de/ Expected: 403, because authenticated but not authorized. But coming from that domain And Cypress says “The Snapshot is Missing. Displaying Current State Of The Dom.” |
I am also experiencing this issue Edit1: I have also confirmed that my session is storing 3 additional cookies in 10.3+ when compared with 10.2 I have duplicates of JSESSIONID, NSC_dmjfouqpsubm, and SREINGRESS Our application implements a third party SSO from IAM |
@iomedico-beyer, I setup a sample repo https://github.com/mjhenkes/issue-22751 to check what you were seeing. I think the issue that your running into is that in prod, your login is on the same origin as your site, where as in development using keycloak the login is on a different origin. It seems that in this instance |
@mjhenkes I see. Should I report that |
@iomedico-beyer, I can take care of logging the new issue. Unfortunately, to recreate this issue i need to have the auth provider to be on a different origin from top and to run through the cy.origin command, other wise cookies will function as normal 😅. logged: #22942 |
I tried testing the basic keycloak docker example, offered by keycloak, but it worked fine. I think it's just too simple. |
My guess is this is related to the appending logic we have in the request, and possibly doubly set it in the response. @iomedico-beyer I have quite a few issues to go through, but would you maybe be able to get a reproduction together? I have a reproduction issue with keycloak instructions from a few iterations ago for issue #22282 which might serve as a good base. Once that is available, I can quickly verify that the appending logic is causing/not causing issues. |
Sorry, but I am currently very busy with other stuff. Maybe @sebkasanzew or @agebhardtsbauer? |
@iomedico-beyer I'll try to build a repo with a reproducible error tomorrow, but can't promise anything. |
@AtofStryker Here is a repo with the reproducible error https://github.com/Sebkasanzew/cypress-issue-22751. It was easier than I thought 😅. Thanks for the template @iomedico-beyer . |
@sebkasanzew I was able to clone your reproduction and was able to reproduce the issue. I am pretty sure I know what the issue is, as we prepend updated cookies to the request and do not remove the stale values. This also explains why the cookie size is just about double on the request. We likely need to adapt this logic to override the previous cookie values, which should lead to expected behavior. |
Current behavior
We use cy.session+cy.origin (see code below) to login with Keycloak which is hosted on a different domain. This always worked well until updating from Cypress 10.2 to 10.3.
After the first tests, the session seems broken, although Cypress logs "Validate Session: valid". Authentification is no longer established. When I add a
cy.wait(1000)
betweenvisit
andcontains
in the test code ofit('starts again'
I can see that the browser is at the login screen again. There is also this error:Same happens even for the first test if I rerun all tests using the "Run All Tests" button.
Desired behavior
Cypress should be able to store and recover the session (cookies?), as it already did before 10.3.
Test code to reproduce
In
support/commands.ts
:In
Cypress-issue-22751.cy.ts
:Cypress Version
10.3, 10.3.1, 10.4
Other
Tested with Chrome, Edge, Electron.
The text was updated successfully, but these errors were encountered: