100% SSL 或选择性 SSL、JSONP ...并且没有错误?

发布于 2024-09-16 21:44:58 字数 1053 浏览 5 评论 0原文

我想邀请您经过深思熟虑的意见来帮助我在 Ajax 应用程序的以下两个来源策略之间做出决定:

  1. 从 HTTPS://www.mydomain.com 加载我的所有资产
  2. Plus: Ajax is easy. No problems with Same Origin Policy.
    Plus: PUT method offers large payloads.
    Plus: Network error messages can be fed back to the user.
    Minus: Server needs to sweat more to encrypt all that dross that makes up a web site. Browser needs to sweat more decrypting it all. Overall slower user experience.
  3. 通过 HTTP://www.mydomain.com 加载大部分糟粕,仅在敏感数据交换时使用 HTTPS://www.mydomain.com。
  4. Plus: Faster user experience as browser and, more importantly, my server do less cryptography. Plus: Ajax still easy via JSONP work-around to SOP (*).
    Minus: GET method on JSONP limits payload to 2K - may become an issue.
    BIG Minus: Cannot find any way to grab status response from header following network errors (of whatever kind). User information cannot extend beyond "My bad".

有什么想法吗?

(*) 顺便说一句,如果有人能给我一个由同一域上的协议切换带来的安全漏洞的示例,我将非常感激。我知道这些是不同的服务器,但那又​​怎样呢?它们在我的域内。我控制他们。我不明白这种担忧。

I would like to invite your considered opinion to help me decide between the following two origin policies for my Ajax app:

  1. Load all my assets from HTTPS: //www.mydomain.com
  2. Plus: Ajax is easy. No problems with Same Origin Policy.
    Plus: PUT method offers large payloads.
    Plus: Network error messages can be fed back to the user.
    Minus: Server needs to sweat more to encrypt all that dross that makes up a web site. Browser needs to sweat more decrypting it all. Overall slower user experience.

  3. Load most of the dross via HTTP: //www.mydomain.com and use HTTPS: //www.mydomain.com only for sensitive data exchanges.
  4. Plus: Faster user experience as browser and, more importantly, my server do less cryptography.
    Plus: Ajax still easy via JSONP work-around to SOP (*).
    Minus: GET method on JSONP limits payload to 2K - may become an issue.
    BIG Minus: Cannot find any way to grab status response from header following network errors (of whatever kind). User information cannot extend beyond "My bad".

Any thoughts?

(*) BTW, I would really appreciate if someone could give me an example of a security vulnerability brought on by a switch of protocol on the same domain. I understand that these are different servers, but so what? They are on my domain. I control them. I do not understand the concern.

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

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

发布评论

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

评论(2

嗼ふ静 2024-09-23 21:44:58

使用 SSL。您是否对 SSL 的性能损失进行了基准测试?一般来说,现代计算机速度很快,SSL 加密/解密开销可以忽略不计。有关该主题的一些讨论,请参阅 SSL 会产生多少开销?

在我的书中,不必使用 JSONP、能够使用 HTTP PUT 以及您概述的所有其他好处都比几个 cpu 周期更有价值。

Use SSL. Did you benchmark the performance loss for SSL? In general, modern computers are fast and SSL encryption/ decryption overhead is negligible. See How much overhead does SSL impose? for some discussion on the subject.

Not having to use JSONP, being able to use HTTP PUT, and all the other benefits you outlined are worth more than a few cpu cycles in my book.

情绪少女 2024-09-23 21:44:58

关于该漏洞,我已将示例放在 另一个答案

维护起来似乎不太可取
HTTP 和 HTTPS 之间的会话使用
相同的 cookie 或 URL 令牌。

想象一下您的用户的情况
使用给定的 cookie(或 URL
令牌)来回传递每个
电子商务中的请求/响应
网站。如果中间有人
能够读取该 cookie,然后他就可以
登录到 HTTP 或 HTTPS 变体
带有它的网站。即使无论什么
合法用户所做的事情就结束了
HTTPS,攻击者仍然能够
访问该会话(因为他也
将拥有合法的cookie)。他
可以看到诸如购物车、
付款方式,也许改变
送货地址。

通过某种形式是有意义的
HTTP 会话和之间的令牌
HTTPS 会话(如果您使用
会话),但将它们视为一个整体
同样会导致一些
脆弱性。打造一次性
查询参数中的标记只是
过渡可能是一个解决方案。你
但是应该将它们视为两个
单独的经过身份验证的会话。

此漏洞可能会发生
有时与使用混合的网站
HTTP 和 HTTPS 内容(某些
Firefox 等浏览器将为您提供
发生这种情况时会发出警告,尽管
大多数人倾向于禁用它
第一次出现)。你可以有
主要的 HTTPS 会话 cookie
页面,但该页面包含图像
对于公司徽标,通过普通 HTTP。
不幸的是,浏览器会发送
两者的cookie(所以攻击者
那么就可以得到cookie了)。我已经
看到它发生了,即使图像中
问题甚至不存在(
浏览器将发送请求
cookie 到服务器,即使它
返回 404 未找到)。

关于使用 SSL/TLS 的开销,Google 工程师撰写的这篇文章 应该引起人们的兴趣,更具体地说:

SSL/TLS 的计算成本不再昂贵。

Regarding the vulnerability, I've put examples in another answer:

It doesn't seem desirable to maintain
session between HTTP and HTTPS using
the same cookie or URL token.

Imagine the case where you're user is
logged on, with a given cookie (or URL
token) passed back and forth for every
request/response in an e-commerce
website. If someone in the middle is
able to read that cookie, he can then
log on to the HTTP or HTTPS variant of
the site with it. Even if whatever the
legitimate user is then doing is over
HTTPS, the attacker will still be able
to access that session (because he too
will have the legitimate cookie). He
could see pages like the cart, the
payment method, perhaps change the
delivery address.

It makes sense to pass some form of
token between the HTTP session and the
HTTPS session (if you're using
sessions), but treating them as one
and the same would cause some
vulnerability. Creating a one-off
token in the query parameter just the
transition could be a solution. You
should however treat them as two
separate authenticated sessions.

This vulnerability can happen
sometimes with websites that use mixed
HTTP and HTTPS content (certain
browsers such as Firefox will give you
a warning when that happens, although
most people tend to disable it the
first time it pops up). You could have
your HTTPS session cookie for the main
page, but that page contains images
for the company logo, over plain HTTP.
Unfortunately, the browser would send
the cookie for both (so the attacker
would be able the cookie then). I've
seen it happen, even if the image in
question wasn't even there (the
browser would send the request with
the cookie to the server, even if it
returned a 404 not found).

Regarding the overhead of using SSL/TLS, this article by Google engineers should be of interest, more specifically:

SSL/TLS is not computationally expensive any more.

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