Skip to content

Fix embedded HEIF media handling; land section 2-4 hardening - #19

Merged
elkaix merged 3 commits into
mainfrom
fix/embedded-heif
Aug 18, 2026
Merged

Fix embedded HEIF media handling; land section 2-4 hardening#19
elkaix merged 3 commits into
mainfrom
fix/embedded-heif

Conversation

@elkaix

@elkaix elkaix commented Aug 18, 2026

Copy link
Copy Markdown
Member

What

  • e30615a fix(container): inspect and strip embedded HEIF media — closes the remaining member of the detect_format contract defect class: all five embedded-media branches (HTML data: URIs, OOXML zip media, EPUB media) matched "heic", which detect_format never returns. Embedded HEIC in docx/odt/epub/html kept its C2PA/XMP markers through a clean. Also widens the strip-success gates beyond the drop verb to heif_meta's in-place neutralized/zeroed vocabulary (shared _media_strip_succeeded, no-op case still excluded by byte equality).
  • a3cfde4 fix: server stability and bounded-parser hardening — lands the in-flight section 2-4 hardening work that was unstaged in the working tree: /detect graceful unknown handling + OpenAPI schema corrections, bounded PNG zTXt/iTXt decompression (decompression-bomb guard, fail-closed), partial-read/error-path handling across scorers and detectors, curl timeouts in compose-check, plus their test suites (4 new files, 5 extended).

Verification

  • Full suite green on the combined tree (27.4s), ruff clean on every changed file.
  • New regression test: docx embedding HEIC-with-XMP is now inspected (finding names the media part) and cleaned (post-clean inspect reports no AI metadata).
  • GitNexus impact on _scrub_ooxml_zip: LOW, 6 impacted symbols, same clean_container blast radius as before.

elkaix added 2 commits August 18, 2026 18:45
The same detect_format contract gap as the top-level router: HEIF-family
bytes are reported as "heif", never "heic", but all five embedded-media
branches (HTML data: URIs, OOXML zip media, EPUB media) matched "heic" —
an embedded HEIC image in a docx/odt/epub was never inspected nor
stripped, and its C2PA/XMP markers survived a "cleaned" document.

The strip gates also required the action verb "drop", while heif_meta
neutralizes in place ("neutralized"/"zeroed") to preserve offsets, so
even a routed HEIF would never have been written back. Gates now share
_media_strip_succeeded, which accepts both vocabularies and still rejects
the no-op case (unchanged bytes).
Concurrent hardening pass (master-list sections 2-4), verified green by
the full suite:

- server: /detect answers ok+kind=unknown with an explanatory report
  instead of falling through to a failed tempfile workflow; OpenAPI
  schemas admit the "unknown" kind and the detect report field
- image_meta: bound PNG zTXt/iTXt decompression (MAX_PNG_TEXT_BYTES,
  fail closed on bomb/corrupt streams) via _zlib_decompress_bounded
- inspect_file, score_synthid, score_stylometry, text_detectors,
  synthid_score_server: partial-read and error-path handling
- rewrite_text, clean-user-facing-text: alias and validation fixes
- compose-check: curl connect/total timeouts
- tests: new test_stability_server, test_image_meta_bomb_and_notes,
  test_inspect_file_partial, test_lightweight_clean_text_aliases plus
  extensions to binary-guard, markllm-detect, rewrite, stylometry, and
  text-detector suites
@elkaix
elkaix enabled auto-merge (squash) August 18, 2026 22:45
@coderabbitai

coderabbitai Bot commented Aug 18, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@elkaix, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 31 minutes

Limit details: You’ve used all 3 included reviews currently available.

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits within each organization.

For paid Pro and Pro+ reviews, CodeRabbit uses a developer's included PR review attempts over the past 7 days to set the current hourly allowance. At typical activity levels, the full plan allowance applies. Higher sustained activity can lower the allowance until earlier attempts leave the 7-day window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 1d3d0175-87e7-42be-ba72-f8d6befe7fc9

📥 Commits

Reviewing files that changed from the base of the PR and between a4672ef and bc33e0d.

📒 Files selected for processing (23)
  • compose-check.sh
  • skills/clean-user-facing-text/scripts/clean_text.py
  • skills/remove-ai-marks/scripts/clean_file.py
  • skills/remove-ai-marks/scripts/container_meta.py
  • skills/remove-ai-marks/scripts/detect_text_watermark.py
  • skills/remove-ai-marks/scripts/image_meta.py
  • skills/remove-ai-marks/scripts/inspect_file.py
  • skills/remove-ai-marks/scripts/rewrite_text.py
  • skills/remove-ai-marks/scripts/score_stylometry.py
  • skills/remove-ai-marks/scripts/score_synthid.py
  • skills/remove-ai-marks/scripts/server.py
  • skills/remove-ai-marks/scripts/synthid_score_server.py
  • skills/remove-ai-marks/scripts/text_detectors.py
  • tests/test_binary_guard.py
  • tests/test_image_meta_bomb_and_notes.py
  • tests/test_inspect_file_partial.py
  • tests/test_lightweight_clean_text_aliases.py
  • tests/test_markllm_detect.py
  • tests/test_ooxml_xlsx_pptx.py
  • tests/test_rewrite_text.py
  • tests/test_stability_server.py
  • tests/test_stylometry.py
  • tests/test_text_detectors.py

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

subprocess_preexec_fn is None off POSIX (common.py), so the MarkLLM
adapter correctly omits --rlimit-as on Windows; the boundary assertion
only makes sense where resource limits exist.
@elkaix
elkaix merged commit 33bc5dd into main Aug 18, 2026
9 checks passed
@elkaix
elkaix deleted the fix/embedded-heif branch August 18, 2026 22:50
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