Security CSP url方案http://matches if resource';s方案为http://或https://

Security CSP url方案http://matches if resource';s方案为http://或https://,security,iframe,specifications,content-security-policy,Security,Iframe,Specifications,Content Security Policy,让我们看一下框架。假设我想允许http://*.parent.com在https://child.com和http://child.com: frame-ancestors http://*.parent.com 如果我设置https://*.parent.com我们有一个明显的违规行为 如果我设置frame祖先*.parent.com,则https://child.com 如果我设置了框架祖先http://*.parent.com,它对这两种情况都有效。为什么? 引述: 如果源表达式的方案部

让我们看一下框架。假设我想允许
http://*.parent.com
https://child.com
http://child.com

frame-ancestors http://*.parent.com
  • 如果我设置https://*.parent.com我们有一个明显的违规行为
  • 如果我设置
    frame祖先*.parent.com
    ,则
    https://child.com
  • 如果我设置了
    框架祖先http://*.parent.com
    ,它对这两种情况都有效。为什么?
  • 引述:

  • 如果源表达式的方案部分与url方案不区分大小写,则返回不匹配
  • 如果源表达式没有方案,则如果满足以下任一条件,则返回值不匹配:
  • 受保护资源的URL的方案对于HTTP是不区分大小写的匹配,而URL方案对于HTTP或HTTPS都不是不区分大小写的匹配
  • 受保护资源URL的方案与HTTP不区分大小写,URL方案与受保护资源URL的方案不区分大小写
  • 我的示例案例2必须根据规范的条件5.2阻塞,因为
    https://child.com据我所知,
    与HTTP不匹配。

    但是为什么案例3适用于
    https://child.com
    ?根据条件4,它应该失败,因为
    http://*.parent.com
    https://child.com
    。我缺少什么?

    目标

    允许
    http://*.parent.com
    在两个
    https://child.com
    http://child.com

    案例3

    child.com上的CSP策略

    frame-ancestors http://*.parent.com
    
    但为什么案例3适用于其他公司

    如果您浏览到,例如
    http://1.parent.com
    ,其中包含一些
    child.com
    内容,例如:

    <iframe src="https://child.com/mycontent">