π‘οΈ Sentinel: [CRITICAL] Fix LaTeX Command Injection and DoS via Shell Escape#376
π‘οΈ Sentinel: [CRITICAL] Fix LaTeX Command Injection and DoS via Shell Escape#376anchapin wants to merge 2 commits into
Conversation
Added `-no-shell-escape` to `pdflatex` and `--pdf-engine-opt=-no-shell-escape` to `pandoc` commands in `PDFConverter` and `CoverLetterGenerator` to prevent arbitrary command execution via maliciously crafted LaTeX (e.g., \write18). Also implemented 30-second timeouts on `subprocess.communicate()` calls to mitigate Denial of Service (DoS) attacks from hanging processes. Added corresponding security unit tests and updated Sentinel journal. 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. |
Added `-no-shell-escape` to `pdflatex` and `--pdf-engine-opt=-no-shell-escape` to `pandoc` commands in `PDFConverter` and `CoverLetterGenerator` to prevent arbitrary command execution via maliciously crafted LaTeX (e.g., \write18). Also implemented 30-second timeouts on `subprocess.communicate()` calls to mitigate Denial of Service (DoS) attacks from hanging processes. Added corresponding security unit tests and updated Sentinel journal. Fixed ruff and isort errors in tests file. Co-authored-by: anchapin <6326294+anchapin@users.noreply.github.com>
π¨ Severity: CRITICAL
π‘ Vulnerability: PDF compilation via
pdflatexandpandocexecuted without disabling shell escapes, allowing potential Local File Inclusion (LFI) or Command Injection if malicious LaTeX strings (like\write18) are compiled. Subprocesses also lacked timeouts, posing a Denial of Service (DoS) risk.π― Impact: An attacker could potentially execute arbitrary code on the host system or hang the compilation threads indefinitely.
π§ Fix: Appended
-no-shell-escapetopdflatexarguments and--pdf-engine-opt=-no-shell-escapetopandoc. Added a 30-second timeout tosubprocess.communicate()calls, catchingTimeoutExpiredto cleanly kill hanging processes.β Verification: Covered by the new tests
test_converter_pdflatex_securityandtest_cover_letter_pdflatex_securityintests/test_pdf_security.py. All tests passed.PR created automatically by Jules for task 11503281699449024655 started by @anchapin