Skip to content

Commit 0625df6

Browse files
authored
Warn against running RDoc on untrusted codebases (#1868)
1 parent 5f6792f commit 0625df6

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

‎README.md‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,17 @@ rake rdoc:server
221221
- **Full cache invalidation.** Any file change clears all cached pages. This is simple and correct — rendering is fast (~ms per page), parsing is the expensive part and is done incrementally.
222222
- **No HTTPS or HTTP/2.** The server is intended for local development preview only.
223223

224+
## Security
225+
226+
Do not run RDoc on a codebase that you do not trust. RDoc is not designed to process untrusted input safely. Some RDoc features can run code:
227+
228+
- RDoc loads plugins from installed gems that provide `rdoc/discover.rb`. A plugin can run any Ruby code when RDoc starts.
229+
- `rake rdoc` and other `RDoc::Task` tasks run the project's `Rakefile`, which is Ruby code.
230+
231+
If you must generate documentation for an untrusted codebase, run RDoc in an isolated environment, such as a container with no access to secrets.
232+
233+
This applies to embedding RDoc as a library too. The markup formatters (such as `RDoc::Markup::ToHtml`) are not guaranteed to be safe on untrusted text, and raw HTML in the input is passed through without filtering. If your application renders markup submitted by untrusted users, sanitize the generated HTML and do not treat RDoc markup as a safe-by-default rendering path.
234+
224235
## Bugs
225236

226237
See [CONTRIBUTING.md](CONTRIBUTING.md) for information on filing a bug report. It's OK to file a bug report for anything you're having a problem with. If you can't figure out how to make RDoc produce the output you like that is probably a documentation bug.

0 commit comments

Comments
 (0)