Google Native Client 如何被沙盒化?本机应用程序或本机客户端?

How Google Native Client is sandboxed? Native application or Native Client?

我是编写 Chrome 扩展和 NaCl 的初学者。我有一个用 C# 编写的应用程序的基本扩展。

使用 C# 应用程序(由我的 Chrome 扩展程序调用),我可以自由 read/write 文件 from/to 我的 Windows 文件系统。我还可以在客户端计算机上启动已安装的应用程序。当我可以访问整个文件系统时,这是如何沙盒化的?我的 C# 应用程序称为本机客户端吗? 不确定,也许我误解了沙盒。

还有一条评论:我可以从 here 中看到我的 C# 应用程序称为 "native application"。我猜我把它和 "Native Client" 混淆了。如果是这样,谁能解释一下这两者之间的区别。

感谢您的评论。

您混淆了 Native Client (which is a separate language / compiler with the result being executed sandboxed) with Native Messaging Host(明确地 沙盒化)。

扩展可以同时使用两者:它可以使用(但不捆绑)本地主机,并且可以 include NaCl/PNaCl modules


回答标题问题,通过限制语言中允许的内容并使用静态分析来确保代码安全,代码被沙盒化:

Since Native Client permits the execution of native code on client machines, special security measures have to be implemented:

  • The NaCl sandbox ensures that code accesses system resources only through safe, whitelisted APIs, and operates within its limits without attempting to interfere with other code running either within the browser or outside it.
  • The NaCl validator statically analyzes code before running it to make sure it only uses code and data patterns that are permitted and safe.

These security measures are in addition to the existing sandbox in the Chrome browser. The Native Client module always executes in a process with restricted permissions. The only interaction between this process and the outside world is through defined browser interfaces. Because of the combination of the NaCl sandbox and the Chrome sandbox, we say that Native Client employs a double sandbox design.

您将无法直接访问文件系统,例如,因为标准文件 I/O 不可用;相反,沙箱提供了一个受限版本。


"Native"这里只是一个有歧义的名词,就像“应用”一样(比较:ChromeApp也是一个东西)

本机消息传递 = 使用“本机”(即在浏览器之外)应用程序进行消息传递。

Native Client 是要执行的技术的专有名称"native code"(与浏览器解释 的脚本相对)。

Native Messaging 与 NaCl 平台明确无关。