Skip to content

fix(ui): prevent tabnabbing in chat images#18685

Merged
shakkernerd merged 4 commits intoopenclaw:mainfrom
Mariana-Codebase:main
Feb 24, 2026
Merged

fix(ui): prevent tabnabbing in chat images#18685
shakkernerd merged 4 commits intoopenclaw:mainfrom
Mariana-Codebase:main

Conversation

@Mariana-Codebase
Copy link
Contributor

@Mariana-Codebase Mariana-Codebase commented Feb 16, 2026

Summary

  • Problem: opening chat images with window.open allows tabnabbing via window.opener.
  • Why it matters: an external tab can redirect or manipulate the original app (phishing).
  • What changed: use noopener,noreferrer and force opener = null.
  • What did NOT change (scope boundary): no changes to image rendering or loading.

Change Type (select all)

  • Bug fix
  • Feature
  • Refactor
  • Docs
  • Security hardening
  • Chore/infra

Scope (select all touched areas)

  • Gateway / orchestration
  • Skills / tool execution
  • Auth / tokens
  • Memory / storage
  • Integrations
  • API / contracts
  • UI / DX
  • CI/CD / infra

Linked Issue/PR

  • Closes #
  • Related #

User-visible / Behavior Changes

  • Opening chat images now opens a new tab without access to window.opener.

Security Impact (required)

  • New permissions/capabilities? (No)
  • Secrets/tokens handling changed? (No)
  • New/changed network calls? (No)
  • Command/tool execution surface changed? (No)
  • Data access scope changed? (No)
  • If any Yes, explain risk + mitigation:

Repro + Verification

Environment

  • OS: Windows 10
  • Runtime/container: N/A
  • Model/provider: N/A
  • Integration/channel (if any): N/A
  • Relevant config (redacted): N/A

Steps

  1. Open a chat image.
  2. Verify the opened tab has no access to window.opener.

Expected

  • window.opener is null in the opened tab.

Actual

  • window.opener is null in the opened tab.

Evidence

Attach at least one:

  • Failing test/log before + passing after
  • Trace/log snippets
  • Screenshot/recording
  • Perf numbers (if relevant)

Human Verification (required)

  • Verified scenarios: clicking a chat image opens a new tab without opener.
  • Edge cases checked: N/A
  • What you did not verify: other browsers.

Compatibility / Migration

  • Backward compatible? (Yes)
  • Config/env changes? (No)
  • Migration needed? (No)
  • If yes, exact upgrade steps:

Failure Recovery (if this breaks)

  • How to disable/revert this change quickly: revert commit.
  • Files/config to restore: ui/src/ui/chat/grouped-render.ts
  • Known bad symptoms reviewers should watch for: N/A

Risks and Mitigations

  • Risk: None.
    • Mitigation: N/A

Greptile Summary

Adds tabnabbing protection to the chat image click handler in grouped-render.ts. The previous window.open(url, "_blank") call gave the opened tab access to window.opener, which could be exploited for phishing by redirecting or manipulating the original app tab. The fix passes noopener,noreferrer as window features and adds a fallback opener = null assignment for defense-in-depth in older browsers.

  • Extracts image-open logic into a dedicated openImage helper with security hardening
  • No functional or rendering changes; only the security posture of the new-tab open is affected
  • The change is minimal, scoped, and follows standard browser security best practices

Confidence Score: 5/5

  • This PR is safe to merge — it applies a standard, well-understood browser security pattern with no behavioral side effects.
  • The change is a single-file, minimal security hardening that adds noopener,noreferrer to a window.open call. It introduces no new logic, no new dependencies, and no behavioral changes beyond removing the opener reference. The pattern is standard and widely recommended by OWASP and browser security guidelines.
  • No files require special attention.

Last reviewed commit: 4ee26ff

(3/5) Reply to the agent's comments like "Can you suggest a fix for this @greptileai?" or ask follow-up questions!

@Mariana-Codebase Mariana-Codebase changed the title UI: prevent tabnabbing in chat images fix(UI): prevent tabnabbing in chat images Feb 17, 2026
@Mariana-Codebase Mariana-Codebase changed the title fix(UI): prevent tabnabbing in chat images fix(ui): prevent tabnabbing in chat images Feb 17, 2026
@shakkernerd shakkernerd merged commit 649d141 into openclaw:main Feb 24, 2026
21 of 22 checks passed
@shakkernerd
Copy link
Member

shakkernerd commented Feb 24, 2026

Landed iin main:

  • Pushed commit a42f6f25d to the PR head branch.
  • Merged this PR as squash into main.

Merge commit: 649d141527488281e75d9f67e380ee522426817b

Thanks @Mariana-Codebase!

plgs2005 pushed a commit to plgs2005/openclaw that referenced this pull request Feb 24, 2026
* UI: prevent tabnabbing in chat images

* ui: remove comment from image open helper

---------

Co-authored-by: Shakker <shakkerdroid@gmail.com>
xianfeng92 pushed a commit to xianfeng92/openclaw that referenced this pull request Feb 24, 2026
* UI: prevent tabnabbing in chat images

* ui: remove comment from image open helper

---------

Co-authored-by: Shakker <shakkerdroid@gmail.com>
(cherry picked from commit 649d141)
obviyus pushed a commit to Glucksberg/OpenClaw that referenced this pull request Feb 24, 2026
* UI: prevent tabnabbing in chat images

* ui: remove comment from image open helper

---------

Co-authored-by: Shakker <shakkerdroid@gmail.com>
margulans pushed a commit to margulans/Neiron-AI-assistant that referenced this pull request Feb 25, 2026
* UI: prevent tabnabbing in chat images

* ui: remove comment from image open helper

---------

Co-authored-by: Shakker <shakkerdroid@gmail.com>
brianleach pushed a commit to brianleach/openclaw that referenced this pull request Feb 26, 2026
* UI: prevent tabnabbing in chat images

* ui: remove comment from image open helper

---------

Co-authored-by: Shakker <shakkerdroid@gmail.com>
execute008 pushed a commit to execute008/openclaw that referenced this pull request Feb 27, 2026
* UI: prevent tabnabbing in chat images

* ui: remove comment from image open helper

---------

Co-authored-by: Shakker <shakkerdroid@gmail.com>
Get-windy pushed a commit to Get-windy/JieZi-ai-PS that referenced this pull request Feb 28, 2026
更新内容:
- fix(ui): prevent tabnabbing in chat images (openclaw#18685)
- fix(cli): replace stale doctor/restart command hints (openclaw#24485)
- Auto-reply: normalize stop matching + multilingual triggers (openclaw#25103)
- docs: fix broken links, add maintainer
r4jiv007 pushed a commit to r4jiv007/openclaw that referenced this pull request Feb 28, 2026
* UI: prevent tabnabbing in chat images

* ui: remove comment from image open helper

---------

Co-authored-by: Shakker <shakkerdroid@gmail.com>
joelnishanth pushed a commit to joelnishanth/openclaw that referenced this pull request Mar 3, 2026
* UI: prevent tabnabbing in chat images

* ui: remove comment from image open helper

---------

Co-authored-by: Shakker <shakkerdroid@gmail.com>
zooqueen pushed a commit to hanzoai/bot that referenced this pull request Mar 6, 2026
* UI: prevent tabnabbing in chat images

* ui: remove comment from image open helper

---------

Co-authored-by: Shakker <shakkerdroid@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants