内容安全策略:脚本加载失败

问题描述

我正在编写一个 Thunderbird 扩展程序来将电子邮件添加到 Rackspace 电子邮件帐户垃圾邮件阻止列表中。

Rackspace 提供了用于将电子邮件添加到帐户阻止列表的 API。

我的 Ajax GET 请求是:

    $.ajax({
    beforeSend: function(request)
        {
            console.log("beforeSend");
            request.setRequestHeader("X-Api-Signature",Signature);
            request.setRequestHeader("Accept","text");
            request.setRequestHeader("withCredentials",true);
            request.setRequestHeader('crossOrigin','anonymous'),console.log("beforeSend Request %o: ",request);
            return true;
        },contentType: 'application/x-www-form-urlencoded',crossDomain: true,dataType: 'jsonp',method: 'GET',type: 'GET',url: Api_Obj.Url,

当我使用 url 提交 Ajax GET 请求时:

https://api.emailsrvr.com/v1/customers/123456/domains/sandypondconsulting.com/spam/blocklist/EglogicsSoftech@outlook.com

(出于安全目的,帐号 123456 是实际帐号的占位符)

我明白了:

源为“https://api.emailsrvr.com/v1/customers/123456/domains/sandypondconsulting.com/spam/blocklist/EglogicsSoftech@outlook.com?callback=jQuery36003174572175672028_1265052028_126505250505056”的加载失败/p>

我已经设置了清单:

"content_security_policy" : "script-src 'self' https://api.emailsrvr.com; object-src 'self'",

Ajax 错误函数参数具有以下值:

msg:错误
错误错误

当我点击加载失败错误中的网址时,我得到:

<unauthorizedFault xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://api.emailsrvr.com/v0/Schemas" code="403">
<message>Authentication Failed.</message>
<details>6/30/2021 1:34:21 PM</details>
</unauthorizedFault>

未经授权的错误告诉我,我可能错误生成了 Rackspace API 所需的 X-Api-Signature。

所以,看起来我有两个问题:

  1. 脚本加载失败。
    2) UnauthorizedFault

我想先解决脚本加载问题。然后,找出 UnauthorizedFault 2nd。

谢谢,埃德

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)