π‘οΈ Sentinel: [CRITICAL] Fix LaTeX shell escape RCE - #431
Conversation
Disabled LaTeX shell escapes to prevent arbitrary command execution via maliciously injected LaTeX code during PDF compilation. Added `-no-shell-escape` for pdflatex and `--pdf-engine-opt=-no-shell-escape` for pandoc. Co-authored-by: anchapin <6326294+anchapin@users.noreply.github.com>
|
π Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a π emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
Reviewer's GuideThis PR hardens PDF generation by explicitly disabling LaTeX shell escapes for both pdflatex and pandoc-based compilation paths, and documents the vulnerability and its mitigation in the Sentinel security log. Sequence diagram for hardened LaTeX PDF compilationsequenceDiagram
participant CoverLetterGenerator
participant subprocess
participant pdflatex
participant pandoc
CoverLetterGenerator->>subprocess: Popen(["pdflatex", "-interaction=nonstopmode", "-no-shell-escape", tex_path.name])
subprocess->>pdflatex: execute pdflatex
pdflatex-->>CoverLetterGenerator: returncode
alt pdflatex_success
CoverLetterGenerator-->>CoverLetterGenerator: use pdflatex PDF output
else pdflatex_failure
CoverLetterGenerator->>subprocess: Popen(["pandoc", tex_path, "-o", output_path, "--pdf-engine=xelatex", "--pdf-engine-opt=-no-shell-escape"])
subprocess->>pandoc: execute pandoc
pandoc-->>CoverLetterGenerator: returncode
end
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've left some high level feedback:
- The pdflatex and pandoc invocation arguments are now duplicated in multiple places; consider centralizing command construction (e.g., a helper that injects the
-no-shell-escape/--pdf-engine-optflags) to keep the shell-escape policy consistent and easier to maintain. - If there are any other LaTeX compilation paths in the codebase (e.g., different generators or utilities), it would be worth checking that they also explicitly pass
-no-shell-escape/--pdf-engine-opt=-no-shell-escapeto avoid inconsistent hardening.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The pdflatex and pandoc invocation arguments are now duplicated in multiple places; consider centralizing command construction (e.g., a helper that injects the `-no-shell-escape` / `--pdf-engine-opt` flags) to keep the shell-escape policy consistent and easier to maintain.
- If there are any other LaTeX compilation paths in the codebase (e.g., different generators or utilities), it would be worth checking that they also explicitly pass `-no-shell-escape` / `--pdf-engine-opt=-no-shell-escape` to avoid inconsistent hardening.Help me be more useful! Please click π or π on each comment and I'll use the feedback to improve your reviews.
Disabled LaTeX shell escapes to prevent arbitrary command execution via maliciously injected LaTeX code during PDF compilation. Added `-no-shell-escape` for pdflatex and `--pdf-engine-opt=-no-shell-escape` for pandoc. Co-authored-by: anchapin <6326294+anchapin@users.noreply.github.com>
Disabled LaTeX shell escapes to prevent arbitrary command execution via maliciously injected LaTeX code during PDF compilation. Added `-no-shell-escape` for pdflatex and `--pdf-engine-opt=-no-shell-escape` for pandoc. Co-authored-by: anchapin <6326294+anchapin@users.noreply.github.com>
π¨ Severity: CRITICAL
π‘ Vulnerability: Missing flags allowed arbitrary shell command execution if malicious LaTeX was injected.
π― Impact: Prevents RCE and protects the system from arbitrary command execution.
π§ Fix: Disabled shell escapes in pdflatex and pandoc during PDF compilation.
β Verification: Verified via unit tests that compilation proceeds successfully while blocking shell escapes.
PR created automatically by Jules for task 15206891120435747647 started by @anchapin
Summary by Sourcery
Harden LaTeX-based PDF generation against remote code execution by disabling shell escapes in all compilation paths and documenting the vulnerability and its mitigation in Sentinel notes.
Bug Fixes:
Documentation: