Chuyển đến nội dung
Skillpedia
Bảo mật75k · #2949

new-tab

Skill này làm gì

Skill này kiểm tra các liên kết mở ở tab mới và đảm bảo chúng có thuộc tính an toàn, chặn một kiểu tấn công chiếm quyền tab phổ biến. Skill dành cho lập trình viên đang rà soát mã HTML hoặc JSX.

Khi nào nên dùng

  • ✓Khi bạn nhờ agent kiểm tra an toàn các liên kết mở ở tab mới.
  • ✓Khi bạn đang rà soát mã mở các liên kết bên ngoài ở tab mới.
  • ✓Khi bạn thêm một quy tắc lint để các liên kết mới mở ở tab mới luôn được kiểm tra tự động.

Liên kết skill

https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/new-tab/SKILL.md

Sao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.

Cách dùng

Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.

Tin nhắn có sẵn để dán

Hãy dùng skill này để giúp tôi: https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/new-tab/SKILL.md Đọc tệp SKILL.md tại liên kết đó và làm theo hướng dẫn cho việc của tôi.
Bạn muốn AI tự tìm những skill như thế này?Cài MCP Skillpedia miễn phí: chỉ một dòng, và AI sẽ tìm trong 15.000+ skill trước mỗi việc.Cài đặt trong 1 phút →

Ví dụ cách nhờ AI

“Bạn có thể kiểm tra mọi liên kết trên site của tôi mở ở tab mới xem đã có thuộc tính bảo mật đúng chưa không?”

5 skill mới mỗi tuần. Đọc chỉ 1 phút.

Cách hoạt động

Agent tìm các phần tử anchor mở ở tab mới và kiểm tra xem chúng có rel noopener noreferrer, hoặc ít nhất là noopener không. Agent thêm thuộc tính còn thiếu và có thể gợi ý một quy tắc lint để tránh thiếu sót sau này.

Nội dung kỹ thuật (SKILL.md gốc)

Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.

External Link Security

A malicious site opened via target='_blank' can use window.opener.location to silently redirect your original tab to a phishing page — the user switches back and sees a fake login screen on what appears to be your domain.

Quick Reference

  • Always add rel="noopener noreferrer" to any <a target="_blank"> link
  • noopener prevents the new tab from accessing window.opener and redirecting your page
  • noreferrer additionally suppresses the Referer header sent to the destination site
  • Modern browsers (Chrome 88+, Firefox 79+) implicitly add noopener for cross-origin _blank links, but explicit markup is required for older browsers and same-origin links
  • ESLint rule jsx-a11y/anchor-is-valid and eslint-plugin-security can enforce this automatically

Check

Find all anchor elements with target='_blank' in the HTML and JSX source. Verify each one includes rel='noopener noreferrer' (or at minimum rel='noopener'). Flag any external links opening in a new tab that are missing this attribute.

Fix

Add rel='noopener noreferrer' to all <a target='_blank'> elements. In React/JSX this is rel="noopener noreferrer". Configure an ESLint rule to prevent this from recurring.

Explain

Explain the reverse tabnapping attack enabled by window.opener, how rel='noopener' and rel='noreferrer' prevent it, and the difference between the two values.

Code Review

Review server config, headers, forms, and integration points related to External Link Security. Flag exact responses, cookies, or browser behaviors that violate the rule, and verify them against the effective production-like response.


For full implementation details, code examples, and framework-specific guidance, see references/rule.md.

Rule page: https://frontendchecklist.io/rules/security/new-tab

Câu hỏi thường gặp

Reverse tabnabbing là gì?

Đây là kiểu tấn công mà tab mới dùng window.opener để âm thầm chuyển tab gốc của bạn sang một trang giả mạo.

noreferrer làm gì?

Thuộc tính này ngăn trình duyệt gửi header Referer đến trang đích.

Trình duyệt hiện đại đã tự bảo vệ tôi chưa?

Một số trình duyệt có bảo vệ cho liên kết khác nguồn, nhưng skill nói rằng với trình duyệt cũ và liên kết cùng nguồn vẫn cần khai báo rõ ràng trong đánh dấu.

Chi tiết

Mô tả gốc của tác giả

Use when reviewing HTML or JSX for anchor elements with target='_blank' to verify rel='noopener noreferrer' is present.

repo: thedaviddias/Front-End-Checklist

Độ phổ biến

Sao GitHub
75k
Vị trí xếp hạng
#2949
Giấy phép
MIT
Cập nhật
31/10/2026

Skill này có hữu ích không?

0

Đăng nhập để bình chọn.

Bình luận

  • …

Thêm skill từ kho mã này

Skill tương tự