1. <i id='siJfL'><tr id='siJfL'><dt id='siJfL'><q id='siJfL'><span id='siJfL'><b id='siJfL'><form id='siJfL'><ins id='siJfL'></ins><ul id='siJfL'></ul><sub id='siJfL'></sub></form><legend id='siJfL'></legend><bdo id='siJfL'><pre id='siJfL'><center id='siJfL'></center></pre></bdo></b><th id='siJfL'></th></span></q></dt></tr></i><div id='siJfL'><tfoot id='siJfL'></tfoot><dl id='siJfL'><fieldset id='siJfL'></fieldset></dl></div>

    <tfoot id='siJfL'></tfoot>
      <bdo id='siJfL'></bdo><ul id='siJfL'></ul>

    <small id='siJfL'></small><noframes id='siJfL'>

      <legend id='siJfL'><style id='siJfL'><dir id='siJfL'><q id='siJfL'></q></dir></style></legend>

      如何阻止恶意代码欺骗“Origin"?标头利用COR

      时间:2023-09-03

        <tfoot id='qqiS3'></tfoot>

            <tbody id='qqiS3'></tbody>

          <small id='qqiS3'></small><noframes id='qqiS3'>

        1. <legend id='qqiS3'><style id='qqiS3'><dir id='qqiS3'><q id='qqiS3'></q></dir></style></legend>
        2. <i id='qqiS3'><tr id='qqiS3'><dt id='qqiS3'><q id='qqiS3'><span id='qqiS3'><b id='qqiS3'><form id='qqiS3'><ins id='qqiS3'></ins><ul id='qqiS3'></ul><sub id='qqiS3'></sub></form><legend id='qqiS3'></legend><bdo id='qqiS3'><pre id='qqiS3'><center id='qqiS3'></center></pre></bdo></b><th id='qqiS3'></th></span></q></dt></tr></i><div id='qqiS3'><tfoot id='qqiS3'></tfoot><dl id='qqiS3'><fieldset id='qqiS3'></fieldset></dl></div>

              • <bdo id='qqiS3'></bdo><ul id='qqiS3'></ul>

                本文介绍了如何阻止恶意代码欺骗“Origin"?标头利用CORS?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                问题描述

                按照我的理解,如果在 foo.com 的页面上运行的客户端脚本想要从 bar.com 请求数据,则在请求中它必须指定标头 Origin: http://foo.com,并且 bar 必须以 Access-Control-Allow-Origin: http://foo.com 响应.

                The way I understand it, if a client-side script running on a page from foo.com wants to request data from bar.com, in the request it must specify the header Origin: http://foo.com, and bar must respond with Access-Control-Allow-Origin: http://foo.com.

                有什么方法可以阻止来自站点 roh.com 的恶意代码简单地欺骗标头 Origin: http://foo.com 来请求来自 bar 的页面?

                What is there to stop malicious code from the site roh.com from simply spoofing the header Origin: http://foo.com to request pages from bar?

                推荐答案

                浏览器可以控制设置 Origin 标头,用户无法覆盖此值.因此,您不会看到浏览器欺骗的 Origin 标头.恶意用户可以制作手动设置 Origin 标头的 curl 请求,但此请求可能来自浏览器外部,并且可能没有特定于浏览器的信息(例如 cookie).

                Browsers are in control of setting the Origin header, and users can't override this value. So you won't see the Origin header spoofed from a browser. A malicious user could craft a curl request that manually sets the Origin header, but this request would come from outside a browser, and may not have browser-specific info (such as cookies).

                请记住:CORS 不是安全性.不要依赖 CORS 来保护您的网站.如果您提供受保护的数据,请使用 cookie 或 OAuth 令牌或 Origin 标头以外的其他内容来保护该数据.CORS 中的 Access-Control-Allow-Origin 标头仅指示应允许哪些来源发出跨域请求.不要再依赖它了.

                Remember: CORS is not security. Do not rely on CORS to secure your site. If you are serving protected data, use cookies or OAuth tokens or something other than the Origin header to secure that data. The Access-Control-Allow-Origin header in CORS only dictates which origins should be allowed to make cross-origin requests. Don't rely on it for anything more.

                这篇关于如何阻止恶意代码欺骗“Origin"?标头利用CORS?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                上一篇:Uncaught (in promise) TypeError: Failed to fetch and Cors err 下一篇:如何在任何地方使用 Cors 反向代理和添加 CORS 标

                相关文章

                最新文章

                  <bdo id='lAtZK'></bdo><ul id='lAtZK'></ul>

                1. <tfoot id='lAtZK'></tfoot>
                  <i id='lAtZK'><tr id='lAtZK'><dt id='lAtZK'><q id='lAtZK'><span id='lAtZK'><b id='lAtZK'><form id='lAtZK'><ins id='lAtZK'></ins><ul id='lAtZK'></ul><sub id='lAtZK'></sub></form><legend id='lAtZK'></legend><bdo id='lAtZK'><pre id='lAtZK'><center id='lAtZK'></center></pre></bdo></b><th id='lAtZK'></th></span></q></dt></tr></i><div id='lAtZK'><tfoot id='lAtZK'></tfoot><dl id='lAtZK'><fieldset id='lAtZK'></fieldset></dl></div>
                  <legend id='lAtZK'><style id='lAtZK'><dir id='lAtZK'><q id='lAtZK'></q></dir></style></legend>

                    <small id='lAtZK'></small><noframes id='lAtZK'>