๐ก๏ธ Sentinel: [MEDIUM] Fix command injection vulnerability with enhanced regex blocklist#268
Conversation
|
๐ 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. |
There was a problem hiding this comment.
Pull request overview
Note
Copilot couldn't run its full agentic review because no GitHub Actions runner was available. Make sure your repository has a runner available to run Copilot's review, or add a copilot-setup-steps.yml file specifying one with the runs-on attribute. See the docs for more details.
Strengthens MinerU command-argument validation by blocking newline and carriage return characters to mitigate log injection / parsing issues, and adds regression tests to cover the new constraints.
Changes:
- Extend
_UNSAFE_CHARS_PATTERNto reject\nand\rin command arguments. - Add test cases for newline and pipe characters; rename the related test for clarity.
- Document the security learning in
.jules/sentinel.md.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
src/newsdom_api/mineru_runner.py |
Expands the unsafe-character regex to include newline and carriage return. |
tests/test_mineru_runner_paths.py |
Adds regression coverage for newline/pipe disallowed characters and updates test naming/ids. |
.jules/sentinel.md |
Records the vulnerability context and prevention guidance for future reference. |
๐ก Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
What (๊ตฌํ ๋ด์ฉ)
src/newsdom_api/mineru_runner.py์_UNSAFE_CHARS_PATTERN์ ๊ฐํ ๋ฌธ์(\n)์ ์บ๋ฆฌ์ง ๋ฆฌํด(\r)์ ์ถ๊ฐํ์ฌ ๋ช ๋ น์ด ์ธ์ ๊ฒ์ฆ์ ๊ฐํํ์ต๋๋ค.Why (ํด๊ฒฐํ๋ ๋ฌธ์ )
์ธ๋ถ ๋ช ๋ น์ด๋ฅผ ํธ์ถํ ๋(
shell=False๋ฅผ ์ฌ์ฉํ๋๋ผ๋) ๋ก๊ทธ ์ธ์ ์ ์ด๋ ๋ช ๋ น์ด ํ์ฑ ์ค๋ฅ๋ฅผ ์ ๋ฐํ ์ ์๋ ๊ฐํ ๋ฌธ์๊ฐ ํํฐ๋ง๋์ง ์๊ณ ์์์ต๋๋ค. ์๊ฒฉํ ํ์ดํธ๋ฆฌ์คํธ ๋ฐฉ์์ ๋ค์ํ ์ธ์ด์ ์ ๋์ฝ๋ ํ์ผ ์ด๋ฆ ์ฒ๋ฆฌ์ ๋ฌธ์ ๋ฅผ ์ผ์ผํค๋ฏ๋ก, ํฌ๊ด์ ์ธ ๋ธ๋๋ฆฌ์คํธ ๋ฐฉ์์ ๊ฐํ ๋ฌธ์๋ฅผ ํฌํจ์์ผ ํธํ์ฑ์ ์ ์งํ๋ฉด์๋ ๋ณด์์ ๊ฐํํ์ต๋๋ค.Impact (์ฑ๋ฅ/์ํฅ)
์ ํจํ ์ ๋์ฝ๋ ํ์ผ ๊ฒฝ๋ก์ ์ํฅ์ ์ฃผ์ง ์์ผ๋ฉด์ ๋ช ๋ น์ด์ ๊ด๋ จ๋ ๋ณด์ ์ทจ์ฝ์ ์ ์ฐจ๋จํฉ๋๋ค. ๋ณ๊ฒฝ๋ ๋ก์ง์ ๊ฒ์ฆํ๊ธฐ ์ํ ํ ์คํธ ์ฝ๋๊ฐ ์ถ๊ฐ๋์์ต๋๋ค.
Measurement (์ธก์ /๊ฒ์ฆ ๋ฐฉ๋ฒ)
uv run pytest --cov=src/newsdom_api --cov-branch --cov-report=term-missing tests/test_mineru_runner.py tests/test_mineru_runner_paths.py๋ช ๋ น์ ์คํํ์ฌ ๋ชจ๋ ํ ์คํธ๊ฐ ํต๊ณผํ๊ณ 100% ์ฝ๋ ์ปค๋ฒ๋ฆฌ์ง๋ฅผ ์ ์งํ๋์ง ํ์ธํ์ต๋๋ค..jules/sentinel.md์ ๊ด๋ จ๋ ๋ณด์ ํ์ต ๋ด์ฉ์ ๊ธฐ๋กํ์ต๋๋ค.PR created automatically by Jules for task 11045992470802810106 started by @seonghobae