mirror of
https://github.com/kevinveenbirkenbach/homepage.veen.world.git
synced 2026-09-23 19:03:18 +00:00
An empty value resolved against window.location.href, so a page without an iframe parameter passed both the scheme check and the origin allowlist carrying its own URL. Every load entered fullscreen and framed the page inside itself, and the navigation observer wrote that URL back into the parameter, nesting it deeper on every poll until the URL ran to kilometres. safeUrl now rejects a missing value, the caller tests the parameter before validating it, and the history entry keeps the URL it was given rather than the resolved one. The regression spec covers the four properties a page without the parameter must have, and fails on each of them when the defect is put back. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
32 lines
949 B
JavaScript
32 lines
949 B
JavaScript
describe('A page without an iframe parameter', () => {
|
|
beforeEach(() => {
|
|
cy.visit('/');
|
|
});
|
|
|
|
it('stays out of fullscreen', () => {
|
|
cy.get('body').should('not.have.class', 'fullscreen');
|
|
});
|
|
|
|
it('frames nothing', () => {
|
|
cy.get('#main').find('iframe').should('not.exist');
|
|
cy.url().should('not.include', 'iframe=');
|
|
});
|
|
|
|
it('never grows an iframe parameter out of its own URL', () => {
|
|
cy.wait(2000);
|
|
|
|
cy.url().then((url) => {
|
|
expect((url.match(/iframe/g) || []).length, 'iframe parameters').to.equal(0);
|
|
});
|
|
});
|
|
|
|
it('treats an absent URL as unsafe', () => {
|
|
cy.window().then((win) => {
|
|
expect(win.safeUrl(null), 'null').to.equal(null);
|
|
expect(win.safeUrl(''), 'empty string').to.equal(null);
|
|
expect(win.safeUrl('javascript:alert(1)'), 'script URL').to.equal(null);
|
|
expect(win.safeUrl('/de/'), 'relative path').to.equal(`${win.location.origin}/de/`);
|
|
});
|
|
});
|
|
});
|