From 48d2027c2569e565597199f6963863fd6ef871b6 Mon Sep 17 00:00:00 2001 From: syuilo Date: Sat, 4 Feb 2023 09:28:34 +0900 Subject: [PATCH] add some tests --- test/parser.ts | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/test/parser.ts b/test/parser.ts index cf6f677..80e364d 100644 --- a/test/parser.ts +++ b/test/parser.ts @@ -1028,6 +1028,14 @@ hoge`; ]; assert.deepStrictEqual(mfm.parse(input), output); }); + + it('prevent xss', () => { + const input = 'javascript:foo'; + const output = [ + TEXT('javascript:foo') + ]; + assert.deepStrictEqual(mfm.parse(input), output); + }); }); describe('link', () => { @@ -1064,6 +1072,14 @@ hoge`; assert.deepStrictEqual(mfm.parse(input), output); }); + it('prevent xss', () => { + const input = '[click here](javascript:foo)'; + const output = [ + TEXT('[click here](javascript:foo)') + ]; + assert.deepStrictEqual(mfm.parse(input), output); + }); + describe('cannot nest a url in a link label', () => { it('basic', () => { const input = 'official instance: [https://misskey.io/@ai](https://misskey.io/@ai).';