您如何将安全规则应用于 Firepad?

How do you apply security rules to Firepad?

我想要一个 Firepad。经过研究,我在初始化 Firepad 时发现 https://github.com/firebase/firepad/tree/master/examples/security, which lists some rules in .json for securing a Firepad. I have looked extensively at the Firepad docs, but cannot figure out how to apply the example security rules

如何使用 JSON 中嵌入的示例安全规则(参见上文)初始化 Firepad?

编辑 01: 我可以看到 Firebase 允许您配置规则,我有兴趣了解如何应用这些规则。例如,如果我像这样初始化一个 Firepad:

var firepadRef = new Firebase('MYURL');
var codeMirror = CodeMirror(document.getElementById('firepad'), { lineWrapping: true });
var firepad = Firepad.fromCodeMirror(firepadRef, codeMirror,
    { richTextShortcuts: true, richTextToolbar: true, defaultText: 'Hello, World!' });   

如何将规则合并到 JSON 中?作为 Firepad.fromCodeMirror() 调用的选项?作为 new Firebase() 调用的某种参数?

如果您还没有,您可能想了解一下 Firebase, the backend for Firepad. As part of setting up Firepad, you'll create a Firebase account and a Firebase database. The Firebase database lets you configure Security Rules by entering them in the "Security & Rules" tab of your the dashboard (or uploading them via the REST API)。

明确地说,安全规则不是通过初始化 Firepad 的代码设置的,因为那是浏览器中的不受信任的代码运行,因此任何用户您的应用程序可以对其进行修改。