translate 6.1

This commit is contained in:
Yuki Ota
2020-10-31 21:52:03 +09:00
parent 2efe728954
commit 16b335e26f
2 changed files with 14 additions and 12 deletions

View File

@ -751,15 +751,15 @@ null == undefined; // true
<img src="https://img.shields.io/badge/OWASP%20Threats-Top%2010-green.svg" alt="54 items"/>
</div>
## ![✔] 6.1. Embrace linter security rules
## ![✔] 6.1. linter のセキュリティルールを受け入れる
<a href="https://www.owasp.org/index.php/Top_10-2017_A1-Injection" target="_blank"><img src="https://img.shields.io/badge/%E2%9C%94%20OWASP%20Threats%20-%20A1:Injection%20-green.svg" alt=""/></a> <a href="https://www.owasp.org/index.php/Top_10-2017_A7-Cross-Site_Scripting_(XSS)" target="_blank"><img src="https://img.shields.io/badge/%E2%9C%94%20OWASP%20Threats%20-%20XSS%20-green.svg" alt=""/></a>
**TL;DR:** Make use of security-related linter plugins such as [eslint-plugin-security](https://github.com/nodesecurity/eslint-plugin-security) to catch security vulnerabilities and issues as early as possible, preferably while they're being coded. This can help catching security weaknesses like using eval, invoking a child process or importing a module with a string literal (e.g. user input). Click 'Read more' below to see code examples that will get caught by a security linter
**TL;DR:** [eslint-plugin-security](https://github.com/nodesecurity/eslint-plugin-security) のようなセキュリティ関連の linter プラグインを利用して、セキュリティの脆弱性や問題をできる限り早く、できればコーディング段階で捕まえてください。これにより、eval の使用や子プロセスの呼び出し、(ユーザー入力などの)文字列リテラルを持つモジュールのインポートなど、セキュリティ上の弱点をキャッチするのに役立ちます。下記の「さらに読む」をクリックして、セキュリティ linter によって捕捉されるコード例を参照してください。
**Otherwise:** What could have been a straightforward security weakness during development becomes a major issue in production. Also, the project may not follow consistent code security practices, leading to vulnerabilities being introduced, or sensitive secrets committed into remote repositories
**さもなければ:** 開発時には単純なセキュリティ上の弱点だったかもしれないものが、本番環境では大きな問題となります。同様に、プロジェクトが一貫したコードセキュリティプラクティスに従わない場合もあり、脆弱性が入り込んだり、リモートリポジトリに機密情報がコミットされたりする可能性があります。
🔗 [**Read More: Lint rules**](/sections/security/lintrules.md)
🔗 [**さらに読む: Lint ルール**](/sections/security/lintrules.japanese.md)
<br/><br/>

View File

@ -1,12 +1,12 @@
# Embrace linter security rules
# linter のセキュリティルールを受け入れる
### One Paragraph Explainer
### 一段落説明
Security plugins for ESLint and TSLint such as [eslint-plugin-security](https://github.com/nodesecurity/eslint-plugin-security) and [tslint-config-security](https://www.npmjs.com/package/tslint-config-security) offer code security checks based on a number of known vulnerabilities, such as unsafe RegEx, unsafe use of `eval()`, and non-literal filenames being used when accessing the file system within an application. The use of git hooks such as [pre-git](https://github.com/bahmutov/pre-git) allows to further enforce any rules on source control before they get distributed to remotes, one of which can be to check that no secrets were added to source control.
[eslint-plugin-security](https://github.com/nodesecurity/eslint-plugin-security) [tslint-config-security](https://www.npmjs.com/package/tslint-config-security) といった ESLint や TSLint 用のセキュリティプラグインは、安全でない正規表現や安全でない `eval()` の使用、そしてアプリケーション内のファイルシステムにアクセスする際にリテラルでないファイル名を使用するといった、多くの既知の脆弱性に基づいたコードセキュリティチェックを提供しています。[pre-git](https://github.com/bahmutov/pre-git) のような git hooks の利用することで、リモートに配布される前に、シークレットがコードに含まれていないかチェックするなど、ソースコントロール上にさらなるルールを強制することができます。
### `eslint-plugin-security` example
### `eslint-plugin-security` の例
Some examples of unsafe practice rules detected by `eslint-plugin-security`:
`eslint-plugin-security` によって検出される安全でないプラクティスの例:
`detect-pseudoRandomBytes`
@ -36,9 +36,11 @@ const unsafe = new RegExp('/(x+x+)+y/)');
An example of running `eslint-plugin-security` on a Node.js project with the above unsafe code practices:
上記の安全でないコード例を含んだ Node.js プロジェクトにおける `eslint-plugin-security` の実行例:
![nsp check example](/assets/images/eslint-plugin-security.png)
### What other bloggers say
### 他のブロガーが言っていること
From the blog by [Adam Baldwin](https://www.safaribooksonline.com/blog/2014/03/28/using-eslint-plugins-node-js-app-security/):
> Linting doesnt have to be just a tool to enforce pedantic rules about whitespace, semicolons or eval statements. ESLint provides a powerful framework for eliminating a wide variety of potentially dangerous patterns in your code (regular expressions, input validation, and so on). I think it provides a powerful new tool thats worthy of consideration by security-conscious JavaScript developers.
[Adam Baldwin](https://www.safaribooksonline.com/blog/2014/03/28/using-eslint-plugins-node-js-app-security/) のブログより:
> Linting は、空白やセミコロン、eval 文などの細かいルールを強制するだけのツールではありません。ESLint は、コード内の様々な潜在的に危険なパターン(正規表現、入力値の検証など)を取り除くための強力なフレームワークを提供します。それはセキュリティを意識する JavaScript デベロッパーにとって検討に値する強力なツールを提供してくれると思います。