test(security): test case for quoted URL values.
Test case that fixes #8701. This is already supported with the latest sanitizer changes, but it's good to have an explicit test case.
This commit is contained in:
parent
e5904f4089
commit
5e12a95789
|
@ -32,8 +32,16 @@ export function main() {
|
||||||
});
|
});
|
||||||
t.it('sanitizes URLs', () => {
|
t.it('sanitizes URLs', () => {
|
||||||
expectSanitize('url(foo/bar.png)').toEqual('url(foo/bar.png)');
|
expectSanitize('url(foo/bar.png)').toEqual('url(foo/bar.png)');
|
||||||
|
expectSanitize('url( foo/bar.png\n )').toEqual('url( foo/bar.png\n )');
|
||||||
expectSanitize('url(javascript:evil())').toEqual('unsafe');
|
expectSanitize('url(javascript:evil())').toEqual('unsafe');
|
||||||
expectSanitize('url(strangeprotocol:evil)').toEqual('unsafe');
|
expectSanitize('url(strangeprotocol:evil)').toEqual('unsafe');
|
||||||
});
|
});
|
||||||
|
t.it('accepts quoted URLs', () => {
|
||||||
|
expectSanitize('url("foo/bar.png")').toEqual('url("foo/bar.png")');
|
||||||
|
expectSanitize(`url('foo/bar.png')`).toEqual(`url('foo/bar.png')`);
|
||||||
|
expectSanitize(`url( 'foo/bar.png'\n )`).toEqual(`url( 'foo/bar.png'\n )`);
|
||||||
|
expectSanitize('url("javascript:evil()")').toEqual('unsafe');
|
||||||
|
expectSanitize('url( " javascript:evil() " )').toEqual('unsafe');
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue