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

referrer-policy

Skill này làm gì

Skill này kiểm tra các header website gửi đi và đặt Referrer-Policy để giới hạn thông tin địa chỉ được chia sẻ với website khác. Skill dành cho lập trình viên muốn bảo vệ các liên kết và token nhạy cảm.

Khi nào nên dùng

  • ✓Khi bạn yêu cầu agent rà soát các header bảo mật của website.
  • ✓Khi trang của bạn có token hoặc ID riêng trong địa chỉ và bạn muốn ngăn chúng rò rỉ.
  • ✓Khi bạn tăng cường bảo mật một ứng dụng xử lý đăng nhập hoặc phiên làm việc.

Liên kết skill

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

“Liên kết đặt lại mật khẩu của tôi có token trong đó. Bạn có thể đảm bảo token không bị rò sang website khác khi ai đó nhấp liên kết không?”

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

Cách hoạt động

Agent kiểm tra xem header Referrer-Policy có được gửi không và đặt nó thành strict-origin-when-cross-origin, một mặc định được khuyến nghị. Với các trang có địa chỉ đặc biệt nhạy cảm, agent gợi ý cài đặt chặt hơn.

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 a Referrer-Policy header

Without a Referrer-Policy, a password reset link like https://example.com/reset?token=abc123 is included in the Referer header when the user clicks an external link on that page — leaking the token to third parties.

Quick Reference

  • Use Referrer-Policy: strict-origin-when-cross-origin — the recommended modern default
  • strict-origin-when-cross-origin sends the full URL for same-origin requests, only the origin for cross-origin HTTPS, and nothing for HTTPS→HTTP
  • Never use unsafe-url — it sends the full URL including path and query string to every external site
  • Can be set via HTTP header, <meta> tag, or the referrerpolicy attribute on individual <a> and <img> elements
  • Sensitive URLs (reset tokens, private IDs) in query strings can be exposed via the Referer header if policy is too permissive

Check

Check whether the server sends a Referrer-Policy header and verify the value is appropriate. The recommended value is strict-origin-when-cross-origin. Check for any pages with sensitive URL parameters that could be leaked via the Referer header.

Fix

Add Referrer-Policy: strict-origin-when-cross-origin to all HTTP responses. Configure it in your web server, CDN, or application framework. For pages with particularly sensitive URLs, consider no-referrer or same-origin.

Explain

Explain what the Referer header contains, how a permissive Referrer-Policy can leak sensitive URL parameters to third parties, and what the difference is between the various Referrer-Policy values.

Code Review

Review server config, headers, forms, and integration points related to Set a Referrer-Policy 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/referrer-policy

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

strict-origin-when-cross-origin làm gì?

Nó gửi toàn bộ địa chỉ tới website của bạn, chỉ gửi tên website tới các website HTTPS khác, và không gửi gì khi chuyển từ HTTPS sang HTTP.

Vì sao nên tránh unsafe-url?

Skill nói nó gửi toàn bộ địa chỉ, gồm đường dẫn và chuỗi truy vấn, tới mọi website bên ngoài.

Chính sách này còn có thể đặt ở đâu?

Skill nói nó cũng có thể đặt bằng thẻ meta hoặc trên từng liên kết và hình ảnh riêng lẻ.

Chi tiết

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

Use when reviewing HTTP response headers for privacy hardening on any website that handles authentication, session state, or sensitive URL parameters.

repo: thedaviddias/Front-End-Checklist

Độ phổ biến

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