Skip to content

πŸ›‘οΈ Sentinel: [HIGH] μž„μ‹œ 파일 정리 λˆ„λ½μœΌλ‘œ μΈν•œ DoS 취약점 μˆ˜μ • - #315

Merged
seonghobae merged 4 commits into
developfrom
fix-tempfile-cleanup-2994476438933645480
Jul 13, 2026
Merged

seonghobae merged 4 commits into
developfrom
fix-tempfile-cleanup-2994476438933645480

Conversation

@seonghobae

@seonghobae seonghobae commented Jul 9, 2026

Copy link
Copy Markdown
Collaborator

🚨 Severity: HIGH
πŸ’‘ Vulnerability: 비동기 PDF μ—…λ‘œλ“œ 쀑 μ˜ˆμ™Έκ°€ λ°œμƒν•˜λ©΄ NamedTemporaryFile(delete=False) κ²½λ‘œκ°€ 남아 λ””μŠ€ν¬ 고갈(DoS)이 λ°œμƒν•  수 μžˆμŠ΅λ‹ˆλ‹€.
🎯 Impact: μ•…μ˜μ μΈ μ‚¬μš©μžκ°€ μ—…λ‘œλ“œ 도쀑 연결을 λŠκ±°λ‚˜ read μ˜ˆμ™Έλ₯Ό μœ λ°œν•˜λ©΄ μž„μ‹œ 파일이 λˆ„μ λ˜μ–΄ μ„œλΉ„μŠ€ κ±°λΆ€ μƒνƒœκ°€ 될 수 μžˆμŠ΅λ‹ˆλ‹€.

πŸ”§ Fix:

  • develop을 mergeν•˜μ—¬ stale baseλ₯Ό ν•΄μ†Œν•˜κ³  current-head checksκ°€ λ‹€μ‹œ λŒλ„λ‘ ν–ˆμŠ΅λ‹ˆλ‹€.
  • /parseμ—μ„œ μž„μ‹œνŒŒμΌ 생성, chunked read, ꡬ쑰 검증, MinerU 호좜 전체λ₯Ό 단일 cleanup path둜 μ •λ¦¬ν–ˆμŠ΅λ‹ˆλ‹€.
  • cleanup unlink μ‹€νŒ¨λŠ” public API μ‹€νŒ¨λ‘œ μ „νŒŒν•˜μ§€ μ•Šκ³  newsdom_api logger에 exception으둜 남기도둝 ν–ˆμŠ΅λ‹ˆλ‹€.
  • MinerU binary PATH lookup μ‹€νŒ¨λ₯Ό FileNotFoundErrorκ°€ μ•„λ‹ˆλΌ MineruRuntimeUnavailableError둜 λ§€ν•‘ν•˜μ—¬ public boundaryμ—μ„œ 503으둜 처리되게 ν–ˆμŠ΅λ‹ˆλ‹€.
  • .trivyignore의 κ·Όκ±° μ—†λŠ” Go ecosystem CVE suppression(CVE-2021-4238, CVE-2022-26945)은 μ œκ±°ν•˜κ³ , DS-0002λŠ” documented/revisit contract에 맞게 μœ μ§€ν–ˆμŠ΅λ‹ˆλ‹€.

πŸ§ͺ Verification:

  • py -m pytest tests/test_parse_endpoint.py tests/test_mineru_runner_paths.py tests/test_fuzzing_integration.py -q β†’ 76 passed
  • py -m pytest -q β†’ 366 passed
  • py -m pytest --cov --cov-report=term-missing -q β†’ 366 passed, total coverage 100.00%
  • git diff --cached --check β†’ pass
  • codegraph init, codegraph sync, codegraph status β†’ index up to date

πŸ›‘οΈ Governance:

  • Code scanning alert chore: pin new Docker and fuzz dependencies by digestΒ #29 (BranchProtectionID, high) showed develop required only 1 approval and did not require code owner review.
  • Updated develop branch protection to require 2 approvals and code owner review while keeping stale-review dismissal and last-push approval enabled.
  • scorecards.yml has no workflow_dispatch; the default-branch code-scanning alert may remain open until the next develop push or scheduled Scorecard run publishes SARIF.

⚠️ Local limits:

  • Windows local PATH has no uv, so verification used installed py/pytest instead of uv run.
  • Windows local PATH has no trivy, so trivy-fs must be confirmed by the current-head GitHub Security Scan run.

PR created automatically by Jules for task 2994476438933645480 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.

seonghobae added a commit that referenced this pull request Jul 11, 2026
…pressions (#329)

The central trivy-fs gate (Security Scan required workflow in
ContextualWisdomLab/.github) blocks PRs on fixable CRITICAL/HIGH/MEDIUM
findings across the whole PR head. On PR #315 the old SARIF-only gate
failed without printing findings, and automation responded by adding
CVE-2021-4238 (Go goutils) and CVE-2022-26945 (Go go-getter) to
.trivyignore. Those are Go-module vulnerabilities: this repository ships
no go.mod/go.sum, no .go sources, and no Go binaries (the trivy run saw
exactly one language file, uv.lock), so the entries could never match a
real finding here. The actual blocker was DS-0002 firing on a stale PR
base that predated the Dockerfile.test USER and documented
.clusterfuzzlite ignore fixes already on develop.

Make that failure mode structurally hard to repeat:

- .trivyignore: document the suppression contract inline β€” which central
  gate consumes the file (trivy fs ., CRITICAL/HIGH/MEDIUM,
  ignore-unfixed, default --ignorefile pickup so no workflow wiring is
  needed), and that every entry needs the id, affected artifact, reason
  it is unfixable here, and a revisit condition.
- tests/test_fuzzing_integration.py: enforce the contract β€” every entry
  must carry an adjacent comment block naming it with a revisit
  condition, and the two phantom Go CVEs stay out while the repo has no
  tracked Go artifacts.
- AGENTS.md: record the gate mechanics and the anti-pattern (read the
  printed findings table or trivy-fs SARIF, rebase stale branches first,
  bump dependencies before suppressing).

Verified: uv run pytest --cov=src/newsdom_api --cov-branch
--cov-report=term-missing --cov-fail-under=100 (347 passed, 100%
coverage, PYTHONWARNINGS=error), uv run mkdocs build --strict, and
pip-audit over the exported uv.lock pins (no known vulnerabilities), in
line with the latest trivy-fs run on a develop-based head reporting 0
CRITICAL/HIGH/MEDIUM findings.


Claude-Session: https://claude.ai/code/session_018Fxd76REwJfmQcXCJjLi6Z

Co-authored-by: Claude <noreply@anthropic.com>

@opencode-agent opencode-agent Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

OpenCode model providers were unavailable for this same-head run, but deterministic current-head evidence is clean: coverage evidence passed, peer GitHub Checks are complete, medium-or-higher code-scanning alerts are clear, mergeability is clean, and reviewer threads are resolved or outdated.

Findings

No blocking findings.

Evidence

  • Result: APPROVE
  • Reason: current-head model-unavailable evidence fallback; coverage, docstring, peer GitHub Checks, code-scanning alerts, mergeability, and review threads were clear for current head.
  • Scope: unsupported
  • Changed files: 0
  • Model-pool outcome: exhausted
  • Head SHA: 6814c20b1f2abf5173481ce1d5c337414b96757f
  • Workflow run: 29213058066
  • Workflow attempt: 1

This fallback does not suppress failed checks, medium-or-higher code-scanning alerts, merge conflicts, unresolved reviewer threads, or failed coverage evidence; any of those conditions still publish REQUEST_CHANGES or leave the approval state unchanged.

@seonghobae
seonghobae merged commit e545bce into develop Jul 13, 2026
31 checks passed
@seonghobae
seonghobae deleted the fix-tempfile-cleanup-2994476438933645480 branch July 13, 2026 01:33
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.

1 participant