silverlight 跨域策略背后的基本原理是什么?

发布于 2024-10-26 05:09:38 字数 644 浏览 3 评论 0原文

我在尝试调用远程休息 Web 服务时遇到问题 https://stackoverflow.com/questions/5442175/error-on-httpwebrequest

这似乎是由于远程服务器上缺少跨域策略文件 http://forums.silverlight.net/forums/p/183993/419448。 aspx

我不明白有这个文件的原因。它根本不能保护用户,那么他们创建此限制的目的是什么?

更新:阅读 MS 的解释后,我仍然无法看到此策略如何让用户更加了解,因为这一切都是在服务器端完成的,而没有通知用户任何事情。

更新:似乎人们不同意,所以毕竟我的问题并不那么愚蠢:)答案是保护服务而不是用户?例如,为什么 Twitter 会在不想要的情况下保护其服务呢?如果一个网站想要保护自己,那么它只需输入一些登录名/密码:) 很明显,一个网站希望从浏览器获得最大的访问权限,浏览器是否使用插件并不重要,为什么该网站会关心呢?

I got a problem when trying to call a remote rest webservice
https://stackoverflow.com/questions/5442175/error-on-httpwebrequest

It seems it's due to cross domain policy file missing on the remote server
http://forums.silverlight.net/forums/p/183993/419448.aspx

I don't understand the reason to have this file. It doesn't protect the user at all so for what purpose did they create this restriction ?

UPDATE: Reading the explanation from MS I still fail to see how this policy allows user to be more aware since it's all done on servers side WITHOUT EVER NOTIFYING THE USER OF ANYTHING.

UPDATE: Seems people don't agree so after all my question is not so stupid :) Answer would be Secure the service not the User ? Why on earth would twitter for example would like to protect its service without even wanting it ? If a website would want to protect itself it would just well put some login / password :) It is obvious that a site wants greatest access from browser it doesn't matter if browser uses plugin or not why would the site care ?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

人生戏 2024-11-02 05:09:38

这是为了安全并让您实际上选择允许它。

MSDN 解释得最好,所以有我重新措辞没有意义:

使用 Silverlight 版本 4
跨域通信需要
防范多种类型
可能存在的安全漏洞
用于利用 Web 应用程序。
跨站伪造是一类
当漏洞利用时成为威胁
允许跨域调用。这
漏洞利用涉及恶意
Silverlight控制发射
向第三方发出未经授权的命令
在用户不知情的情况下提供服务。
为了防止跨站请求伪造,
Silverlight 仅允许源站点
默认情况下所有通信
图像和媒体以外的请求。
例如,Silverlight 控件
主办于
http://contoso.com/mycontrol.aspx 可以
仅访问同一个上的服务
默认域 - 例如
http://contoso.com/service.svc,但是
不提供服务
http://fabrikam.com/service.svc。这
防止恶意 Silverlight
控制托管在
来自调用的 http://contoso.com
对服务进行未经授权的操作
托管在 http://fabrikam.com
领域。

启用 Silverlight 控件
访问另一个域中的服务,
该服务必须明确选择加入
允许跨域访问。经过
选择加入,一项服务指出
它公开的操作可以安全地
由 Silverlight 控件调用,
没有潜在的损害
对数据的影响
服务店。

It's for security and making you actually OPT IN to allowing it.

MSDN explains it the best so there is no point in me re-wording it:

Using Silverlight version 4 for
cross-domain communication requires
guarding against several types of
security vulnerability that can be
used to exploit Web applications.
Cross-site forgery is a class of
exploits that becomes a threat when
allowing cross-domain calls. This
exploit involves a malicious
Silverlight control transmitting
unauthorized commands to a third-party
service, without the user's knowledge.
To prevent cross-site request forgery,
Silverlight allows only site-of-origin
communication by default for all
requests other than images and media.
For example, a Silverlight control
hosted at
http://contoso.com/mycontrol.aspx can
access only services on that same
domain by default – for example
http://contoso.com/service.svc, but
not a service at
http://fabrikam.com/service.svc. This
prevents a malicious Silverlight
control hosted on the
http://contoso.com domain from calling
unauthorized operations on a service
hosted on the http://fabrikam.com
domain.

To enable a Silverlight control to
access a service in another domain,
the service must explicitly opt-in to
allow cross-domain access. By
opting-in, a service states that the
operations it exposes can safely be
invoked by a Silverlight control,
without potentially damaging
consequences to the data that the
service stores.

许你一世情深 2024-11-02 05:09:38

这里有一些需要考虑的事情。假设 Silverlight 不需要 Web 服务来选择由 Silverlight 客户端或 Flash 客户端使用。

一些恶意者设法找到流行 Web 服务 API 中的弱点,并在 Silverlight 或 Flash 中编写漏洞利用程序。伤害已经造成,该网络服务的用户感到不安。责任的手指可能指向哪里?当有消息称 Silverlight 或 Flash 插件是某些违规行为的“原因”时,会发生什么?损害了谁的名誉?答:微软/Adobe虽然事实上与他们没有任何关系。

归根结底,这是关于公共关系,关于存在感知不安全感的风险,但实际上没有任何理由。

通过包含此选择加入要求,这些公司大大减少了可能使用其插件利用的服务数量。大大降低了他们的插件因不必要的声誉而受到不公平玷污的风险。对于那些选择加入的人,策略文件可以被视为服务提供商的责任,他们做出了明智的选择以包含此类文件。

最终,如果要做出选择,要么冒着公众认知的风险,面对 100,000,000 名潜在用户,要么冒着让大约 100,000 名潜在开发者感到不满和困惑的风险,我知道我会选择哪一个。

Here is something to consider. Assume a world where Silverlight did not require a web service to opt into being used by a Silverlight client or a indeed a Flash client come to that.

Some malcontent manages to find a weakness in a popular web service API and writes an exploit in Silverlight or Flash. Harm is done and users of this web service are upset. Where might the finger of responsibility get pointed? What happens when it gets into the news that a Silverlight or Flash plugin was the "cause" of some breach? Whose reputation is harmed? Answer: Microsoft / Adobe even though in fact it has nothing to do with them.

Ultimately this is about public relations, about the risk of there being a perceived insecurity where none is really warranted.

By including this opt-in requirement these companies massively reduce the number of services that could possibly be exploited using their plugins. Significantly reducing the risk that their plugin would unfairly be tarnished with an uncalled for reputation. For those that do opt-in the policy files can be pointed at as the responsibility of the service provider who made an informed choice to include such a file.

Ultimately if there is a choice between risking your public perception with 100,000,000 potential users or risk some disgruntlement and bewilderment of some 100,000 potential developers I know which one I would pick.

岁月如刀 2024-11-02 05:09:38

想象一下,您的网站上有一个 Web 服务,它显示实时股票,并且您希望该网站仅由您的 silverlight 客户端使用。

现在我可以编写一个 silverlight 客户端并将其放在我的网站上,该客户端将从您的网站获取数据,我可以窃取您的数据,用户会觉得这是我的数据。因为无法确定是谁在连接它。

因此,除非您从您的域允许,否则从我的域加载的 silverlight 将无法连接。这不是为了服务器客户端安全,而是为了跨域安全。与 JavaScript 跨域安全性相同,您无法访问从不同域加载的任何对象。

Imagine you have a webservice, which is on your website, it displays live stocks and you want this website to be used by only your silverlight client.

Now I can write a silverlight client and put it on my website that will fetch data from your website, I can steal your data and users will feel it's my data. As there is no way o determine who is connecting it.

So silverlight loaded from my domain will not connect unless you allow from your domain. This is not for server client security but this is for cross domain security. Same as JavaScript cross domain security that you can not access any objects loaded from different domain.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文