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

x-content-type

Skill này làm gì

Skill này kiểm tra máy chủ web có gửi header bảo mật nosniff hay không. Nó dành cho lập trình viên và nhân viên IT tăng cường bảo mật website trước các tấn công phổ biến.

Khi nào nên dùng

  • ✓Khi phản hồi của máy chủ không có header X-Content-Type-Options.
  • ✓Khi một danh sách kiểm tra bảo mật yêu cầu tăng cường header.
  • ✓Khi các file được tải lên rồi phục vụ lại cho người xem.

Liên kết skill

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

“Quét bảo mật của chúng tôi báo thiếu header X-Content-Type-Options. Bạn có thể thêm nó không?”

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

Cách hoạt động

Agent thêm header vào cấu hình máy chủ hoặc framework cho mọi phản hồi. Sau đó nó kiểm tra header phản hồi để xác nhận header đã có mặt.

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 X-Content-Type-Options: nosniff

Browsers that MIME-sniff can be tricked into executing malicious JavaScript uploaded as an image — even if the server sends Content-Type: image/png. nosniff forces the browser to honor the declared type.

Quick Reference

  • Set X-Content-Type-Options: nosniff on all responses — the only valid value is nosniff
  • Without this header, browsers may execute a JavaScript file disguised as an image if the server serves it with the wrong MIME type
  • This header is required by OWASP's security hardening checklist and the Fetch specification
  • Pair with correct Content-Type headers on all responses for defense in depth
  • Takes 5 minutes to configure and has no compatibility issues

Check

Check whether the server sends an X-Content-Type-Options: nosniff header on responses. Verify the header is present on HTML pages, scripts, stylesheets, and API responses.

Fix

Add X-Content-Type-Options: nosniff to all HTTP responses. Configure it at the web server level (Nginx, Apache) or in your application framework, and verify with curl -I https://example.com.

Explain

Explain what MIME type sniffing is, how it can be exploited to execute malicious files, and how X-Content-Type-Options: nosniff prevents this attack.

Code Review

Review server config, headers, forms, and integration points related to Set X-Content-Type-Options: nosniff. 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-content-type

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

nosniff làm gì?

Nó bảo trình duyệt tin vào loại file được khai báo, thay vì tự đoán và có thể chạy một file độc hại.

Có vấn đề tương thích nào không?

Skill cho biết header này không có vấn đề tương thích đã biết và chỉ mất vài phút để thiết lập.

Làm sao kiểm tra nó hoạt động?

Skill gợi ý kiểm tra header phản hồi bằng một yêu cầu curl.

Chi tiết

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

Use when auditing HTTP response headers on any web server or CDN for security hardening.

repo: thedaviddias/Front-End-Checklist

Độ phổ biến

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