【问题标题】:firefox in centos set csp header not effectivecentos中的firefox设置csp标头无效
【发布时间】:2020-03-10 12:19:18
【问题描述】:

我尝试为firefox通过代理访问的每个请求的响应加入csp标头,但没有发送csp报告,并尝试在mac firefox中做同样的事情(相同的代码),程序运行没有问题,我recv csp报告,所以我认为这可能是centos中firefox的问题

这是我的环境,yum安装firefox,代码使用selenium操作firefox并使用browsermob添加csp header作为响应,代码结果csp header已经添加在response中,firefox处于无头模式。

centos 7
firefox.x86_64                            68.5.0-2.el7.centos     @update
firefox.i686                              68.5.0-2.el7.centos     update
firefox-noscript.noarch                   11.0.3-3.el7            epel
firefox-pkcs11-loader.x86_64              3.13.4-1.el7            epel

这是我的 csp 规则

Content-Security-Policy-Report-Only: script-src 'none'; style-src 'none'; img-src 'none'; font-src 'none'; connect-src 'none'; media-src 'none'; object-src 'none'; child-src 'none'; frame-src 'none'; worker-src 'none'; worker-src 'none'; worker-src 'none'; base-uri 'none'; manifest-src 'none'; report-uri http://www.test.com

我使用它来接收 csp 报告并使用此报告为 web 创建 csp 规则

有什么办法可以解决这个问题

【问题讨论】:

    标签: selenium selenium-webdriver firefox content-security-policy selenium-firefoxdriver


    【解决方案1】:

    更新firefox版本,测试v74.0运行良好

    yum 版本变旧,在 centos 7 中安装

    cd /usr/local
    wget https://ftp.mozilla.org/pub/firefox/releases/74.0/linux-x86_64/zh-CN/firefox-74.0.tar.bz2
    tar xvjf firefox-74.0.tar.bz2
    yum -y install gtk3-devel
    yum install libXt*
    ln -s /usr/local/firefox/firefox /usr/bin/firefox
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-05-28
      • 1970-01-01
      • 2019-02-27
      相关资源
      最近更新 更多