diff --git a/README.md b/README.md index 24cde393..4eac90e2 100644 --- a/README.md +++ b/README.md @@ -50,6 +50,7 @@ The available configs are: - [No Blur](./docs/rules/no-blur.md) - [No D None](./docs/rules/no-d-none.md) - [No Dataset](./docs/rules/no-dataset.md) +- [No Dynamic Script Tag](./docs/rules/no-dynamic-script-tag.md) - [No Implicit Buggy Globals](./docs/rules/no-implicit-buggy-globals.md) - [No Inner HTML](./docs/rules/no-inner-html.md) - [No InnerText](./docs/rules/no-innerText.md) diff --git a/docs/rules/no-dynamic-script-tag.md b/docs/rules/no-dynamic-script-tag.md new file mode 100644 index 00000000..5f8fd953 --- /dev/null +++ b/docs/rules/no-dynamic-script-tag.md @@ -0,0 +1,24 @@ +# No Dynamic Script Tag + +## Rule Details + +Creating dynamic script tags bypasses a lot of security measures - like SRIs - and pose a potential threat to your application. +Instead of creating a `script` tag in the client, provide all necessary `script` tags in the page's HTML. + +👎 Examples of **incorrect** code for this rule: + +```js +document.createElement('script') +document.getElementById('some-id').type = 'text/javascript' +``` + +👍 Examples of **correct** code for this rule: + +```html + +