Ubiquityのセキュリティ的問題点

最近の事情は全く調べてないので、既出かもしれないが、Ubiquityは仕様上もの凄く怖い点がある。
それは、コマンドがChrome特権下で動作するということだ。
Chrome特権下で動くと言う事はXPCOMが使えると言う事。何でも出来るということになる。

実際に作ってみた。

テンプレートからexecuteの部分だけ書き換えたもの

/* This is a template command */
CmdUtils.CreateCommand({
  name: "example",
  icon: "http://example.com/example.png",
  homepage: "http://example.com/",
  author: { name: "Your Name", email: "you@example.com"},
  license: "GPL",
  description: "A short description of your command",
  help: "how to use your command",
  takes: {"input": noun_arb_text},
  preview: function( pblock, input ) {
    var template = "Hello ${name}";
    pblock.innerHTML = CmdUtils.renderTemplate(template, {"name": "World!"});
  },
  execute: function(input) {
    var Cc = Components.classes;
    var Ci = Components.interfaces;
    var file = Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsILocalFile);
    file.initWithPath("/usr/bin/gnome-terminal");
    var process = Cc["@mozilla.org/process/util;1"].createInstance(Ci.nsIProcess);
    process.init(file);
    process.run(false, null, 0);
  }
});

gnome-terminal*1が起動する。適切に使えばコマンドランチャーとなるが....。
やろうと思えば、rm -rf /*だって出来る。Windowsではformat C:だって出来るでだろう。

さらに、Ubiquityはネットワークからコマンドのインポートができたり、Webページに

<link rel="commands" href="コマンドファイルパス" name="hoge"/>

とあるとコマンドのインストールが出来たりする。

正直怖すぎ。
公的なコマンドはまだ審査された上で上がると信じているのでまだ良いが、スクリプトの中身を読んできちんと理解した人以外にはサードパーティ製コマンドのインストールはお勧めしない。絶対にインストールしてはいけないくらいに言っても良いレベル。

最後に。

Chrome特権下で動くjavascriptを定義できるのはUbiquityに限らず、userChrome.jsやVimperatorのプラグイン等がある。userChrome.jsやVimperatorはそもそもがギークの代物でJavaScriptを理解している人が使っている...と思っているのだが、Ubiquityに関しては例の動画に感動して入れている素人の比率が高いと思う。
Ubiquityの理念、理想は凄く面白いと思う。だが、このセキュリティ的なところが解消されない限り一般には勧められない。今のところサンドボックス上なので良いがレビューアがこの点に気付かず、一般公開されないかヒヤヒヤしているのが今のオイラの現状である。

追記

記事見つけた。
サードパーティ製のコマンドを入れようとすると

Ubiquity Command from Untrusted Source

You are about to subscribe to a Ubiquity command from an unknown, untrusted third-party source at . If you subscribe, this command could do anything it wants to your browser. It could steal your credit card number or e-mail your grandmother your entire image browsing history.

Here is the JavaScript source code to the command:

If you understand JavaScript, you should read this and use your best judgement to decide whether the command is something that's safe to execute or not. Proceed at your own risk!

If you don't understand JavaScript, you should not subscribe to the command unless the link was given to you by someone you know and trust.

In the future, we plan to have a widget here displaying what we call a "social trust network". You'll be able to see whether any of your friends have tried out this command. They can either vouch for the command's safety or leave a warning about the command's dangers. We hope this will help people make informed decisions about whether to subscribe to commands or not. This feature should be coming in Ubiquity 0.2.

という警告を出す様だ。今まで入れようとしたことがなかったので知らなかった。
不審なソースを入れようとしているよ。Ubiquityのコマンドはブラウザ上で何でも出来ちゃうよ。クレジットカードの番号やメールアドレス、祖母やあなたの全身が写った画像、ブラウザの履歴を盗んだり出来ちゃうよ。
ってな感じの警告だ。
ということで、d:id:teramako:20081126:p2 の懸念は的外れだったようだけど。本当にこれで良いのかな。何か不安だ。
こんな警告を出すくらいなら最初から出来ないようにした方が良いんじゃないか、と思うんだが....悩ましいな。

*1:GNU/LinuxGnomeのTerminal. Windowsで言うところのcmd.exeみたいなもの