chore(frontend): enforce rel=noopener on target=_blank via eslint (CWE-1022)
Enable svelte/no-target-blank so reverse-tabnabbing is caught at lint time instead of relying on review (the very gap that left the viewer download link exposed). Repo is already clean — all existing target="_blank" anchors carry rel="noopener noreferrer". Addresses re-review: Nora (optional detection-for-free). Refs #708 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -77,7 +77,11 @@ export default defineConfig(
|
|||||||
// defense (the CI regex stays as a backstop). For any legitimate use (e.g.
|
// defense (the CI regex stays as a backstop). For any legitimate use (e.g.
|
||||||
// trusted server-rendered Markdown), suppress with an inline
|
// trusted server-rendered Markdown), suppress with an inline
|
||||||
// `<!-- eslint-disable-next-line svelte/no-at-html-tags -->` and a justification.
|
// `<!-- eslint-disable-next-line svelte/no-at-html-tags -->` and a justification.
|
||||||
'svelte/no-at-html-tags': 'error'
|
'svelte/no-at-html-tags': 'error',
|
||||||
|
// Reverse-tabnabbing (CWE-1022): any `target="_blank"` anchor must carry
|
||||||
|
// `rel="noopener noreferrer"`, or the opened page can hijack window.opener.
|
||||||
|
// Catches the pattern at lint time instead of relying on review. See #708.
|
||||||
|
'svelte/no-target-blank': ['error', { allowReferrer: false, enforceDynamicLinks: 'always' }]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user