Permissions scripting
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 初心者へのやさしさ
- 35/100
- issue の種類
- 機能追加
- 明瞭さ
- おおむね明確
- 活発さ
- 活発
- 技術スタック
- javascript, node.js
- 領域
- security
調査の方向性
The issue does not name implementation files or tests. Start by reading Node.js's existing permission model and tracing how permission checks handle filesystem, child-process, and network access. The proposal needs design decisions about the script API, how it interacts with existing flags, and how checks are enforced; done means those behaviors are specified and covered by tests.
索引モデルが issue の本文から書いたものです。
説明
What is the problem this feature will solve?
Right now, permissions are either all-or-nothing, or each path must be manually specified.
There is also a lack of scoping on most permission flags. While adding scoping to these flags would help significantly, it would be helpful to be able to write custom logic to scope them in a more fine-grained fashion.
This feature request is primarily motivated by the lack of scoping on child. Initially I had drafted a feature request to add simple allow-listed scoping for child, but if, for instance, the python executable were to be allow-listed, a malicious script could run:
function portable_rm(file) {
if (process.permission.has('fs.write', file) {
// unlink file using node apis
} else if (process.permission.has('child', 'rm') {
// exec rm file
} else if (process.permission.has('child', 'python') {
// exec python -c 'import shutil; shutil.rmtree(...)'
} // etc.
}
By using regex (or other custom logic), we can prevent these types of attacks by further limiting the command lines to known arguments.
What is the feature you are proposing to solve the problem?
A script that allows for custom scoping on all permission grants:
import path from 'node:path';
// Helper: path_str would already be an absolute path
function _check_path(path_str, allow_list) {
for (const allowed_path of allow_list) {
if (path.matchesGlob(path_str, path.resolve(allowed_path)))
return true;
}
return false;
}
function check_fs_read(path_str) {
return _check_path(path_str, [
'/foo/*',
'./bar/baz.txt'
]);
}
function check_fs_write(path_str) {
return _check_path(path_str, [
'./bar/baz.txt'
]);
}
function check_child(exec, args) {
if (exec === "python") {
if (args.length !== 2) return false;
return args[0] === "myproc.py";
} else if (exec === "esbuild") {
if (args.length < 1) return false;
return /^--(bundle|minify)$/.test(args[0]);
}
return false;
}
function check_net(addr) {
return /^https:\/\/([^/]*\.)?mycompany\.com\//.test(addr);
}
export default {
fs_read: check_fs_read,
fs_write: check_fs_write,
child: check_child,
net: check_net,
// any permission missing here would be denied by default, unless a respective --allow-* flag exists
}
It could then be run with (e.g.) node --permission --permissions-script=./permissions.js ...
The scoping does not necessarily have to be perfect, as just needs to match what the project knows it requires.
There would naturally be a minor performance hit, but this would allow for powerful scoping that would allow for projects to have permissions exactly as fine-grained as they needed.
On our end, the added security benefit far outweighs the performance hit, as it allows for better security during development. For deployment, we can replace the permission model with containers to remove the performance impact.
What alternatives have you considered?
-
Using a socket-based permission broker: https://docs.deno.com/runtime/fundamentals/security/#permission-broker
-
Adding regex-based allow-listing for
childandnet.
- 主要言語
- JavaScript
- スター
- 123k
- フォーク
- 39.3k
- 平均マージ
- 4日 15時間
- マージ済み PR(30日)
- 238
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
nodejs/node のほかの issue
-
http2: content-encoding is incorrectly listed in kSingleValueHeaders対応中かも @inoway46 が 2 日前に担当しました。 オープンconfirmed-bug http2
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
nodejs/node#67151 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
util.parseEnv and --env-file keep a leading UTF-8 BOM in the first key対応中かも @helmipradita が 4 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
node:internal/inspector/network_http: `TypeError: Missing dataLength` in event when response uses `setEncoding()`再び着手できるかも このイシューのプルリクエストはマージされずにクローズされました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
nodejs/node#66551 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
[Docs] `process.loadEnvFile()` does not document behaviour when variables already exist対応中かも @Sepandard が 38 日前に担当しました。 オープンdoc
難易度 1/5 1時間未満 初心者へのやさしさ 90/100
メンテナーはふだん 1 日以内に返信
-
Stream.prototype.forEach will block in first promise in queue before read more chunk対応中かも @mmustafasenoglu が 39 日前に担当しました。 オープンdoc
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
メンテナーはふだん 1 日以内に返信
似ている issue
-
難易度 1/5 1時間未満 初心者へのやさしさ 78/100
521xueweihan/HelloGitHub#4237 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
メンテナーはふだん 2 日以内に返信
-
bug confirmed js v6
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信
-
area/frontend area/v2 kind/bug
難易度 1/5 1時間未満 初心者へのやさしさ 90/100
メンテナーはふだん 1 日以内に返信