mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-30 20:59:16 +00:00
LibURL: Use a nonce to distinguish opaque origins
Opaque origins are meant to be unique in terms of equality from one another. Since this uniqueness needs to be across processes, use a nonce to implement the uniqueness check.
This commit is contained in:
parent
ee8e4d1eec
commit
38765fd617
Notes:
github-actions[bot]
2025-06-25 15:48:27 +00:00
Author: https://github.com/shannonbooth
Commit: 38765fd617
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/5193
Reviewed-by: https://github.com/tcl3 ✅
7 changed files with 77 additions and 24 deletions
|
@ -0,0 +1,36 @@
|
|||
<!DOCTYPE html>
|
||||
<script src="../include.js"></script>
|
||||
<body>
|
||||
<iframe id="iframeOuter"></iframe>
|
||||
|
||||
<script>
|
||||
asyncTest(async done => {
|
||||
const iframeOuter = document.getElementById('iframeOuter');
|
||||
|
||||
window.addEventListener('message', (event) => {
|
||||
println(event.data);
|
||||
done();
|
||||
});
|
||||
|
||||
// Data URLs result in the iframes having an opaque origin, resulting in cross origin access.
|
||||
const iframeOuterContent = `
|
||||
<iframe id="iframeInner" src="data:text/html,<p>Iframe 1 content</p>" style="width: 300px; height: 100px;"></iframe>
|
||||
|
||||
<script>
|
||||
const iframeInner = document.getElementById('iframeInner');
|
||||
|
||||
iframeInner.onload = () => {
|
||||
try {
|
||||
iframeInner.contentWindow.parent.frames[0].thing;
|
||||
} catch (e) {
|
||||
window.top.postMessage(e.message, '*');
|
||||
}
|
||||
}
|
||||
|
||||
<\/script>
|
||||
`;
|
||||
|
||||
iframeOuter.src = 'data:text/html,' + encodeURIComponent(iframeOuterContent);
|
||||
})
|
||||
</script>
|
||||
</body>
|
Loading…
Add table
Add a link
Reference in a new issue