🛡️ Sentinel: [CRITICAL] Fix LaTeX Injection RCE and DoS in PDF Compilation - #423
🛡️ Sentinel: [CRITICAL] Fix LaTeX Injection RCE and DoS in PDF Compilation#423anchapin wants to merge 2 commits into
Conversation
…ation 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 defensive flags and timeouts around LaTeX/PDF compilation in PDFConverter and CoverLetterGenerator to mitigate LaTeX injection RCE and DoS, and introduces tests plus Sentinel documentation for these behaviors. Sequence diagram for secured LaTeX PDF compilation with flags and timeoutsequenceDiagram
participant Caller
participant CoverLetterGenerator
participant PDFConverter
participant subprocess
Caller->>CoverLetterGenerator: _compile_pdf(output_path, tex_content)
CoverLetterGenerator->>subprocess: Popen(["pdflatex", "-interaction=nonstopmode", "-no-shell-escape", tex_path.name])
alt pdflatex completes within 30s
CoverLetterGenerator->>subprocess: process.communicate(timeout=30)
subprocess-->>CoverLetterGenerator: stdout, stderr
CoverLetterGenerator-->>Caller: pdf_created or fallback to pandoc
else pdflatex times out
CoverLetterGenerator->>subprocess: process.kill()
CoverLetterGenerator->>subprocess: process.communicate()
CoverLetterGenerator-->>Caller: False
end
Caller->>PDFConverter: _compile_pdflatex(output_path, tex_path, working_dir)
PDFConverter->>subprocess: Popen(["pdflatex", "-interaction=nonstopmode", "-no-shell-escape", tex_path.name])
alt pdflatex completes within 30s
PDFConverter->>subprocess: process.communicate(timeout=30)
subprocess-->>PDFConverter: stdout, stderr
PDFConverter-->>Caller: True
else pdflatex times out
PDFConverter->>subprocess: process.kill()
PDFConverter->>subprocess: process.communicate()
PDFConverter-->>Caller: False
end
Caller->>PDFConverter: _compile_pandoc(output_path, tex_path, working_dir)
PDFConverter->>subprocess: Popen(["pandoc", tex_path, "-o", output_path, "--pdf-engine=xelatex", "--pdf-engine-opt=-no-shell-escape"])
alt pandoc completes within 30s
PDFConverter->>subprocess: process.communicate(timeout=30)
subprocess-->>PDFConverter: stdout, stderr
PDFConverter-->>Caller: True
else pandoc times out
PDFConverter->>subprocess: process.kill()
PDFConverter->>subprocess: process.communicate()
PDFConverter-->>Caller: False
end
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
…ation Co-authored-by: anchapin <6326294+anchapin@users.noreply.github.com>
🚨 Severity: CRITICAL
💡 Vulnerability: LaTeX injection RCE and DoS without timeouts in CoverLetterGenerator and PDFConverter
🎯 Impact: Arbitrary code execution or Denial of Service
🔧 Fix: Add
-no-shell-escapeflags and 30s timeouts✅ Verification: Tests pass.
PR created automatically by Jules for task 9727106323628115774 started by @anchapin
Summary by Sourcery
Harden LaTeX-based PDF generation against remote code execution and hangs by restricting compiler capabilities and enforcing time-bounded execution.
Bug Fixes:
Documentation:
Tests: