Skip to content

Commit 751ed46

Browse files
author
pooya parsa
committed
test: add dangerous key test
1 parent fe3d061 commit 751ed46

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

test/test.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,11 @@ describe('devalue', () => {
8888
`</script><script src='https://evil.com/script.js'>alert('pwned')</script><script>`,
8989
`"\\u003C\\u002Fscript\\u003E\\u003Cscript src='https:\\u002F\\u002Fevil.com\\u002Fscript.js'\\u003Ealert('pwned')\\u003C\\u002Fscript\\u003E\\u003Cscript\\u003E"`
9090
);
91+
test(
92+
'Dangerous key',
93+
{ '<svg onload=alert("xss_works")>': 'bar' },
94+
'{"\\\\u003Csvg onload=alert(\\"xss_works\\")\\\\u003E":"bar"}'
95+
)
9196
});
9297

9398
describe('misc', () => {
@@ -109,4 +114,4 @@ describe('devalue', () => {
109114
assert.throws(() => devalue({ [Symbol()]: null }));
110115
});
111116
});
112-
});
117+
});

0 commit comments

Comments
 (0)