Repository navigation
Warn against running RDoc on untrusted codebases - #1868
Merged
Merged
Conversation
Documentation previewCommit: |
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The README’s .rdoc_options example incorrectly claims that setting template_dir enables custom ERB template execution, although RDoc::Options#finish overwrites that value and the configuration documentation explicitly marks it unsupported.
1 open issue
What changed in this PR
Adds a security warning to RDoc’s README explaining why users should not generate documentation from codebases they do not trust.
Changes:
- Documents potential Ruby code execution through templates, plugins, and Rake tasks.
- Recommends an isolated environment without access to secrets when processing untrusted code.
| File | Description |
|---|---|
| README.md | Adds a Security section describing execution risks and isolation guidance. |
Review effort: Balanced
RDoc is not designed to process untrusted input safely. Plugins loaded through rdoc/discover.rb and RDoc::Task Rakefiles can run Ruby code. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FHNhuBcKpwab7T6MS4pS8T
st0012
force-pushed
the
readme-security-warning
branch
from
October 31, 2026 01:05
e6e26b2 to
d08735a
Compare
RDoc's markup formatters pass raw HTML through, so applications that render untrusted markup must sanitize the output. Suggested by kou. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FHNhuBcKpwab7T6MS4pS8T
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

RDoc is not designed to process untrusted input safely. This PR adds a Security section to the README that tells users not to run RDoc on a codebase they do not trust.
The section lists two ways that RDoc can run code. RDoc loads
rdoc/discover.rbfrom installed gems as plugins.RDoc::Taskruns the project'sRakefile. It also warns that the markup formatters pass raw HTML through, so applications that render untrusted markup must sanitize the output..rdoc_optionsis not in the list. RDoc reads it withPsych.safe_load, andOptions#finishreplaces anytemplate_dirthat it sets.