mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-18 00:54:43 -04:00
Add rel="noopener" to target="_blank" links
The noopener construct protects from some nasty clickjacking attacks. We can apply them savely to all our links since we don't rely on the previously used page. Some more details: https://mathiasbynens.github.io/rel-noopener/ Signed-off-by: Sheogorath <sheogorath@shivering-isles.com>
This commit is contained in:
parent
d9ba11b21a
commit
75a23fe2c9
5 changed files with 15 additions and 13 deletions
|
@ -570,7 +570,9 @@ export function postProcess (code) {
|
|||
$(value).html(html)
|
||||
})
|
||||
// link should open in new window or tab
|
||||
result.find('a:not([href^="#"]):not([target])').attr('target', '_blank')
|
||||
// also add noopener to prevent clickjacking
|
||||
// See details: https://mathiasbynens.github.io/rel-noopener/
|
||||
result.find('a:not([href^="#"]):not([target])').attr('target', '_blank').attr('rel', 'noopener')
|
||||
// update continue line numbers
|
||||
const linenumberdivs = result.find('.gutter.linenumber').toArray()
|
||||
for (let i = 0; i < linenumberdivs.length; i++) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue