π‘οΈ Sentinel: [CRITICAL] Fix Remote Code Execution in PDF Compilers - #425
π‘οΈ Sentinel: [CRITICAL] Fix Remote Code Execution in PDF Compilers#425anchapin wants to merge 1 commit into
Conversation
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 GuideAdds hardened invocation of pdflatex and pandoc by explicitly disabling shell escapes to mitigate a critical RCE risk, and documents the incident in the Sentinel security notes. Sequence diagram for hardened PDF compilation with disabled shell escapesequenceDiagram
participant CoverLetterGenerator
participant PdfConverter
participant pdflatex
participant pandoc
CoverLetterGenerator->>pdflatex: subprocess.Popen(["pdflatex","-interaction=nonstopmode","-no-shell-escape",tex_path.name])
alt pdflatex_fails
CoverLetterGenerator->>pandoc: subprocess.Popen(["pandoc",tex_path,"-o",output_path,"--pdf-engine=xelatex","--pdf-engine-opt=-no-shell-escape"])
end
PdfConverter->>pdflatex: subprocess.Popen(["pdflatex","-interaction=nonstopmode","-no-shell-escape",tex_path.name])
alt pdflatex_fails
PdfConverter->>pandoc: subprocess.Popen(["pandoc",tex_path,"-o",output_path,"--pdf-engine=xelatex","--pdf-engine-opt=-no-shell-escape"])
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 command constructions are now duplicated in two modules with the same security options; consider centralizing them in a shared helper to avoid drift if flags need to change again.
- If there are environments that legitimately rely on LaTeX shell-escape, it may be worth making the
-no-shell-escapebehavior explicitly configurable (with a very secure default) rather than hard-coding it in the command.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The pdflatex and pandoc command constructions are now duplicated in two modules with the same security options; consider centralizing them in a shared helper to avoid drift if flags need to change again.
- If there are environments that legitimately rely on LaTeX shell-escape, it may be worth making the `-no-shell-escape` behavior explicitly configurable (with a very secure default) rather than hard-coding it in the command.Help me be more useful! Please click π or π on each comment and I'll use the feedback to improve your reviews.
π¨ Severity: CRITICAL \n π‘ Vulnerability: Missing shell escape restrictions in pdflatex and pandoc commands allowed potential Remote Code Execution (RCE). \n π― Impact: An attacker could execute arbitrary system commands if malicious LaTeX code was provided. \n π§ Fix: Added `-no-shell-escape` and `--pdf-engine-opt=-no-shell-escape` flags to subprocess commands. \n β Verification: Verified arguments are passed correctly to subprocess.Popen.
PR created automatically by Jules for task 2547036225237175064 started by @anchapin
Summary by Sourcery
Harden PDF compilation to prevent remote code execution via LaTeX shell escapes.
Bug Fixes:
Documentation: