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:
@@ -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++) {
|
||||
|
||||
Reference in New Issue
Block a user