@revoloo/cypress6
Version:
Cypress.io end to end testing tool
43 lines (39 loc) • 1.51 kB
HTML
<html>
<body>
testing security clickjacking and framebusting
<script type="text/javascript" src="security.js"></script>
<script type="text/javascript">
(function () {
function run () {
const div = document.createElement('div')
div.innerText = 'security triggered'
document.body.appendChild(div)
}
window.topFoo = "foo"
window.parentFoo = "foo"
if (top != self) run()
if (top!=self) run()
if (top.location != self.location) run()
if (top.location != location) run()
if (parent.frames.length > 0) run()
if (window != top) run()
if (window.top !== window.self) run()
if (window.top!==window.self) run()
if (window.self != window.top) run()
if (window.top != window.self) run()
if (window["top"] != window["parent"]) run()
if (window['top'] != window['parent']) run()
if (window["top"] != self['parent']) run()
if (parent && parent != window) run()
if (parent && parent != self) run()
if (parent && window.topFoo != topFoo) run()
if (parent && window.parentFoo != parentFoo) run()
if (parent && window != parent) run()
if (parent && self != parent) run()
if (parent && parent.frames && parent.frames.length > 0) run()
if ((self.parent && !(self.parent === self)) && (self.parent.frames.length != 0)) run()
})()
</script>
</body>
</html>