Ngăn ngừa XSS và XSRF
Để chống lại tập lệnh trên nhiều trang web (XSS), hãy yêu cầu tiêu đề HTTP X-Content-Type-Options: nosniff
cho tất cả các phản hồi. Ngoài ra, hãy thêm Content-Type: application/json; charset=utf-8
vào tiêu đề phản hồi.
Để chống giả mạo yêu cầu trên nhiều trang web (XSRF), hãy yêu cầu tiêu đề HTTP X-XSRF-Protected: 1
cho tất cả các yêu cầu.
Trừ phi có lưu ý khác, nội dung của trang này được cấp phép theo Giấy phép ghi nhận tác giả 4.0 của Creative Commons và các mẫu mã lập trình được cấp phép theo Giấy phép Apache 2.0. Để biết thông tin chi tiết, vui lòng tham khảo Chính sách trang web của Google Developers. Java là nhãn hiệu đã đăng ký của Oracle và/hoặc các đơn vị liên kết với Oracle.
Cập nhật lần gần đây nhất: 2022-09-26 UTC.
[null,null,["Cập nhật lần gần đây nhất: 2022-09-26 UTC."],[[["All responses must include the `X-Content-Type-Options: nosniff` and `Content-Type: application/json; charset=utf-8` headers to mitigate cross-site scripting (XSS) vulnerabilities."],["All requests must include the `X-XSRF-Protected: 1` header to defend against cross-site request forgery (XSRF) attacks."]]],["Responses should include `X-Content-Type-Options: nosniff` and `Content-Type: application/json; charset=utf-8` headers to prevent cross-site scripting (XSS). To prevent cross-site request forgery (XSRF), all requests must include the `X-XSRF-Protected: 1` header. These actions enhance security by ensuring content types are strictly interpreted and verifying the origin of requests, thus mitigating common web vulnerabilities.\n"]]