🛡️ Sentinel: [CRITICAL] Fix Remote Code Execution and DoS in PDF Compilation#307
🛡️ Sentinel: [CRITICAL] Fix Remote Code Execution and DoS in PDF Compilation#307anchapin wants to merge 1 commit into
Conversation
…ilation This commit addresses a critical vulnerability in the PDF compilation logic that permitted Remote Code Execution (RCE) via `\write18` and potential Denial of Service (DoS) due to hanging LaTeX compilations. Specifically: - Appended the `-no-shell-escape` flag to the `pdflatex` compilation command in `cover_letter_generator.py` and `converter.py`. - Appended the `--pdf-engine-opt=-no-shell-escape` flag to the `pandoc` fallback command in `cover_letter_generator.py` and `converter.py`. - Enforced a 30-second timeout on all `subprocess.communicate()` calls for LaTeX rendering. - Implemented robust process cleanup (`process.kill()`) in the `TimeoutExpired` exception block to prevent zombie processes. 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. |
🚨 Severity: CRITICAL
💡 Vulnerability: The application executed
pdflatexandpandocviasubprocess.Popenwithout enforcing the-no-shell-escapesandboxing flag or compilation timeouts.🎯 Impact: An attacker or rogue AI output could inject LaTeX control characters (like
\write18) to execute arbitrary shell commands on the host machine, leading to complete server compromise. Additionally, malicious or malformed LaTeX syntax could causepdflatexto hang indefinitely, causing a Denial of Service (DoS).🔧 Fix: Added
-no-shell-escapeto thepdflatexexecution parameters (and--pdf-engine-opt=-no-shell-escapeforpandoc). Enforced a 30-second timeout on allsubprocess.communicate()calls and added explicit process cleanup to prevent zombie processes.✅ Verification: Ran the full local test suite (
python -m pytest), includingtests/test_pdf_security.py, to ensure no regressions were introduced and security assertions remain intact.PR created automatically by Jules for task 712751419682513836 started by @anchapin