🛡️ Sentinel: [CRITICAL] Fix RCE vulnerability in PDF compilation - #437
🛡️ Sentinel: [CRITICAL] Fix RCE vulnerability in PDF compilation#437anchapin wants to merge 3 commits 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 restrictive execution flags to all LaTeX/PDF compilation paths (pdflatex and pandoc) and documents the RCE fix in the Sentinel security log for defense-in-depth against shell escape exploits. Sequence diagram for secured PDF compilation with no_shell_escapesequenceDiagram
actor User
participant CoverLetterGenerator
participant PdfConverter
participant pdflatex
participant pandoc
User->>CoverLetterGenerator: generate_cover_letter
CoverLetterGenerator->>PdfConverter: _compile_pdf(tex_content, output_path)
PdfConverter->>pdflatex: subprocess.Popen(pdflatex -interaction=nonstopmode -no-shell-escape)
alt [pdflatex succeeds]
pdflatex-->>PdfConverter: PDF created
PdfConverter-->>CoverLetterGenerator: return True
else [pdflatex fails]
PdfConverter->>pandoc: subprocess.Popen(pandoc --pdf-engine=xelatex --pdf-engine-opt=-no-shell-escape)
pandoc-->>PdfConverter: PDF created
PdfConverter-->>CoverLetterGenerator: return True
end
CoverLetterGenerator-->>User: compiled PDF
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Co-authored-by: anchapin <6326294+anchapin@users.noreply.github.com>
Co-authored-by: anchapin <6326294+anchapin@users.noreply.github.com>
🚨 Severity: CRITICAL
💡 Vulnerability: PDF compilation commands for pdflatex and pandoc lacked the -no-shell-escape flags in cli/pdf/converter.py and cli/generators/cover_letter_generator.py.
🎯 Impact: Allows arbitrary shell command execution (RCE) via \write18 if a malicious payload is injected into the LaTeX source.
🔧 Fix: Added -no-shell-escape to pdflatex commands and --pdf-engine-opt=-no-shell-escape to pandoc commands during compilation.
✅ Verification: Ensure the test suite passes (python -m pytest) and PDF generation works normally.
PR created automatically by Jules for task 11300656647367414925 started by @anchapin
Summary by Sourcery
Harden PDF compilation against remote code execution by restricting LaTeX shell access in all pdflatex and pandoc workflows.
Bug Fixes:
Documentation: