fix(frontend): resolve invalid HTML nesting and tabnabbing vulnerabilities (#1904)

* fix(frontend): resolve invalid HTML nesting and tabnabbing vulnerabilities

Fix `<button>` inside `<a>` invalid HTML in artifact components and add
missing `noopener,noreferrer` to `window.open` calls to prevent reverse
tabnabbing.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix(frontend): address Copilot review on tabnabbing and double-tab-open

Remove redundant parent onClick on web_fetch ChainOfThoughtStep to
prevent opening two tabs on link click, and explicitly null out
window.opener after window.open() for defensive tabnabbing hardening.

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
yangzheli
2026-04-07 09:44:17 +08:00
committed by GitHub
parent 2d068cc075
commit 3acdf79beb
3 changed files with 45 additions and 40 deletions
@@ -104,21 +104,21 @@ export function ArtifactFileList({
{t.common.install}
</Button>
)}
<a
href={urlOfArtifact({
filepath: file,
threadId: threadId,
download: true,
})}
target="_blank"
rel="noopener noreferrer"
onClick={(e) => e.stopPropagation()}
>
<Button variant="ghost">
<Button variant="ghost" asChild>
<a
href={urlOfArtifact({
filepath: file,
threadId: threadId,
download: true,
})}
target="_blank"
rel="noopener noreferrer"
onClick={(e) => e.stopPropagation()}
>
<DownloadIcon className="size-4" />
{t.common.download}
</Button>
</a>
</a>
</Button>
</CardAction>
</CardHeader>
</Card>