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

x-frame-options

Skill này làm gì

Skill này kiểm tra xem website có chặn các trang web khác nhúng trang của nó vào khung hay không. Nó dành cho lập trình viên và nhân viên bảo mật bảo vệ website có đăng nhập hoặc thao tác của người dùng.

Khi nào nên dùng

  • ✓Khi website có đăng nhập hoặc thanh toán mà không có header bảo vệ khỏi nhúng khung.
  • ✓Khi quét bảo mật báo rủi ro clickjacking.
  • ✓Khi website chỉ nên được nhúng trên chính tên miền của nó.

Liên kết skill

https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/x-frame-options/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/x-frame-options/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

“Một quét bảo mật báo trang đăng nhập của tôi có thể bị đặt trong khung của trang khác. Làm sao để chặn điều đó?”

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

Cách hoạt động

Agent thêm header ngăn các trang khác nhúng trang vào khung, hoặc giới hạn việc nhúng trong cùng tên miền. Nó cũng có thể gợi ý cài đặt frame-ancestors mới hơn của CSP.

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.

Set an X-Frame-Options header

Without framing protection, an attacker can embed your banking login page in a transparent iframe on a malicious site and trick users into clicking buttons they cannot see — transferring money, changing settings, or leaking credentials.

Quick Reference

  • Use X-Frame-Options: DENY to prevent all framing, or SAMEORIGIN to allow framing only from your own domain
  • ALLOWFROM is obsolete and unsupported in modern browsers — use CSP frame-ancestors instead
  • The modern equivalent is Content-Security-Policy: frame-ancestors 'none' — prefer CSP for new sites
  • Both headers can coexist: X-Frame-Options for older browsers, frame-ancestors for modern ones
  • Clickjacking attacks trick users into clicking invisible iframe buttons — DENY eliminates this entirely

Check

Check whether the server sends an X-Frame-Options header (DENY or SAMEORIGIN) or a Content-Security-Policy header with frame-ancestors directive to prevent clickjacking.

Fix

Add X-Frame-Options: DENY to all responses if the site does not need to be embedded anywhere. If legitimate framing is needed on the same origin, use SAMEORIGIN. For fine-grained control, use CSP frame-ancestors instead.

Explain

Explain what a clickjacking attack is, how X-Frame-Options and CSP frame-ancestors prevent it, and the difference between DENY and SAMEORIGIN values.

Code Review

Review server config, headers, forms, and integration points related to Set an X-Frame-Options header. 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/x-frame-options

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

Clickjacking là gì?

Đó là một tấn công trong đó khung ẩn cho phép trang độc hại lừa người dùng bấm vào các nút họ không nhìn thấy.

DENY và SAMEORIGIN khác nhau thế nào?

DENY chặn mọi việc nhúng khung, còn SAMEORIGIN chỉ cho phép nhúng từ chính tên miền của bạn.

ALLOWFROM còn được hỗ trợ không?

Không. Skill cho biết nó đã lỗi thời và không được các trình duyệt hiện đại hỗ trợ.

Chi tiết

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

Use when reviewing HTTP response headers for clickjacking protection on any web application with authenticated user actions.

repo: thedaviddias/Front-End-Checklist

Độ phổ biến

Sao GitHub
75k
Vị trí xếp hạng
#3091
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ự