Conversation
- Introduce `get_jinja_tex_env` to `CoverLetterGenerator` to enforce auto-escaping of LaTeX special characters. - Add `now` global to `tex_env` in `template_utils.py` to fix regression. - Add regression test `tests/test_cover_letter_security.py`. - Add journal entry to `.jules/sentinel.md`. 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. |
- Remove unused `pathlib.Path` import. - Sort imports to satisfy `isort`. Co-authored-by: anchapin <6326294+anchapin@users.noreply.github.com>
This PR fixes a critical LaTeX injection vulnerability in the Cover Letter Generator. Previously, user input (e.g., company name) was rendered into LaTeX templates using a standard Jinja2 environment, allowing malicious LaTeX commands (like
\input{...}) to be executed during PDF compilation.Changes:
cli/generators/cover_letter_generator.pyto useget_jinja_tex_env, which includes afinalizehook that automatically escapes all variable output usinglatex_escape.cli/utils/template_utils.pyto adddatetime.now(aliased asnow) to thetex_envglobals, as it was missing and caused a regression in templates that use{{ now() }}.tests/test_cover_letter_security.pyto verify the fix and prevent regression..jules/sentinel.md.Verification:
reproduce_issue.py(created during investigation) which confirmed the fix.pytest) to ensure no regressions.PR created automatically by Jules for task 5353573970625624386 started by @anchapin