You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Disable file includes in Org and AsciiDoc rendering - #13
Rendering untrusted Org or AsciiDoc content could inline any file the process can read. #+INCLUDE: "/etc/passwd" src text in a .org file went through go-org's default ReadFile, and include::/etc/passwd[] in a .adoc file was expanded because asciidoctor runs in unsafe mode by default from the CLI.
OrgRenderer now sets ReadFile to a function that always returns an error, which covers both #+INCLUDE and #+SETUPFILE. The AsciiDoc renderer passes --safe-mode secure, so an include directive renders as a link to the path and the file is never read.
reStructuredText already ran with --no-file-insertion and is unchanged.
Summary by CodeRabbit
Bug Fixes
AsciiDoc and Org documents can no longer expose local file contents through file includes during rendering.
AsciiDoc rendering now runs in secure mode, and Org rendering blocks file reads.
Added coverage for absolute and relative include paths, including includes inside AsciiDoc source blocks. Tests confirm that temporary file contents are absent from rendered output.
Review was skipped as selected files did not have any reviewable changes.
Run configuration
Source mode: Auto
Repository: Unavailable
Branch: Unavailable
File: No configuration file from this repository applied
Commit: Unavailable
Layers: Organization UI
Review profile: CHILL
Plan: Advanced
Run ID: 7c108722-6418-48eb-bd8a-2f0917d8b1f2
Commits
Reviewing files that changed from the base of the PR and between a34c9d5 and a34c9d5.
You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.
Use the checkbox below for a quick retry:
Trigger review
No actionable comments were generated in the recent review.
Walkthrough
The Org parser now rejects file reads, and the default AsciiDoc renderer uses secure mode. New tests check that absolute and relative include directives do not expose temporary file contents in rendered output.
The Org parser rejects file reads, and the default AsciiDoc renderer uses --safe-mode secure. Tests check that absolute and relative include paths do not expose temporary file contents. The AsciiDoc test skips when its renderer is unavailable.
This change stops Org and AsciiDoc rendering from reading files from disk through include directives. It adds tests for the include paths. No remaining merge-blocking risk was found.
Pre-merge checks: 4
Check name
Status
Explanation
Description Check
Check skipped - CodeRabbit’s high-level summary is enabled.
Title check
The title "Disable file includes in Org and AsciiDoc rendering" matches the main change. The org.go change makes go-org's ReadFile callback return an error, and markup.go passes --safe-mode secure to …
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Full details: Title check
Explanation
The title "Disable file includes in Org and AsciiDoc rendering" matches the main change. The org.go change makes go-org's ReadFile callback return an error, and markup.go passes --safe-mode secure to asciidoctor, so both renderers stop inlining files. The title is specific, concise, and matches the PR objective.
Finishing Touches
Generate unit tests (beta)
Commit to this branch
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
File: No configuration file from this repository applied
Commit: Unavailable
Layers: Organization UI
Review profile: CHILL
Plan: Advanced
Run ID: 41f70bd7-de95-41ce-b35a-d8fe7ed1ac5b
Commits
Reviewing files that changed from the base of the PR and between 0cf03b6 and a34c9d5.
Files selected for processing: 3
markup.go
markup_test.go
org.go
Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.
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
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.
Rendering untrusted Org or AsciiDoc content could inline any file the process can read.
#+INCLUDE: "/etc/passwd" src textin a.orgfile went through go-org's defaultReadFile, andinclude::/etc/passwd[]in a.adocfile was expanded becauseasciidoctorruns in unsafe mode by default from the CLI.OrgRenderernow setsReadFileto a function that always returns an error, which covers both#+INCLUDEand#+SETUPFILE. The AsciiDoc renderer passes--safe-mode secure, so an include directive renders as a link to the path and the file is never read.reStructuredText already ran with
--no-file-insertionand is unchanged.Summary by CodeRabbit