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

hsts

Skill này làm gì

Skill này kiểm tra xem trang web có bảo trình duyệt luôn dùng kết nối HTTPS an toàn hay không. Skill dành cho chủ trang web và lập trình viên muốn bảo vệ khách truy cập tốt hơn.

Khi nào nên dùng

  • ✓Khi trang web của bạn đã dùng HTTPS nhưng trình duyệt vẫn có thể thử HTTP thường trước.
  • ✓Khi bạn vận hành một trang web có đăng nhập hoặc xử lý dữ liệu cá nhân.
  • ✓Khi bạn cấu hình máy chủ, CDN hoặc dịch vụ lưu trữ mới.

Liên kết skill

https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/hsts/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/hsts/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ể thêm header HSTS vào các phản hồi an toàn của trang web của tôi 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 các phản hồi HTTPS có chứa header Strict-Transport-Security hay không và xem lại cài đặt. Agent gợi ý thời hạn max-age một năm, có bao gồm subdomain, và thử nghiệm trước khi đăng ký preload.

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 HSTS header

Without HSTS, an attacker on the same network can intercept the first HTTP request and strip TLS (SSL stripping), silently downgrading the connection before the browser ever sees a redirect.

Quick Reference

  • Set Strict-Transport-Security: max-age=31536000; includeSubDomains on all HTTPS responses
  • Use max-age=31536000 (1 year) minimum; HSTS preloading requires at least 1 year
  • Add includeSubDomains to protect all subdomains from downgrade attacks
  • Add preload only after testing — it is difficult to reverse and takes weeks to propagate
  • Never send the HSTS header over plain HTTP — only over HTTPS

Check

Check whether the server sends a Strict-Transport-Security header on all HTTPS responses, and verify the max-age, includeSubDomains, and preload directives are appropriate.

Fix

Add a Strict-Transport-Security header with max-age=31536000 and includeSubDomains to all HTTPS responses. Configure your web server or CDN to send this header, and validate it with curl or securityheaders.com.

Explain

Explain what HTTP Strict Transport Security (HSTS) is, how it prevents SSL stripping attacks, what the max-age and includeSubDomains directives do, and why the preload directive requires caution.

Code Review

Review server config, headers, forms, and integration points related to Set an HSTS 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/hsts

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

HSTS có tác dụng gì?

Nó bảo trình duyệt tự động dùng HTTPS cho trang web, nhờ đó chặn được các cuộc tấn công hạ cấp ngay cả ở yêu cầu HTTP thường đầu tiên.

includeSubDomains có tác dụng gì?

Nó áp dụng cùng mức bảo vệ này cho tất cả subdomain của trang web.

Vì sao cần cẩn thận với preload?

Skill nói preload khó hoàn tác và phải mất vài tuần mới có hiệu lực, vì vậy cần thử nghiệm trước.

Chi tiết

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

Use when reviewing HTTP response headers on any site that serves content over HTTPS.

repo: thedaviddias/Front-End-Checklist

Độ phổ biến

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