From 070d3e037517f30014c82bb28c5202bb19b86136 Mon Sep 17 00:00:00 2001 From: Yuki Ota Date: Thu, 17 Dec 2020 20:13:38 +0900 Subject: [PATCH] translate 6.19 into japanese --- README.japanese.md | 8 +++--- sections/security/childprocesses.japanese.md | 28 +++++++++----------- 2 files changed, 17 insertions(+), 19 deletions(-) diff --git a/README.japanese.md b/README.japanese.md index 48195d36..1dffb136 100644 --- a/README.japanese.md +++ b/README.japanese.md @@ -966,15 +966,15 @@ null == undefined; // true

-## ![✔] 6.19. Take extra care when working with child processes +## ![✔] 6.19. 子プロセスで処理を行う場合は特別な注意を払う -**TL;DR:** Avoid using child processes when possible and validate and sanitize input to mitigate shell injection attacks if you still have to. Prefer using `child_process.execFile` which by definition will only execute a single command with a set of attributes and will not allow shell parameter expansion. +**TL;DR:** 可能なら子プロセスの仕様を避け、それでも使用する必要がある場合には、入力を検証しサニタイズすることで、シェルインジェクション攻撃を軽減してください。属性の集合を持つ単一コマンドのみを実行し、シェルパラメータ拡張を許可しない `child_process.execFile` の使用を優先してください。 -**Otherwise:** Naive use of child processes could result in remote command execution or shell injection attacks due to malicious user input passed to an unsanitized system command. +**さもないと:** 子プロセスを愚直に利用することは、サニタイズされていないシステムコマンドに渡される悪意のあるユーザー入力が原因となって、結果としてリモートからのコマンド実行、またはシェルインジェクション攻撃を受けることにつながります。 -🔗 [**Read More: Be cautious when working with child processes**](/sections/security/childprocesses.md) +🔗 [**さらに読む: 子プロセスで処理を行う場合は注意する**](/sections/security/childprocesses.japanese.md)

diff --git a/sections/security/childprocesses.japanese.md b/sections/security/childprocesses.japanese.md index 75bfccbb..c70df1d1 100644 --- a/sections/security/childprocesses.japanese.md +++ b/sections/security/childprocesses.japanese.md @@ -1,31 +1,29 @@ -# Be cautious when working with child processes +# 子プロセスで処理を行う場合は注意する -### One Paragraph Explainer +### 一段落説明 -As great as child processes are, they should be used with caution. Passing in user input must be sanitized, if not avoided at all. -The dangers of unsanitized input executing system-level logic are unlimited, reaching from remote code execution to the exposure of -sensitive system data and even data loss. A check list of preparations could look like this +子プロセスは素晴らしいものですが、注意して使用する必要があります。ユーザー入力の受け渡しは、利用しないのでなければ、サニタイズされていなければなりません。サニタイズされていない入力がシステムレベルのロジックを実行する危険性は無限にあり、リモートコードの実行からセンシティブなシステムデータの漏洩、そしてデータ損失にまで及びます。準備のためのチェックリストは以下のようになります。 -- avoid user input in every case, otherwise validate and sanitize it -- limit the privileges of the parent and child processes using user/group identities -- run your process inside of an isolated environment to prevent unwanted side-effects if the other preparations fail +- すべての場合でユーザー入力を避け、そうでない場合は検証とサニタイズを行う +- ユーザー/グループアイデンティを利用して、親プロセスと子プロセスの権限を制限する +- 上記が機能しなかった場合の望まない副作用を防ぐために、プロセスを隔離された環境で実行する -### Code example: Dangers of unsanitized child process executions +### コード例: サニタイズされていない子プロセス実行の危険性 ```javascript const { exec } = require('child_process'); ... -// as an example, take a script that takes two arguments, one of them is unsanitized user input +// 例として、2つのうち1つがサニタイズされていないユーザー入力であるスクリプトを考えてみましょう exec('"/path/to/test file/someScript.sh" --someOption ' + input); -// -> imagine what could happen if the user simply enters something like '&& rm -rf --no-preserve-root /' -// you'd be in for an unwanted surprise +// -> ユーザー入力が '&& rm -rf --no-preserve-root /' だった場合に、何が起こるか想像してみてください +// 望まない結果に驚くことでしょう ``` -### Additional resources +### その他のリソース -From the Node.js child process [documentation](https://nodejs.org/dist/latest-v8.x/docs/api/child_process.html#child_process_child_process_exec_command_options_callback): +Node.js child process の[ドキュメント](https://nodejs.org/dist/latest-v8.x/docs/api/child_process.html#child_process_child_process_exec_command_options_callback) より: -> Never pass unsanitized user input to this function. Any input containing shell metacharacters may be used to trigger arbitrary command execution. +> サニタイズされていないユーザー入力をこの関数に決して渡さないでください。シェルのメタ文字を含んでいるどんな入力も、任意のコマンド実行を引き起こすために利用される可能性があります。