-
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,6 +26,7 @@ metadata found in options, a module, or `package.json` and calls | |
* [Supported Properties](#supported-properties) | ||
* [API](#api) | ||
* [`remark().use(gitContributors[, options])`](#remarkusegitcontributors-options) | ||
* [Security](#security) | ||
* [Contribute](#contribute) | ||
* [Contributors](#contributors) | ||
* [License](#license) | ||
|
@@ -177,6 +178,23 @@ Working directory from which to resolve a `contributors` module, if any | |
|
||
Inject Contributors section if there is none (`boolean`, default: `false`). | ||
|
||
## Security | ||
|
||
`options.contributors` (or `contributors` in `package.json`) and `author` from | ||
`package.json` are used and injected into the tree. | ||
`git log` also runs in the current working directory. | ||
This could open you up to a [cross-site scripting (XSS)][xss] attack if you pass | ||
user provided content in or store user provided content in `package.json` or | ||
Git. | ||
|
||
This may become a problem if the Markdown later transformed to | ||
[**rehype**][rehype] ([**hast**][hast]) or opened in an unsafe Markdown viewer. | ||
|
||
If `contributors` is a string, it is handled as a module identifier and | ||
loaded with `require`. | ||
This could also be very dangerous if an attacker was able to inject code in | ||
that package. | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
wooorm
Author
Member
|
||
|
||
## Contribute | ||
|
||
See [`contributing.md`][contributing] in [`remarkjs/.github`][health] for ways | ||
|
@@ -269,3 +287,9 @@ abide by its terms. | |
[mailmap]: https://git-scm.com/docs/git-shortlog#_mapping_authors | ||
|
||
[cwd]: https://github.com/vfile/vfile#vfilecwd | ||
|
||
[xss]: https://en.wikipedia.org/wiki/Cross-site_scripting | ||
|
||
[rehype]: https://github.com/rehypejs/rehype | ||
|
||
[hast]: https://github.com/syntax-tree/hast |
Be careful not to sow fear, which is already plaguing the JS ecosystem. I'm all for informing people about potential security risks, if they are realistic. Having user-provided input for
options.contributors
is realistic (and warning people about that is a good call), but I've not heard of anyone having user-provided input inpackage.json
. If someone is doing that, I would call it a general bad practice that needs to be warned against elsewhere (likenodejs/package-maintenance
) because it opens up many more holes.Perhaps start this Security section with "It is assumed that
remark-git-contributors
is used on a project under your control, which includes its markdown files andpackage.json
".