简体   繁体   English

使用CSP(内容安全策略)和自定义协议

[英]Using CSP (Content Security Policy) with a custom protocol

I'm in a bit of a pinch, developing a fund broker site. 我有点紧张,正在开发一个基金经纪人网站。

As part of our security policies, CSP is implemented across our servers, but now, we're implementing communication with desktop software supplied by Scandinavian banks ( BankID ). 作为我们安全策略的一部分, CSP在我们的服务器上实现,但现在,我们正在实施与斯堪的纳维亚银行( BankID )提供的桌面软件的通信。

With this, a problem arises: to open the BankID desktop software, a link should be clicked with a custom protocol, looking like this: 有了这个,出现了一个问题:要打开BankID桌面软件,应该使用自定义协议单击一个链接,如下所示:

bankid://?orderref=[GUID]&autostarttoken=[GUID]

As I'm sure you understand, I'm having serious problems allowing this link through our CSP policies. 我确信您理解,我遇到严重问题,允许通过我们的CSP政策进行此链接。 My searches have yielded no results, and I have run out of ideas. 我的搜索结果没有结果,我的想法已经用完了。

I have tried attempting to allow a wildcard domain under the protocol thus: 我试图在协议下尝试允许通配符域:

Content-Security-Policy: default-src 'self' bankid://*;

It works perfectly if I turn off CSP, so it's definitely the issue. 如果我关闭CSP,它的效果非常好,所以这绝对是个问题。

Anyone have any experience with this? 有人对此有经验吗? Any help is greatly appreciated. 任何帮助是极大的赞赏。


EDIT 编辑

After a few more hours searching, I found the following on the Mozilla Wiki : 经过几个小时的搜索,我在Mozilla Wiki上找到了以下内容:

We need an application delivery mechanism that provides assurances on app integrity and authenticity, and also allows for well-defined application & privilege scope enforcement so integrity can be maintained at runtime. 我们需要一种应用程序交付机制,它可以保证应用程序的完整性和真实性,还可以实现定义明确的应用程序和权限范围,从而可以在运行时维护完整性。

And further: 并进一步:

Privileged and certified apps will be accessed via a unique scheme (app://). 特权和认证的应用程序将通过一个独特的方案(app://)访问。 The domain will correspond to the app id. 域名将对应于应用ID。

I'm not sure if this would be applicable, but if I read this right, it means that Mozilla are considering how to tackle this very issue. 我不确定这是否适用,但如果我认为这是正确的,那就意味着Mozilla正在考虑如何解决这个问题。

It seems that you were very close to the solution, you only have to alter the syntax a little bit. 看起来你非常接近解决方案,你只需稍微改变一下语法。 By removing the slashes it should work just fine. 通过删除斜杠它应该工作得很好。

Content-Security-Policy: default-src 'self' bankid:;

To summarize: 总结一下:

  • Quotes ("'): NO 行情(“'):没有
  • Slashes (//): NO 斜杠(//):没有
  • Colon (:): YES 冒号(:):是的

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM