Skip to content

Commit

Permalink
Add paragraph on security
Browse files Browse the repository at this point in the history
Closes GH-1010.
  • Loading branch information
wooorm committed Feb 12, 2025
1 parent 360840f commit cdab8fa
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 70 deletions.
24 changes: 3 additions & 21 deletions packages/remark-cli/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -302,19 +302,7 @@ compatible with Node.js 16.

## Security

As markdown can be turned into HTML and improper use of HTML can open you up to
[cross-site scripting (XSS)][wikipedia-xss] attacks,
use of remark can be unsafe.
When going to HTML,
you will likely combine remark with **[rehype][github-rehype]**,
in which case you should use
[`rehype-sanitize`][github-rehype-sanitize].

Use of remark plugins could also open you up to other attacks.
Carefully assess each plugin and the risks involved in using them.

For info on how to submit a report,
see our [security policy][health-security].
See [*§ Security* in `remarkjs/remark`][github-remark-security].

## Contribute

Expand Down Expand Up @@ -426,14 +414,12 @@ Support this effort and give back by sponsoring on [OpenCollective][]!

[github-markdown-style-guide]: https://github.com/remarkjs/remark-lint/tree/main/packages/remark-preset-lint-markdown-style-guide

[github-rehype]: https://github.com/rehypejs/rehype

[github-rehype-sanitize]: https://github.com/rehypejs/rehype-sanitize

[github-remark]: https://github.com/remarkjs/remark

[github-remark-core]: https://github.com/remarkjs/remark/tree/main/packages/remark

[github-remark-security]: https://github.com/remarkjs/remark#security

[github-remark-toc]: https://github.com/remarkjs/remark-toc

[github-unified-args]: https://github.com/unifiedjs/unified-args
Expand All @@ -448,12 +434,8 @@ Support this effort and give back by sponsoring on [OpenCollective][]!

[health-contributing]: https://github.com/remarkjs/.github/blob/main/contributing.md

[health-security]: https://github.com/remarkjs/.github/blob/main/security.md

[health-support]: https://github.com/remarkjs/.github/blob/main/support.md

[npm-install]: https://docs.npmjs.com/cli/install

[opencollective]: https://opencollective.com/unified

[wikipedia-xss]: https://en.wikipedia.org/wiki/Cross-site_scripting
23 changes: 3 additions & 20 deletions packages/remark-parse/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -252,18 +252,7 @@ compatible with Node.js 16.

## Security

As markdown can be turned into HTML and improper use of HTML can open you up to
[cross-site scripting (XSS)][wikipedia-xss] attacks,
use of remark can be unsafe.
When going to HTML,
you will combine remark with **[rehype][github-rehype]**,
in which case you should use [`rehype-sanitize`][github-rehype-sanitize].

Use of remark plugins could also open you up to other attacks.
Carefully assess each plugin and the risks involved in using them.

For info on how to submit a report,
see our [security policy][health-security].
See [*§ Security* in `remarkjs/remark`][github-remark-security].

## Contribute

Expand Down Expand Up @@ -387,10 +376,6 @@ Support this effort and give back by sponsoring on [OpenCollective][]!

[github-micromark-extensions]: https://github.com/micromark/micromark#extensions

[github-rehype]: https://github.com/rehypejs/rehype

[github-rehype-sanitize]: https://github.com/rehypejs/rehype-sanitize

[github-remark]: https://github.com/remarkjs/remark

[github-remark-core]: https://github.com/remarkjs/remark/tree/main/packages/remark
Expand All @@ -409,6 +394,8 @@ Support this effort and give back by sponsoring on [OpenCollective][]!

[github-remark-plugins]: https://github.com/remarkjs/remark#plugins

[github-remark-security]: https://github.com/remarkjs/remark#security

[github-remark-stringify]: https://github.com/remarkjs/remark/tree/main/packages/remark-stringify

[github-unified]: https://github.com/unifiedjs/unified
Expand All @@ -419,14 +406,10 @@ Support this effort and give back by sponsoring on [OpenCollective][]!

[health-contributing]: https://github.com/remarkjs/.github/blob/main/contributing.md

[health-security]: https://github.com/remarkjs/.github/blob/main/security.md

[health-support]: https://github.com/remarkjs/.github/blob/main/support.md

[npm-install]: https://docs.npmjs.com/cli/install

[opencollective]: https://opencollective.com/unified

[typescript]: https://www.typescriptlang.org

[wikipedia-xss]: https://en.wikipedia.org/wiki/Cross-site_scripting
12 changes: 3 additions & 9 deletions packages/remark-stringify/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -248,13 +248,7 @@ compatible with Node.js 16.

## Security

Use of `remark-stringify` is safe.

Use of remark plugins can open you up to attacks.
Carefully assess each plugin and the risks involved in using them.

For info on how to submit a report,
see our [security policy][health-security].
See [*§ Security* in `remarkjs/remark`][github-remark-security].

## Contribute

Expand Down Expand Up @@ -394,6 +388,8 @@ Support this effort and give back by sponsoring on [OpenCollective][]!

[github-remark-plugins]: https://github.com/remarkjs/remark#plugins

[github-remark-security]: https://github.com/remarkjs/remark#security

[github-unified]: https://github.com/unifiedjs/unified

[health]: https://github.com/remarkjs/.github
Expand All @@ -402,8 +398,6 @@ Support this effort and give back by sponsoring on [OpenCollective][]!

[health-contributing]: https://github.com/remarkjs/.github/blob/main/contributing.md

[health-security]: https://github.com/remarkjs/.github/blob/main/security.md

[health-support]: https://github.com/remarkjs/.github/blob/main/support.md

[npm-install]: https://docs.npmjs.com/cli/install
Expand Down
23 changes: 3 additions & 20 deletions packages/remark/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -282,18 +282,7 @@ compatible with Node.js 16.

## Security

As markdown can be turned into HTML and improper use of HTML can open you up to
[cross-site scripting (XSS)][wikipedia-xss] attacks,
use of remark can be unsafe.
When going to HTML,
you will combine remark with **[rehype][github-rehype]**,
in which case you should use [`rehype-sanitize`][github-rehype-sanitize].

Use of remark plugins could also open you up to other attacks.
Carefully assess each plugin and the risks involved in using them.

For info on how to submit a report,
see our [security policy][health-security].
See [*§ Security* in `remarkjs/remark`][github-remark-security].

## Contribute

Expand Down Expand Up @@ -411,16 +400,14 @@ Support this effort and give back by sponsoring on [OpenCollective][]!

[github-mdast]: https://github.com/syntax-tree/mdast

[github-rehype]: https://github.com/rehypejs/rehype

[github-rehype-sanitize]: https://github.com/rehypejs/rehype-sanitize

[github-remark]: https://github.com/remarkjs/remark

[github-remark-cli]: https://github.com/remarkjs/remark/tree/main/packages/remark-cli

[github-remark-parse]: https://github.com/remarkjs/remark/tree/main/packages/remark-parse

[github-remark-security]: https://github.com/remarkjs/remark#security

[github-remark-stringify]: https://github.com/remarkjs/remark/tree/main/packages/remark-stringify

[github-unified]: https://github.com/unifiedjs/unified
Expand All @@ -431,14 +418,10 @@ Support this effort and give back by sponsoring on [OpenCollective][]!

[health-contributing]: https://github.com/remarkjs/.github/blob/main/contributing.md

[health-security]: https://github.com/remarkjs/.github/blob/main/security.md

[health-support]: https://github.com/remarkjs/.github/blob/main/support.md

[npm-install]: https://docs.npmjs.com/cli/install

[opencollective]: https://opencollective.com/unified

[typescript]: https://www.typescriptlang.org

[wikipedia-xss]: https://en.wikipedia.org/wiki/Cross-site_scripting
9 changes: 9 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -496,6 +496,15 @@ When going to HTML,
you will combine remark with **[rehype][github-rehype]**,
in which case you should use [`rehype-sanitize`][github-rehype-sanitize].

Another security aspect is DDoS attacks.
An attacker could cause a crash or slow down with big files.
Crashes can also originate from smaller payloads,
often when thousands of things (such as lists or links) are opened.
It is wise to cap the accepted size of input
(500kb can hold a big book)
and to process content in a different thread or worker so that it can be
stopped when needed.

Use of remark plugins could also open you up to other attacks.
Carefully assess each plugin and the risks involved in using them.

Expand Down

0 comments on commit cdab8fa

Please sign in to comment.