mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-13 22:54:42 -04:00
Disallow data and javascript URIs (#1186)
* Disallow data and javascript URIs Signed-off-by: Erik Michelson <github@erik.michelson.eu>
This commit is contained in:
parent
031e37325c
commit
7a21a26166
2 changed files with 100 additions and 1 deletions
|
@ -25,7 +25,13 @@ export class LinkReplacer extends ComponentReplacer {
|
|||
return undefined
|
||||
}
|
||||
|
||||
const url = node.attribs.href
|
||||
const url = node.attribs.href.trim()
|
||||
|
||||
// eslint-disable-next-line no-script-url
|
||||
if (url.startsWith('data:') || url.startsWith('javascript:')) {
|
||||
return <span>{ node.attribs.href }</span>
|
||||
}
|
||||
|
||||
const isJumpMark = url.substr(0, 1) === '#'
|
||||
|
||||
const id = url.substr(1)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue