- Notifications
You must be signed in to change notification settings - Fork20.6k
Tests: Add tests for recently fixed manipulation XSS issues#4685
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
assert.ok( window.xss.withArgs( currCounter ).notCalled, | ||
"Insecure code wasn't executed, input: " + htmlString ); | ||
done(); | ||
}, 1000 ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
It would be nice to reduce this forced one-second frequency... what would you think about something like so?
div.appendTo(container);div.html(htmlString);container.append("<img src=x onerror=\"xssDone(counter)\">")
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
I'll try that, thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
@gibson042 Now that I think about it... How do we know thisonerror
callback will be fired as the last one? 404 responses may not be cached AFAIK so there's a risk that one will fire before the other ones are done.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Well,src="#"
would guarantee that the invalid source is cached.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
That will resolve to the current page, though, so it won't be a 404.
Also, currently all the tests succeed even if cache is disabled in the browser DevTools. I'd like to keep that working.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
@gibson042 I'm thinking about ways to reduce this delay but if I don't find anything reliable that'd work with cache disabled, I think I'll just merge it, we can always apply improvements later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
We don't need a 404, just need a response that isn't a successful image. And I don't see any cache concerns, but if you want to merge without the acceleration then I won't object.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Good point about not needing 404s. I tested your suggestion, though, and - if I understood it correctly - it looks like I was right about race conditions. See the code at:
mgol@7cd593f
I reverted the two security fixes locally & all assertions should fail but it's pretty random for me; on each refresh different ones are failing for me. I tried theesmodules
tests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Yeah, raciness confirmed. I don't think that's fatal to the testing, but it would require restructuring. No worries.
iOS 8-12 parses `<noembed>` tags differently, executing this code. This is nodifferent to native behavior on that OS, though, so just accept it.Refjquerygh-4685
Looks like one of the added tests fails in iOS 8 - 12. A followup fix PR, PTAL:#4694. |
Summary
Add tests for recently fixed manipulation XSS issues.
Refgh-4642
Refgh-4647
Checklist
If needed, a docs issue/PR was created athttps://github.com/jquery/api.jquery.com