Skip to content

๐Ÿ›ก๏ธ Sentinel: [MEDIUM] Fix command injection vulnerability with enhanced regex blocklist#268

Open
seonghobae wants to merge 1 commit into
developfrom
sentinel-command-injection-blocklist-11045992470802810106
Open

๐Ÿ›ก๏ธ Sentinel: [MEDIUM] Fix command injection vulnerability with enhanced regex blocklist#268
seonghobae wants to merge 1 commit into
developfrom
sentinel-command-injection-blocklist-11045992470802810106

Conversation

@seonghobae

Copy link
Copy Markdown
Collaborator

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

@google-labs-jules

Copy link
Copy Markdown

๐Ÿ‘‹ 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 @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

Copilot AI review requested due to automatic review settings July 2, 2026 22:09

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_PATTERN to reject \n and \r in 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants