Anonymous - 2026-05-19

Originally posted by: coderabbitai[bot]

Review Change Stack

Walkthrough

This PR adds multiple safety and behavior changes across the codebase: it enforces path containment via a new assert_within_root and EnsureFolder.safe_root (wired through Transform.transform_markdown/transform_epub), normalizes AssetHub paths with Path.resolve(), tightens XML parsing and atomic save behavior, implements rolling-hash n-gram repetition detection, caps computed DPI, validates rectangle coordinates, updates LLM prompts and strict JSON parsing, allows runtime LLM key overrides, tightens per-request logfile permissions, and pins CI action versions.

Sequence Diagram(s)

sequenceDiagram
  participant Client
  participant Transform
  participant EnsureFolder
  participant assert_within_root
  Client->>Transform: transform_markdown(..., safe_root)
  Transform->>EnsureFolder: EnsureFolder(path=..., safe_root=to_path(safe_root))
  Client->>EnsureFolder: __enter__()
  EnsureFolder->>assert_within_root: assert_within_root(path, safe_root)
  assert_within_root->>assert_within_root: resolve & check containment
  alt contained
    assert_within_root-->>EnsureFolder: validation passes
    EnsureFolder-->>Transform: context ready
  else not contained
    assert_within_root-->>EnsureFolder: raise ValueError
    EnsureFolder-->>Transform: propagate error
  end
🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed) | Check name | Status | Explanation | | :------------------------: | :------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | Title check | ✅ Passed | The title follows the required format with type and subject, and is closely related to the main security improvement: adding a safe_root path traversal guard. | | Linked Issues check | ✅ Passed | Check skipped because no linked issues were found for this pull request. | | Out of Scope Changes check | ✅ Passed | Check skipped because no linked issues were found for this pull request. | | Description check | ✅ Passed | The pull request description comprehensively relates to the changeset, detailing security hardening across multiple severity levels with clear file-by-file mapping. |
✏️ Tip: You can configure your own custom pre-merge checks in the settings.
✨ Finishing Touches
✨ Simplify code - [ ] Create PR with simplified code

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 - [X](https://twitter.com/intent/tweet?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A&url=https%3A//coderabbit.ai) - [Mastodon](https://mastodon.social/share?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A%20https%3A%2F%2Fcoderabbit.ai) - [Reddit](https://www.reddit.com/submit?title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&text=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code.%20Check%20it%20out%3A%20https%3A//coderabbit.ai) - [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcoderabbit.ai&mini=true&title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&summary=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code)

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