Skip to content

fix(core): sanitize planted footnote content in Bible HTML - #486

Merged
cameronapak merged 2 commits into
feat/after-thanksgiving-mergefrom
devin/1795101143-sanitize-footnote-attrs
Nov 24, 2026
Merged

cameronapak merged 2 commits into
feat/after-thanksgiving-mergefrom
devin/1795101143-sanitize-footnote-attrs

Conversation

@cameronapak

@cameronapak cameronapak commented Nov 19, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Fixes stored XSS via footnote markup planted in passage HTML. The sanitizer kept any data-* attribute verbatim, so an input like

<span data-verse-footnote="1" data-verse-footnote-content="&lt;img src=x onerror=alert(1)&gt;"></span>

survived transformBibleHtml, and FootnoteContent in verse.tsx injected the value with dangerouslySetInnerHTML when the reader tapped the footnote.

Changes in packages/core/src/bible-html-transformer.ts:

  • sanitizeBibleHtmlTree(root, mode) (was sanitizeBibleHtmlDocument(doc)) now also sanitizes every data-verse-footnote-content value it keeps. The value is parsed into an inert <template> in the current document, run through the same allowlist in 'footnote' mode, and serialized again. In 'footnote' mode, nested data-verse-footnote* and data-yv-transformed attributes are dropped too. The sanitizer already ran before the short-circuit for data-yv-transformed on main, so already-transformed passages (as getPassage returns them) get this cleanup as well.
  • Generated footnotes use the same step: data-verse-footnote-content = sanitizeFootnoteHtml(fn.innerHTML). This keeps transform(transform(x)) === transform(x) even when a note contains nested footnote attributes.
  • Tags are matched by localName, and any element outside the HTML namespace is dropped with its text. Before, SVG/MathML descendants such as <svg><script> were unwrapped, not dropped, because their tagName is lowercase.
  • Input can no longer carry SDK-internal attributes: data-footnote-key and every data-yv-* except data-yv-transformed are removed. Other data-* attributes such as data-slot are still kept, because consumers rely on them.
  • The JSDoc on transformBibleHtml and TransformedBibleHtml now documents this sanitization contract.

In verse.tsx, FootnoteContentProps now says that notes and verseHtml must be sanitized HTML. The old biome-ignore … is safe comments were not accurate, so they are replaced. Sanitizing again inside FootnoteContent is left for a follow-up.

Tests:

  • Two core workflow tests. (a) Planted content in raw and already-transformed input, plus removal of reserved attributes. (b) A bypass matrix (SVG/MathML, mixed-case and entity-encoded on*, double-encoded markup, javascript:/data: URLs) with a re-transform round trip for each case and for genuine nested footnotes. They check exact data-verse-footnote-content values.
  • A UI test opens the footnote dialog by role and checks that it renders no img or onerror. It fails on main.

Link to Devin session: https://app.devin.ai/sessions/772837b97b7042cba9c19e249c2b2baf
Open in Devin Desktop: https://app.devin.ai/desktop/session/772837b97b7042cba9c19e249c2b2baf?variant=devin
Requested by: @cameronapak

RetriggerView in GreptileConfidence Score: 5/5

The PR appears safe to merge; no new blocking issues were found.

Summary

This PR cleans footnote HTML before readers display it and strengthens checks on passage markup.

  • Footnote notes are cleaned before the reader displays them.

cameronapak deferred cleaning HTML inside FootnoteContent itself because that would need a new public core export; its caller requirements are now documented.

Tests were reviewed but not run. No new actionable issues found.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  A[Passage HTML] --> B[Clean passage tree]
  B --> C[Parse footnote HTML in inert template]
  C --> D[Clean footnote tags and attributes]
  D --> E[Store cleaned note in HTML attribute]
  E --> F[Reader opens footnote]
  F --> G[Render cleaned note]
Loading

Reviews (2) · Last reviewed commit: "fix(core): address review on footnote sa..." · Reviewed by Greptile

Co-Authored-By: Cameron Pak <cameronandrewpak@gmail.com>
@changeset-bot

changeset-bot Bot commented Nov 19, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 57569dd

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 4 packages
Name Type
@youversion/platform-core Patch
@youversion/platform-react-ui Patch
@youversion/platform-react-hooks Patch
vite-react Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@cameronapak cameronapak self-assigned this Nov 19, 2026
@devin-ai-integration

Copy link
Copy Markdown
Contributor

I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".

  • Disable automatic comment, CI, and merge conflict monitoring

@devin-ai-integration devin-ai-integration 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.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Devin Review

@camrun91 camrun91 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thank you for this fix. The sanitizer is allowlist-based, and it blocked every XSS bypass that we tried (encoded and double-encoded handlers, javascript: and data: URLs, SVG/MathML, mXSS, and nested footnotes). The new tests fail when the fix is reverted. CI, lint, typecheck, and the full test suite pass.

Some changes are necessary before approval. Most of them are inline. Two items are not in the diff, so they are here:

Change needed before approval: packages/ui/src/components/verse.tsx:98 and :112
The public FootnoteContent component injects notes and verseHtml with dangerouslySetInnerHTML, and it does not sanitize them. Consumers who render FootnoteContent directly do not get the protection from this PR. The biome-ignore … comes from our YouVersion APIs and is safe comments are also not correct: the repo uses oxlint, and this PR shows that API content is not always safe. Rule: docs/review-guidelines.md, Security ("no dangerouslySetInnerHTML without sanitization").
Fix: replace the stale comments with accurate ones. Then do one of these: sanitize notes and verseHtml with the core allowlist, or add a JSDoc warning on FootnoteContentProps that they must be sanitized HTML and open a follow-up issue.

Change needed before approval: tests (also see the inline comments)
docs/testing.md prefers fewer, longer workflow tests, and it says to bend the cases you edit toward that style. Please merge the new core cases into one or two workflow tests: (a) planted content in raw and transformed input, plus reserved-attribute removal; (b) a bypass matrix plus an idempotency round trip. Add cases for SVG/MathML, uppercase or entity-encoded on* handlers, and javascript:/data: URLs. Assert exact data-verse-footnote-content values.

Nits

  • Nit: the PR description says sanitizing "now runs before the short-circuit". On main, it already did. This PR adds the footnote step inside that call. Please update the description.
  • Nit (existing issue, follow-up is OK): ALLOWED_ATTRS keeps all class tokens. A planted class="yv:fixed yv:inset-0 yv:z-50" stays in footnote content and can show a false overlay in the popover. Fix: remove yv: class tokens from input, or allow only USFM class names.
  • Nit (existing issue, follow-up is OK): verse.tsx:157 puts the footnote key into querySelectorAll(.yv-v[v="${verseNum}"]) without escaping. A key that contains "] makes the layout effect throw. Fix: use CSS.escape(verseNum), or allow only ^\d+$|^intro-\d+$ keys in the sanitizer.

anchor.setAttribute('data-verse-footnote', key);
anchor.setAttribute('data-verse-footnote-content', fn.innerHTML);
anchor.setAttribute(FOOTNOTE_ANCHOR_ATTR, key);
anchor.setAttribute(FOOTNOTE_CONTENT_ATTR, fn.innerHTML);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Change needed before approval: a second transform gives a different result. On the first pass, fn.innerHTML keeps nested data-verse-footnote, data-verse-footnote-content, and data-yv-transformed attributes. On the second pass, footnote mode removes them, so transform(transform(x)) !== transform(x). Example: the note <span class="ft"><span data-verse-footnote="9">n</span></span> loses the nested attribute on the second pass. The PR description says a second transform gives the same result (docs/review-guidelines.md, Functional Verification).
Fix: use sanitizeFootnoteHtml(fn.innerHTML, options) here, or remove those attributes from the children of fn first. Add this input to the re-transform test at line 492.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Good catch, fixed in 57569dd. Generated anchors now use sanitizeFootnoteHtml(fn.innerHTML, doc). Your example input (<span class="ft">A <em>note</em> <span data-verse-footnote="9">n</span></span>) is now in the re-transform test, which expects second.html === first.html. Each case in the bypass matrix also goes through a round trip. The test fails if this line goes back to fn.innerHTML.

const doc = options.parseHtml(html);

sanitizeBibleHtmlDocument(doc);
sanitizeBibleHtmlDocument(doc, options);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Change needed before approval: transformBibleHtml is public, and its behavior changed. It now sanitizes input footnote content as HTML, and it removes data-footnote-key and all data-yv-* attributes except data-yv-transformed. The JSDoc above and the data-verse-footnote-content doc on TransformedBibleHtml do not say this. getPassageDisplay consumers depend on this contract. Rule: docs/review-guidelines.md ("Are API changes documented with proper TypeScript JSDoc?").
Fix: add a short "Sanitization" paragraph to both doc blocks. Say that footnote content is sanitized and safe to inject, and list the data-* names that are removed.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Done in 57569dd. transformBibleHtml and TransformedBibleHtml now each have a "Sanitization" paragraph. It says that the output and data-verse-footnote-content are safe to inject, and it lists the removed attributes: data-footnote-key, and data-yv-* except data-yv-transformed. Footnote content additionally drops data-verse-footnote* and data-yv-transformed.


const footnoteContent = el.getAttribute(FOOTNOTE_CONTENT_ATTR);
if (footnoteContent !== null) {
el.setAttribute(FOOTNOTE_CONTENT_ATTR, sanitizeFootnoteHtml(footnoteContent, options));

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Change needed before approval: footnote content now goes through DROP_ENTIRELY_TAGS, but that check does not work for SVG and MathML. Elements outside the HTML namespace have lowercase tagName values, so 'SVG', 'MATH', 'SCRIPT', and 'STYLE' do not match there. The elements are unwrapped, not dropped. Result: <svg><script>alert(1)</script></svg> becomes the visible text "alert(1)". This is not script execution, but the drop rule has no effect. Rule: OWASP HTML Sanitization guidance (an allowlist must be case-correct and namespace-correct), and docs/review-guidelines.md, Security.
Fix: remove all elements whose namespaceURI is not http://www.w3.org/1999/xhtml, and compare with el.localName. Add a test that makes sure no text remains from this payload.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Fixed in 57569dd. Tag checks now use el.localName against lowercase sets, and any element whose namespaceURI is not XHTML is removed together with its content. <svg><script>alert(1)</script></svg>Safe now gives exactly Safe, and so does a MathML payload. Both cases are in the bypass matrix. The matrix fails if the check goes back to tagName.

// Footnote content is rendered as HTML by consumers, so an attribute value
// that arrived in input must pass the same allowlist as passage markup.
function sanitizeFootnoteHtml(html: string, options: TransformBibleHtmlOptions): string {
const doc = options.parseHtml(html);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Change needed before approval: each footnote creates a new full document here. With the server adapter, that is a new JSDOM for each footnote. Verse.Html transforms getPassage output again on each html change, so this path is common. On a 150-footnote chapter, a re-transform went from about 12 ms to about 590 ms with the server adapter, and from about 10 ms to about 118 ms with DOMParser in jsdom. Rule: docs/review-guidelines.md, Performance.
Fix: parse into an inert template in the current document, for example const tpl = doc.createElement('template'); tpl.innerHTML = html;. Then sanitize tpl.content. To do this, let sanitizeBibleHtmlDocument take a root ParentNode.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Done in 57569dd. sanitizeFootnoteHtml now parses into an inert <template> created in the element's ownerDocument and serializes with template.innerHTML. The sanitizer now takes a root ParentNode (sanitizeBibleHtmlTree), so it no longer calls parseHtml/serializeHtml per footnote and no longer creates a JSDOM per footnote with the server adapter.

if (!name.startsWith('data-')) return false;
if (name === FOOTNOTE_KEY_ATTR) return false;
if (name.startsWith('data-yv-') && name !== TRANSFORMED_ATTR) return false;
if (mode === 'footnote' && (FOOTNOTE_DATA_ATTRS.has(name) || name === TRANSFORMED_ATTR)) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Change needed before approval: no test covers removing data-yv-transformed in footnote mode. When we deleted this check, all 50 tests still passed. Please add a test that fails without it (docs/testing.md).

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Done in 57569dd. The planted note in the first workflow test has data-yv-transformed="" on a nested span, and the test expects the exact value <span class="ft" data-slot="n">Note</span>…. If I remove || name === TRANSFORMED_ATTR, that test fails.

const result = transformBibleHtml(html, createAdapters());

expect(result.html).not.toContain('onerror');
expect(result.html).not.toContain('img');

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Change needed before approval: not.toContain('img') is a fragile check. Any Scripture text or class name that contains "img" makes it fail. Also, these absence checks still pass if the anchor or its text disappears. Please parse the result and assert the exact data-verse-footnote-content value, as the next test does (docs/testing.md, "Assert roles and behavior").

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Done in 57569dd. The not.toContain checks are gone. Both new workflow tests parse the output and assert the exact data-verse-footnote-content value. For example, the raw planted payload must equal 'Planted', so the test fails if the anchor or its text disappears.

await userEvent.click(footnoteButton);

await waitFor(() => {
const popover = document.body.querySelector('[role="dialog"]');

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Change needed before approval: please find the dialog and the button by role: await screen.findByRole('dialog'), screen.findByRole('button', …), and within(dialog) for the img check. docs/testing.md says to assert roles and behavior, and to bend edited cases toward that style.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Done in 57569dd. The test now uses screen.findByRole('button'), screen.findByRole('dialog'), and within(dialog).getByText('Planted'), and then checks that the dialog has no img or onerror. It still fails when the core fix is reverted.

return true;
}

type SanitizeMode = 'passage' | 'footnote';

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Nit: type SanitizeMode is declared after isAllowedDataAttr, which uses it. Please move the type above the function, so it is easier to read.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Done in 57569dd: SanitizeMode is now declared above isAllowedDataAttr.


// SDK-internal names a passage must not be able to plant. The transformed
// marker stays so re-transforming output is idempotent; footnote content is
// re-sanitized as HTML instead of trusted.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Nit: this comment tells why reserved attributes are blocked. Please also tell why other data-* attributes stay. The tests treat that as part of the contract.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Done in 57569dd. The comment now also explains that other data-* attributes stay because consumers style and query them (for example data-slot) and they carry no behavior.

Comment thread .changeset/safe-footnote-content.md Outdated
"@youversion/platform-core": patch
---

Sanitize `data-verse-footnote-content` found in Bible HTML input and strip SDK-internal data attributes, so planted footnote markup can no longer run script in the Bible reader.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Nit: please name the attributes that are now removed (data-footnote-key, and data-yv-* except data-yv-transformed), because some consumers can use them. CONTRIBUTING.md examples also use the past tense ("Sanitized…").

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Done in 57569dd. The changeset is now in the past tense and names data-footnote-key and data-yv-* (except data-yv-transformed). It also notes that SVG/MathML content is now dropped and that the FootnoteContentProps doc changed. I added a UI patch entry for that doc change.

Sanitize footnote content in an inert template, drop non-HTML-namespace
elements, sanitize generated footnote content for idempotency, document the
sanitization contract, and consolidate tests.

Co-Authored-By: Cameron Pak <cameronandrewpak@gmail.com>
@cameronapak

Copy link
Copy Markdown
Collaborator Author

Thanks for the review. Replies to the summary items (57569dd):

verse.tsx:98 / :112: I replaced the stale biome-ignore … is safe comments. FootnoteContentProps now has a JSDoc security note saying that notes and verseHtml are injected without further sanitization and must come from transformBibleHtml or an equivalent allowlist sanitizer. I couldn't open the follow-up issue because this session has no permission to create issues. The text is below, for anyone with access to file it:

Harden Bible reader footnote rendering (follow-ups from #486)

  1. Sanitize notes/verseHtml inside FootnoteContent (export the core allowlist sanitizer and run it before dangerouslySetInnerHTML).
  2. Strip yv: class tokens from passage input, or allow only USFM class names, so planted yv:fixed yv:inset-0 yv:z-50 cannot draw a fake overlay.
  3. Use CSS.escape(verseNum) in verse.tsx:157 (or allow only ^\d+$|^intro-\d+$ keys) so a key containing "] cannot make the layout effect throw.

Tests: I merged the new core cases into two workflow tests. (a) Planted content in raw and transformed input, plus removal of reserved attributes. (b) A bypass matrix (SVG, MathML, mixed-case and entity-encoded on*, double-encoded markup, javascript:/data: URLs) with a re-transform round trip for each case, plus genuine nested footnotes. They assert exact data-verse-footnote-content values.

PR description nit: Fixed. It now says that the sanitizer already ran before the short-circuit on main, and that this PR adds the footnote step inside it.

Class-token and CSS.escape nits: These are in the follow-up list above and not in this PR.

@bmanquen bmanquen left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

praise: This closes the stored XSS in footnote content. Two independent reviews (Claude Opus 5.5 and GPT-6 Astra) ran 14 and 29 payloads against 57569dd, in jsdom and in real Chromium. Nothing got through. The payloads covered img/onerror, mutation XSS (noscript, template, style, svg, math/mglyph), attribute-name casing, unquoted values, comment tricks, double-encoded entities, nested anchors, and a planted data-yv-transformed. On main, a planted <img src=x onerror=alert(1)> does run, and the new tests fail there.

note: Legitimate footnotes keep their content: fr/fq/ft, <i>, <sup>, <br>, entities, &nbsp;, RTL text, and table cells. Transforming twice gives identical output. Core tests: 354 passed, 2 skipped. UI tests: 623 passed. Typecheck, oxlint, and prettier are clean. Re-transforming 150 footnotes takes 22 ms in jsdom, against 10 ms on main.

thought (non-blocking): jsdom writes a raw < inside footnote-content attributes, while Chromium writes &lt;. The HTML means the same thing in both, so this only matters if something ever compares or hashes the transformed bytes.

Not checked: footnote shapes from the live API, Storybook journeys, speed in Safari or Firefox, and size-limit changes.

if (DROP_ENTIRELY_TAGS.has(tag)) {
// SVG and MathML elements keep lowercase tag names and their own parsing
// rules, so anything outside the HTML namespace is dropped with its text.
if (el.namespaceURI !== HTML_NAMESPACE || DROP_ENTIRELY_TAGS.has(el.localName)) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

praise: Checking the namespace closes the SVG/MathML mutation-XSS route. The old uppercase tag-name check missed those elements, because they keep lowercase tag names. <svg><style><img onerror> and <math><mtext><img onerror> both come out empty now.

}

// Footnote content is rendered as HTML by consumers, so it must pass the same
// allowlist as passage markup. An inert template avoids a full parse per note.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

praise: Parsing each note in an inert <template> fixed the speed problem. The earlier head did a full document parse per note and took 226 ms to re-transform 150 footnotes; now it takes 22 ms. It also means a <body onload> inside a note can't attach to anything.

anchor.setAttribute('data-verse-footnote', key);
anchor.setAttribute('data-verse-footnote-content', fn.innerHTML);
anchor.setAttribute(FOOTNOTE_ANCHOR_ATTR, key);
anchor.setAttribute(FOOTNOTE_CONTENT_ATTR, sanitizeFootnoteHtml(fn.innerHTML, doc));

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

note: Cleaning genuine footnote HTML here also fixes a case where the output changed on each transform. A planted anchor inside a real yv-n f footnote used to survive the first transform and get removed by the second. Now two transforms give identical output in every probe case.

*
* Security: `notes` and `verseHtml` are injected as HTML without further
* sanitization. Pass only output from `transformBibleHtml` (or HTML that went
* through an equivalent allowlist sanitizer); never pass raw API or user HTML.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

issue (non-blocking): The follow-up to this doc comment should also cover the footnote key. getVerseHtmlFromDom (L164) puts data-verse-footnote into `.yv-v[v="${verseNum}"]` without escaping. The key has to survive sanitizing, so a planted value reaches the selector. 1"] <img [x=" makes querySelectorAll throw, which breaks footnote collection for that render. 1"] .yv-v, [v=" makes the popover show the wrong verse. It can't run script, and the same bug exists on main. Fix it with CSS.escape(verseNum) or a /^[\w-]+$/ check where the key is read at L396.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Agreed. The follow-up will cover the footnote key as well: check it against /^[\w-]+$/ where it is read (L396), and CSS.escape it in getVerseHtmlFromDom. That way a planted key can't make querySelectorAll throw or point the popover at another verse. I'm keeping it out of this PR because the same bug exists on main and can't run script.

@cameronapak
cameronapak changed the base branch from main to feat/after-thanksgiving-merge November 24, 2026 16:23
@cameronapak
cameronapak merged commit c913c4e into feat/after-thanksgiving-merge Nov 24, 2026
41 of 43 checks passed
@cameronapak
cameronapak deleted the devin/1795101143-sanitize-footnote-attrs branch November 24, 2026 17:05
cameronapak added a commit that referenced this pull request Nov 30, 2026
* chore: sync react localization from platform-localization (#478)

chore: sync react localization

Co-authored-by: camrun91 <16566029+camrun91@users.noreply.github.com>

* fix(core): sanitize planted footnote content in Bible HTML (#486)

* fix(core): sanitize planted footnote content in Bible HTML

Co-Authored-By: Cameron Pak <cameronandrewpak@gmail.com>

* fix(core): address review on footnote sanitization

Sanitize footnote content in an inert template, drop non-HTML-namespace
elements, sanitize generated footnote content for idempotency, document the
sanitization contract, and consolidate tests.

Co-Authored-By: Cameron Pak <cameronandrewpak@gmail.com>

---------

Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* refactor(ui): organize Bible reader modules (#489)

* refactor(ui): organize Bible reader modules (YPE-6808)

* refactor(ui): extract reader settings lifecycle and toolbar (#495)

* refactor(ui): extract reader settings lifecycle and toolbar (YPE-6815)

* fix(ui): address reader settings review feedback

* feat(ui): re-export passage and versions hooks (#500)

* feat(ui): re-export passage and versions hooks

Amp-Thread-ID: https://ampcode.com/threads/T-01a20e73-4446-71f0-950a-3054df5492c7

* chore(ci): remove packed UI consumer check

* docs(ui): clarify shared provider import guidance

Amp-Thread-ID: https://ampcode.com/threads/T-01a20e73-4446-71f0-950a-3054df5492c7

* docs: address hook re-export review nits

Amp-Thread-ID: https://ampcode.com/threads/T-01a20e73-4446-71f0-950a-3054df5492c7

---------

Co-authored-by: Amp <amp@ampcode.com>

* fix(ui): preserve focus at high zoom (#485)

* fix(ui): preserve focus at high zoom

* fix(ui): harden zoom focus coverage

* refactor(ui): simplify zoom focus handling

* test(ui): cover zoom focus behavior

* test(ui): focus reader close before asserting

* fix(ui): address zoom review findings

* test(ui): compare pointer focus styles

* test(ui): respect focus-visible heuristics

* test(ui): use native focus traversal

* fix(ui): scope focus preservation

* fix(ui): preserve sign-in focus contrast

* test(ui): await close focus transition

* refactor(ui): centralize picker scroll geometry

* fix(ui): keep picker focus visible in constrained panels

* fix(ui): preserve the expanded book trigger in compact panels

* test(ui): reach reader settings close with native keys

* fix(ui): honor reduced motion in chapter reveal

* fix(ui): address focus and scroll review feedback

* fix(ui): reveal focused chapters in Firefox

Keep focused book triggers fully visible within the built-in accordion on Linux Firefox. Wait for the settings dialog opening animation before asserting visibility in WebKit.

* test(ui): query the current settings dialog while opening

* feat(core): add Content Library video APIs (YPE-6573) (#488)

* feat(core): add content library video APIs

* refactor(core): simplify video schema ownership

* fix(core): harden content library contracts

* fix(core): validate video response boundaries

* fix(core): distinguish no-content responses

* fix(core): scope no-content status handling

* fix(core): distinguish empty response bodies

* test(core): isolate Content Library smoke coverage

* feat(core): keep content library APIs compatible with v3

* fix(core): align content library rollout contracts (YPE-6573)

* fix(core): accept empty video filters and trim search bundles (YPE-6573)

* fix(core): address content library review feedback (YPE-6573)

* docs(core): clarify video APIs and live validation (YPE-6573)

* fix(core): use stable Content Library routes (YPE-6573)

* feat(core): add Notes API client (#497)

* feat(core): add Notes API client

Amp-Thread-ID: https://ampcode.com/threads/T-01a2095d-25a9-72c5-a0fb-baa79c35e05a

* fix(core): address Notes API review feedback

Amp-Thread-ID: https://ampcode.com/threads/T-01a2095d-25a9-72c5-a0fb-baa79c35e05a

* fix(core): normalize Notes write colors

* fix(core): address Notes API contract review

* fix(core): enforce Notes version filters and tolerate malformed passages

* fix(core): isolate malformed Notes list records

Amp-Thread-ID: https://ampcode.com/threads/T-01a2095d-25a9-72c5-a0fb-baa79c35e05a

* chore: refresh combined core bundle budget

Amp-Thread-ID: https://ampcode.com/threads/T-01a2095d-25a9-72c5-a0fb-baa79c35e05a

---------

Co-authored-by: Amp <amp@ampcode.com>

* fix(ui): preserve newer selection after native Share (YPE-6812) (#494)

* fix(ui): label reader sign-in menu trigger (YPE-6810) (#492)

* fix(ui): label reader sign-in menu trigger (YPE-6810)

* test(ui): capture Linux WebKit dialog visibility failures

* test(ui): stress WebKit visibility diagnostics

* test(ui): check settings visibility after keyboard focus

Assert dialog opening state after Enter and visibility on the Close button after native Tab, alongside the focus-ring checks. Remove temporary WebKit diagnostics and repeated CI groups.

* fix(ui): handle reader clipboard failures (#490)

* fix(ui): handle reader clipboard failures (YPE-6809)

* fix(ui): report clipboard failures and retry failed shares

* fix(ui): keep clipboard warnings visible while scrolling

* fix(ui): ignore stale clipboard action results

* fix(ui): support Bible reader interactions in iframes (YPE-6410) (#491)

* fix(ui): retain iframe verse selection and anchors (YPE-6410)

* test(ui): cover iframe highlight painting and reset

* fix(ui): complete iframe reader text and focus handling

* fix(ui): handle reader host callback exceptions (YPE-6811) (#493)

* chore(ui): align declaration build with strict checks (YPE-6464) (#503)

chore(ui): align declaration build with strict checks

Refs: YPE-6464

* chore: enable additional TypeScript safety checks (#505)

* chore(ui): align declaration build with strict checks

Refs: YPE-6464

* chore: enable additional TypeScript safety checks

Refs: YPE-6832

* feat(ui): customize verse actions and indicators (#506)

* feat(ui): customize verse actions and indicators

Refs: YPE-6782
Signed-off-by: Austin <abharms@gmail.com>

* test(ui): wait for verse layout in browser journeys

Refs: YPE-6782
Signed-off-by: Austin <abharms@gmail.com>

* fix(ui): keep configured verse actions reachable

Make exiting actions inert and keep the visible verse indicator inside its pointer target.

Refs: YPE-6782
Signed-off-by: Austin <abharms@gmail.com>

* fix(ui): keep verse callbacks scoped to the displayed passage

Refs: YPE-6782
Signed-off-by: Austin <abharms@gmail.com>

* fix(ui): preserve verse action focus and warning visibility

Signed-off-by: Austin <abharms@gmail.com>

* fix(ui): restore focus after rejected verse action dismissal

Refs: YPE-6782
Signed-off-by: Austin <abharms@gmail.com>

---------

Signed-off-by: Austin <abharms@gmail.com>

* test(ui): wait for host isolation colors to settle

Amp-Thread-ID: https://ampcode.com/threads/T-01a22d50-d764-7577-a16d-dcc6f7081eba

* fix(core): address Notes and serializer review feedback

Amp-Thread-ID: https://ampcode.com/threads/T-01a22d5e-80f8-71c4-80b9-80b0e2702720

* fix(ui): preserve failed verse actions and guard browser stories

Keep built-in Copy and Share fallback retryable until copying succeeds, and ignore stale clipboard completions after selection changes. Restrict chapter-picker native keyboard helpers to Vitest browser runs.

Amp-Thread-ID: https://ampcode.com/threads/T-01a22d5e-80f8-71c4-80b9-80b0e2702720

* fix(ui): invalidate verse actions on prompt takeover and unmount

Amp-Thread-ID: https://ampcode.com/threads/T-01a22d5e-80f8-71c4-80b9-80b0e2702720

---------

Signed-off-by: Austin <abharms@gmail.com>
Co-authored-by: platform-localization-pr-bot[bot] <294853593+platform-localization-pr-bot[bot]@users.noreply.github.com>
Co-authored-by: camrun91 <16566029+camrun91@users.noreply.github.com>
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-authored-by: Austin <abharms@gmail.com>
Co-authored-by: Amp <amp@ampcode.com>
abharms added a commit that referenced this pull request Dec 2, 2026
* chore: sync react localization from platform-localization (#478)

chore: sync react localization

Co-authored-by: camrun91 <16566029+camrun91@users.noreply.github.com>

* fix(core): sanitize planted footnote content in Bible HTML (#486)

* fix(core): sanitize planted footnote content in Bible HTML

Co-Authored-By: Cameron Pak <cameronandrewpak@gmail.com>

* fix(core): address review on footnote sanitization

Sanitize footnote content in an inert template, drop non-HTML-namespace
elements, sanitize generated footnote content for idempotency, document the
sanitization contract, and consolidate tests.

Co-Authored-By: Cameron Pak <cameronandrewpak@gmail.com>

---------

Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* refactor(ui): organize Bible reader modules (#489)

* refactor(ui): organize Bible reader modules (YPE-6808)

* refactor(ui): extract reader settings lifecycle and toolbar (#495)

* refactor(ui): extract reader settings lifecycle and toolbar (YPE-6815)

* fix(ui): address reader settings review feedback

* feat(ui): re-export passage and versions hooks (#500)

* feat(ui): re-export passage and versions hooks

Amp-Thread-ID: https://ampcode.com/threads/T-01a20e73-4446-71f0-950a-3054df5492c7

* chore(ci): remove packed UI consumer check

* docs(ui): clarify shared provider import guidance

Amp-Thread-ID: https://ampcode.com/threads/T-01a20e73-4446-71f0-950a-3054df5492c7

* docs: address hook re-export review nits

Amp-Thread-ID: https://ampcode.com/threads/T-01a20e73-4446-71f0-950a-3054df5492c7

---------

Co-authored-by: Amp <amp@ampcode.com>

* fix(ui): preserve focus at high zoom (#485)

* fix(ui): preserve focus at high zoom

* fix(ui): harden zoom focus coverage

* refactor(ui): simplify zoom focus handling

* test(ui): cover zoom focus behavior

* test(ui): focus reader close before asserting

* fix(ui): address zoom review findings

* test(ui): compare pointer focus styles

* test(ui): respect focus-visible heuristics

* test(ui): use native focus traversal

* fix(ui): scope focus preservation

* fix(ui): preserve sign-in focus contrast

* test(ui): await close focus transition

* refactor(ui): centralize picker scroll geometry

* fix(ui): keep picker focus visible in constrained panels

* fix(ui): preserve the expanded book trigger in compact panels

* test(ui): reach reader settings close with native keys

* fix(ui): honor reduced motion in chapter reveal

* fix(ui): address focus and scroll review feedback

* fix(ui): reveal focused chapters in Firefox

Keep focused book triggers fully visible within the built-in accordion on Linux Firefox. Wait for the settings dialog opening animation before asserting visibility in WebKit.

* test(ui): query the current settings dialog while opening

* feat(core): add Content Library video APIs (YPE-6573) (#488)

* feat(core): add content library video APIs

* refactor(core): simplify video schema ownership

* fix(core): harden content library contracts

* fix(core): validate video response boundaries

* fix(core): distinguish no-content responses

* fix(core): scope no-content status handling

* fix(core): distinguish empty response bodies

* test(core): isolate Content Library smoke coverage

* feat(core): keep content library APIs compatible with v3

* fix(core): align content library rollout contracts (YPE-6573)

* fix(core): accept empty video filters and trim search bundles (YPE-6573)

* fix(core): address content library review feedback (YPE-6573)

* docs(core): clarify video APIs and live validation (YPE-6573)

* fix(core): use stable Content Library routes (YPE-6573)

* feat(core): add Notes API client (#497)

* feat(core): add Notes API client

Amp-Thread-ID: https://ampcode.com/threads/T-01a2095d-25a9-72c5-a0fb-baa79c35e05a

* fix(core): address Notes API review feedback

Amp-Thread-ID: https://ampcode.com/threads/T-01a2095d-25a9-72c5-a0fb-baa79c35e05a

* fix(core): normalize Notes write colors

* fix(core): address Notes API contract review

* fix(core): enforce Notes version filters and tolerate malformed passages

* fix(core): isolate malformed Notes list records

Amp-Thread-ID: https://ampcode.com/threads/T-01a2095d-25a9-72c5-a0fb-baa79c35e05a

* chore: refresh combined core bundle budget

Amp-Thread-ID: https://ampcode.com/threads/T-01a2095d-25a9-72c5-a0fb-baa79c35e05a

---------

Co-authored-by: Amp <amp@ampcode.com>

* fix(ui): preserve newer selection after native Share (YPE-6812) (#494)

* fix(ui): label reader sign-in menu trigger (YPE-6810) (#492)

* fix(ui): label reader sign-in menu trigger (YPE-6810)

* test(ui): capture Linux WebKit dialog visibility failures

* test(ui): stress WebKit visibility diagnostics

* test(ui): check settings visibility after keyboard focus

Assert dialog opening state after Enter and visibility on the Close button after native Tab, alongside the focus-ring checks. Remove temporary WebKit diagnostics and repeated CI groups.

* fix(ui): handle reader clipboard failures (#490)

* fix(ui): handle reader clipboard failures (YPE-6809)

* fix(ui): report clipboard failures and retry failed shares

* fix(ui): keep clipboard warnings visible while scrolling

* fix(ui): ignore stale clipboard action results

* fix(ui): support Bible reader interactions in iframes (YPE-6410) (#491)

* fix(ui): retain iframe verse selection and anchors (YPE-6410)

* test(ui): cover iframe highlight painting and reset

* fix(ui): complete iframe reader text and focus handling

* fix(ui): handle reader host callback exceptions (YPE-6811) (#493)

* chore(ui): align declaration build with strict checks (YPE-6464) (#503)

chore(ui): align declaration build with strict checks

Refs: YPE-6464

* chore: enable additional TypeScript safety checks (#505)

* chore(ui): align declaration build with strict checks

Refs: YPE-6464

* chore: enable additional TypeScript safety checks

Refs: YPE-6832

* feat(ui): customize verse actions and indicators (#506)

* feat(ui): customize verse actions and indicators

Refs: YPE-6782
Signed-off-by: Austin <abharms@gmail.com>

* test(ui): wait for verse layout in browser journeys

Refs: YPE-6782
Signed-off-by: Austin <abharms@gmail.com>

* fix(ui): keep configured verse actions reachable

Make exiting actions inert and keep the visible verse indicator inside its pointer target.

Refs: YPE-6782
Signed-off-by: Austin <abharms@gmail.com>

* fix(ui): keep verse callbacks scoped to the displayed passage

Refs: YPE-6782
Signed-off-by: Austin <abharms@gmail.com>

* fix(ui): preserve verse action focus and warning visibility

Signed-off-by: Austin <abharms@gmail.com>

* fix(ui): restore focus after rejected verse action dismissal

Refs: YPE-6782
Signed-off-by: Austin <abharms@gmail.com>

---------

Signed-off-by: Austin <abharms@gmail.com>

* feat(ui): add Reader note saving

Ref: YPE-6783

* fix: recover Reader Notes after interrupted authorization

Preserve the draft on browser Back and clean up a partially persisted automatic token refresh. Keep the composer within narrow viewports and simplify the shared action and highlight paths.

Ref: YPE-6783

* fix: preserve Reader Notes through authorization

Keep note handoffs bound to their initiating Reader and authorization attempt. Preserve focus, existing verse actions, and a recoverable draft across OAuth failures and navigation.

Ref: YPE-6783

* fix: preserve Reader sessions and highlight refresh

Keep OAuth recovery bound to the initiating draft and restore focus around the Notes composer. Refresh highlights for the passage on screen and preserve existing host sign-in behavior.

Ref: YPE-6783

* fix: preserve Reader draft recovery and auth compatibility

Keep host-controlled toolbar scopes, restore legacy startup token rotation, and retain the captured draft through a verified failed callback. Verify the workflow with isolated browser fixtures and native Safari.

Ref: YPE-6783

* fix: preserve Reader auth and passage ownership

Keep verified legacy auth tokens available, discard drafts for ended sessions, restore selection during host takeover, and gate highlight writes to the rendered passage.

Ref: YPE-6783

* fix: preserve Reader drafts and OAuth attempt ownership

Retain clean-canceled drafts across navigation, allow matching-chapter highlight intents, and keep verified auth state bound to its active account and handoff.

Ref: YPE-6783

* fix: isolate Reader authorization handoffs

Resume Notes on the verified configured callback, supersede an older pending highlight action, and keep account-bound requests and drafts tied to the right session. Preserve standalone swatch outlines under host styling.

Ref: YPE-6783

* fix: recover Reader note edits after a lost response

Retry the original create payload, then reconcile the current draft against the recovered note ID using the verified writer token. Keep that ID and draft after a failed update.

Ref: YPE-6783

* fix: retry Notes writes after definite rejections

Allow corrected create fields and retain known blank content after a definitive HTTP rejection, while preserving recovery from earlier uncertain writes.

Ref: YPE-6783

* fix: retry corrected Notes payloads after a 413

Release an unresolved create payload after a size rejection. Retain the request UUID and preserve recovery when the note ID is already known.

Ref: YPE-6783

* fix(ui): preload destination highlights (YPE-6783)

* docs: clarify legacy auth recovery (YPE-6783)

* test(ui): await destination passage before save refresh (YPE-6783)

* test(ui): await settled highlight colors (YPE-6783)

* chore: sync react localization

* fix(ui): announce note highlight color names

* fix(ci): verify imported localization provenance

* fix(ui): expose action labels and record Notes QA evidence

* chore: remove pilot reports and obsolete localization support

Keep QA evidence in Jira, the PR, and BrowserStack. Restore the main localization ownership policy and remove superseded sync changesets now that PR507 is merged. SDK implementation and locale catalogs are unchanged.

* fix: harden Reader Notes authorization and integration

* fix: refresh OAuth tree-shaking sentinel

* refactor: narrow reader notes auth and test scope

* test: remove redundant notes browser scenarios

* refactor: reuse oauth cleanup and reader scope checks

* fix(ui): align notes composer with save design

* test(ui): wait for clipboard retry action visibility

* fix(ui): accept normalized note save responses

Reconcile current draft fields against the original submitted fields rather than the API response. Trust validated successful updates while retaining the resource-ID check. Existing Notes journeys cover trimmed update content and normalized create line endings.

* fix(ui): preserve verse action compatibility for notes

Keep the published built-in action union and explicit custom action lists unchanged. Save remains in the default actions, so Notes can ship as a minor addition. Preserve both sample demonstrations with a default/custom action toggle.

* fix(ui): recover note drafts after validation rejections

* chore: sync react localization

* fix(ui): name the note visibility selector accessibly

* chore(demo): remove preloaded verse marker

* fix(ui): toggle note visibility directly

* docs(demo): update verse marker smoke instructions

* fix(ui): align reader notes actions and authorization

* test(ui): wait for custom action popover visibility

---------

Signed-off-by: Austin <abharms@gmail.com>
Co-authored-by: platform-localization-pr-bot[bot] <294853593+platform-localization-pr-bot[bot]@users.noreply.github.com>
Co-authored-by: camrun91 <16566029+camrun91@users.noreply.github.com>
Co-authored-by: Cameron Pak <cameronandrewpak@gmail.com>
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-authored-by: Amp <amp@ampcode.com>
Co-authored-by: abharms <16394621+abharms@users.noreply.github.com>
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.

3 participants