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

Possibly wrong match on topOrParentLocationOrFramesRe regexp #3267

Closed
leandro-serafim opened this issue Jan 31, 2019 · 3 comments · Fixed by #3279
Closed

Possibly wrong match on topOrParentLocationOrFramesRe regexp #3267

leandro-serafim opened this issue Jan 31, 2019 · 3 comments · Fixed by #3279

Comments

@leandro-serafim
Copy link

leandro-serafim commented Jan 31, 2019

Current behavior:

Currently, having modifyObstructiveCode enabled didn't get a specific framebust situation:

top.location!=self.location&&(top.location.href=self.location.href)

After researching over the code base I could identify the regexp used on topOrParentLocationOrFramesRe possibly isn't getting correctly the first group match, as you can see: (https://regex101.com/r/o0ykmR/1)

Desired behavior:

I'd like to be able to block the given framebust.

Steps to reproduce: (app code and test code)

The regexp on topOrParentLocationOrFramesRe gets an extra character as you see here

Possibly the easiest fix I'd suggest could be:
https://regex101.com/r/Ophqrr/2

Versions

Cypress: v3.1.5
Windows 11
Chrome: 71.x

@jennifer-shehane
Copy link
Member

jennifer-shehane commented Feb 1, 2019

Thanks for the thorough investigation of the issue. Gotta <3 Regex. We'll have to update the regex, write a test to ensure it fixes this issue and ensure no other framebusting tests fail.

@jennifer-shehane
Copy link
Member

I opened a PR here: #3279

@jennifer-shehane jennifer-shehane added stage: work in progress stage: needs review The PR code is done & tested, needs review and removed stage: backlog stage: needs review The PR code is done & tested, needs review labels Feb 1, 2019
@cypress-bot
Copy link
Contributor

cypress-bot bot commented Mar 15, 2019

Released in 3.2.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants