Skip to content

hardening(pdf): contain ordinary parser exceptions at validation boundary - #813

Draft
seonghobae wants to merge 8 commits into
developfrom
sentinel-fix-pdf-dos-6122230839689096175
Draft

hardening(pdf): contain ordinary parser exceptions at validation boundary#813
seonghobae wants to merge 8 commits into
developfrom
sentinel-fix-pdf-dos-6122230839689096175

Conversation

@seonghobae

@seonghobae seonghobae commented Sep 5, 2026

Copy link
Copy Markdown
Collaborator

Current authority

  • protected/base: develop@e06b1f3fb10903569124af011da213951e6e2473
  • exact head: 643e3f407ad71ce6f2b5c65f428b1a51620992ae
  • ancestry: protected base is the exact merge base; ahead 5 / behind 0
  • effective delta: src/newsdom_api/main.py plus tests/test_pdf_validation_exception_boundary.py
  • lifecycle: Draft

Corrected finding

This change is parser-boundary robustness hardening. It is not evidence that a MEDIUM denial-of-service vulnerability has been fixed. Catching an exception cannot terminate a parser that is consuming excessive CPU or memory, and it does not address algorithmic-complexity or long-runtime vulnerabilities. Those require bounded execution/isolation and dependency-specific remediation.

The repository already uses PdfReader(..., strict=True) and pins pypdf 6.15.0 on the protected base. Upstream's 2026 read_until_whitespace advisory identifies <6.15.0 as affected and 6.15.0 as the patched version; its malformed-startxref advisory affects <6.6.0 and notes strict mode as a workaround. Neither advisory justifies calling this exception-catch delta a DoS fix.

pypdf's own error documentation also warns that broken PDF files may cause exceptions beyond its documented exception classes. That supports a narrow external-library containment rationale: an ordinary Exception raised while constructing/inspecting an untrusted PDF is translated into the existing fixed 415 response rather than escaping the upload-validation boundary.

Deterministic contract

Focused regressions inject an ordinary third-party-style exception from PdfReader and require the fixed 415 Unsupported Media Type response without leaking parser internals. A complementary regression injects KeyboardInterrupt and requires it to propagate, proving that the boundary remains Exception, not BaseException.

The source comment was also repaired at the current head: it now describes the external-parser containment reason rather than claiming that an exception catch mitigates DoS/log exhaustion, and the now-unused PdfReadError import was removed. This does not constitute CPU/memory exhaustion evidence and must not be cited as such.

Scope repair

The generated branch also changed .jules/sentinel.md into a repository-wide rule and carried an unrelated uv.lock pypdf 6.15.0→6.17.0 update. Normal descendant c50387e6cf9fe59b35d570b65e86c6f4c509e75f restored both files to their exact protected-base blobs. No force push or destructive rebase was used.

Any separate dependency upgrade must have its own causal advisory/release evidence, lock regeneration and compatibility tests rather than hitchhiking on this parser-boundary PR.

Exact-head evidence

Fresh runs have now materialized for 643e3f407... and are all non-terminal: tests 34000513875, Security Scan 34000513869, SAST Semgrep 34000513925, CodeQL PR 34000513914, codeql 34000513888, clusterfuzzlite 34000513949, container-image 34000513851, scorecards 34000513948. Predecessor results do not transfer.

Keep Draft until terminal exact-head correctness/security/static-analysis evidence and current review. If the commercial requirement is hostile-PDF resource exhaustion resistance, follow with an isolation/time/CPU/RAM boundary and real/right-cleared hostile fixtures; do not use this exception translation as a substitute.

@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.

@coderabbitai

coderabbitai Bot commented Sep 5, 2026

Copy link
Copy Markdown

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@seonghobae
seonghobae marked this pull request as draft September 6, 2026 00:07
@seonghobae seonghobae changed the title 🛡️ Sentinel: [MEDIUM] PDF 파싱 DoS 취약점 완화 hardening(pdf): contain ordinary parser exceptions at validation boundary Sep 6, 2026
@seonghobae seonghobae added bug Something isn't working priority: medium Normal-priority or P2 work status: draft Draft pull request type: bug Defect or incorrect behavior labels Sep 7, 2026 — with ChatGPT Codex Connector
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working priority: medium Normal-priority or P2 work status: draft Draft pull request type: bug Defect or incorrect behavior

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant