Repository navigation
fix(epub): escape legacy text and navigation labels - #43
Conversation
Preserve README description line boundaries, ignore raw-block escape bypasses, and encode token-derived EPUB navigation labels. Add real-exporter synthetic fixtures and offline HTML/XML regressions with the existing pinned parser as a test dependency. No Polish reader, publication files or workflow changes.
Validation and review evidence — exact HEAD f3b8c0eBase: PASS: all five exact-head PR checks. Content/reader run 42285941941, job 128126659525, completed successfully at 2026-11-06T20:19:55Z. Its logs report 315/315 Node tests, 591 records with zero lint errors/warnings, and 232/232 browser cases across desktop/mobile Chromium, Firefox and WebKit, with retries disabled. Dependency review and both CodeQL analyses also succeeded. PASS locally: 315 Node tests, lint591/0/0, 116 desktop/mobile Chromium cases, and UNAVAILABLE locally: Firefox/WebKit launch, due to missing host libraries before test execution. No host package installation or project exclusion was performed; the successful CI run exercised both projects. NOT RUN: actual EPUB-reader application, full Anki/PDF application paths, public-site payload testing or deployment. A synthetic EPUB is built only in a disposable test directory, never from the Polish advice. Independent review statusThe first configured App review examined this exact base/head and returned REVIEW_INCOMPLETE, refusal The PR description was supplemented with labelled source excerpts pinned to the same HEAD. The single bounded follow-up returned APPROVE, and GitHub readback confirms native review 5806556472, APPROVED by External gate: PR #43 remains open and unmerged. All five exact-head checks pass; the repository's human-owned merge decision remains outstanding. No agent merge or Pages dispatch was performed. Existing alert statesAlerts2/3 are the confirmed legacy path repaired by this source change. Alerts1/4/5 retain their contextual dispositions and limitations; this PR neither fixes nor dismisses them. A PR-head analysis showing zero results is not proof that all inherited main-branch alerts are resolved. Main still has five open alerts; no dismissal, suppression or scan exclusion was performed. Human owns merge. This source-only fix requests no Pages deployment, exporter activation, identity/protection change or publication-scope expansion. |
There was a problem hiding this comment.
Independent snapshot review of 08d789cb6511...f3b8c0ea086e in mikomiel/HowToLiveBetter-PL by pi on codex-lb (gpt-6.1-sol).
Verdict: APPROVE
Reviewer output
Findings
No concrete reachable failure found in the supplied diff and exact-head source excerpts for the bounded alerts 2/3 repair.
- Output encoding:
tools/epub/build.mjs:95–97overrides Marked’s raw-blockescapedflag before delegating text rendering. Navigation and NCX now encode labels and attribute values at their output boundaries. - Entity semantics:
tools/epub/build.mjs:20–33derives labels from tokens, decodes supported XML references once in ordinary text, and keeps code-span/escape tokens separate. Subsequent encoding prevents decoded<,&, or quotes from becoming markup. - Line preservation:
tools/lib/book.mjs:48–52retains internal newlines rather than stripping tags and concatenating lines. The supplied EPUB consumers render the description as Markdown or XML-encode it for metadata. The supplied PDF consumer passes Markdown to Pandoc rather than a browser. - Scope and standards: The PR title follows Conventional Commits. The changes remain focused on the legacy repair, behavioural regression tests, a pinned development dependency, and documentation. No secret values or reader runtime dependency were apparent.
The tests exercise the real exporter with synthetic scratch inputs and inspect generated entries, rather than merely checking source patterns. Their HTML/XML assertions are useful regression coverage, but do not establish EPUB-reader compatibility.
Optional suggestion
Add a parsed-label regression covering backslash escapes, decimal character references, and an unsupported named entity. The helper explicitly distinguishes those semantics, while the current positive assertions primarily cover code spans, supported named references, and hexadecimal references.
Evidence and limitations
I read /tmp/github-review-j1lwdht2/candidate.diff completely and the supplied metadata and labelled source excerpts. I did not execute tests, install dependencies, reproduce CI, independently inspect the installed Marked package, or query CodeQL alert state.
The full checkout, repository instruction files, and unshown dependency/source files were unavailable. No further missing material blocks this bounded source assessment; conclusions about other exporter paths, full repository compliance, existing-alert closure, or EPUB-application behaviour would require additional evidence. This verdict is not merge or deployment authorization.
VERDICT: APPROVE
Evidence: not written. This review is evidence, not merge authorization.
Post-merge verification — 2026-11-07Verified by Pi (session 06d56be0-7d39-4fdb-8c61-5ea28b71f96f).
All 27 Pages publication files remain byte-identical to the deployed The first local CI watcher stopped on an HTTP 502. One read-only reconnection observed the original run succeed; the workflow was not rerun. This closes the source-fix/integration task, not the three remaining alert records or a general security certification. |
读者提议加非处方药使用指南。全书原来只有第 2 节提过尼古丁替代品是非处方药、第 28 节讲过处方药分类销售, 没有一条讲自己买来的药怎么吃才不出事。新节不写成用药手册,只收一个动作就能避开重后果的: 对乙酰氨基酚别吃重复(一日最多 2 克、用药期间不喝酒)、孩子退烧不用阿司匹林尼美舒利安乃近、 布洛芬这类药的胃出血高危人群、2 岁以下不自己喂复方感冒药、怀孕 20 周后不自己吃布洛芬这类药、 奥美拉唑自己吃最多 7 天、感冒不要抗生素、腹泻先补液且 5 岁以下不给止泻药、止痛药过度使用的天数门槛。 来源逐字核对:药监局 2020 年第 15、34 号,2021 年第 57 号,2022 年第 68 号公告及附件,国食药监安〔2011〕209 号, 21 CFR 201.326,FDA 2020 安全警示,WHO 腹泻手册,ICHD-3,Europe PMC 取五篇文献摘要。核对过程与没写进去的三项 记在 docs/核实记录/34-家里的常备药别吃出事.md。 统计已同步:615 → 624 条,A 415 → 418,链接 1304 → 1321,引用 578 → 585 处。
Preserve README description line boundaries, ignore raw-block escape bypasses, and encode token-derived EPUB navigation labels. Add real-exporter synthetic fixtures and offline HTML/XML regressions with the existing pinned parser as a test dependency. No Polish reader, publication files or workflow changes.
Source-only legacy EPUB security fix
Fixes the confirmed latent paths behind CodeQL alerts2/3: preserve README description lines, escape text regardless of Marked raw-block state, derive labels from tokens and encode navigation/NCX text and attributes. Real exporter tests build only synthetic scratch EPUBs and parse their entries as HTML/XML. Marked18.0.13 is the existing exporter dependency, added root dev-only; no reader runtime dependency.
Base08d789cb6511a9ad05c54d89d8d66ddece9d8465; tested HEADf3b8c0ea086e2cba2bc3329c6a0fb9b209c6090a, treebc08b7d5a067d00c22fc31a4e832fff0596d92b6. PASS local315 Node tests/lint591 zero errors/116 Chromium;3 rejected scratch mutations, byte restoration. PASS exact-head CI5/5,315 Node/232 browsers across all4 projects, run42285941941; no skipped browser projects. Local Firefox/WebKit launch unavailable for host libraries; CI exercised them. All27 publication files/workflows/allowlist/instructions/licences unchanged. No source claim of EPUB-app compatibility; full Anki/PDF and public payload tests NOT RUN.
Alerts1/4/5 are not fixed/dismissed: Anki sorting/checksum is not escaped display HTML; PDF comment preprocessing feeds Pandoc/Typst not a browser; selfcheck extracts trusted fixture code, not sanitization. All5 alerts remain open on main; PR-only zero new results is not a rescan proving all existing alerts resolved.
Human owns merge; no merge/deployment requested or performed. Rollback before merge: close PR. After merge: reviewed revert, no history rewrite. Full per-alert triage and validation details remain in PR comments/local handoff.
Exact-head source context for independent review
The first diff-only review was REVIEW_INCOMPLETE because unchanged producer/consumer code was absent. This supplement is public repository source at the exact tested HEAD, not reviewer instructions or execution evidence. File/range boundaries are shown; the exact HEAD pins the source. Generated prose/metadata boilerplate is omitted only where not involved in the changed flow. No source bytes were changed to obtain review.
tools/epub/build.mjs:1–50
tools/epub/build.mjs:69–180
tools/epub/build.mjs:184–202
tools/lib/book.mjs:7–18
tools/lib/book.mjs:37–59
tools/pdf/build.mjs:19–29
tools/pdf/build.mjs:63–95
tools/anki/build.mjs:61–63
tools/anki/build.mjs:82–89
tools/anki/build.mjs:187–196
tools/check-selfcheck.mjs:3–11
tools/check-selfcheck.mjs:26–35
playwright.config.mjs:1–28
.github/workflows/book.yml:1–44
Marked18.0.13 Renderer.ts, installed integrity-checked package source map
Marked18.0.13 Tokenizer.ts, installed integrity-checked package source map