Repository navigation
Backport #32313: preserve math equations through frontend and backend sanitizers (1.13) - #32402
Conversation
…nitizers Math equations (block-math-equation nodes) were silently stripped on save because both the frontend DOMPurify sanitizer and the backend OWASP HTML sanitizer removed the unknown custom tag. Apply the same placeholder-protect pattern already used for entity links in both sanitizers, add block-math-equation to the OWASP allowlist, and fix the white-text-on-selection CSS bug. Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
…equations - Add per-call nonce to placeholder names so literal __OM_MATH_EQ_*__ text in descriptions cannot collide with generated placeholders (P1) - Use replacer function () => eq so $ sequences in LaTeX are inserted verbatim rather than interpreted as replacement patterns (bug fix) - Apply same function-replacer fix to entity link restoration - Remove // Restore math equations comment that restated the code (P2) - Apply same nonce to entity link placeholders for consistency Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
❌ PR checklist incompleteThis PR cannot be merged until the following are addressed on its linked issue:
The fields live on the linked issue in the Shipping project (open the issue → right sidebar → Projects). After you set them, re-run this check (or push a commit) — issue/project changes do not re-trigger it automatically. Maintainers can bypass this check by adding the |
|
Hi there 👋 Thanks for your contribution! The OpenMetadata team will review the PR shortly! Once it has been labeled as Let us know if you need any help! |
Code Review ✅ Approved 3 resolved / 3 findingsBackport of math equation preservation fix for frontend and backend sanitizers now includes nonce-based placeholders and function replacer for LaTeX strings. Three minor suggestions: the frontend regex ✅ 3 resolved✅ Quality: Magic string literals "true"/"false" in isediting matcher
✅ Bug: Missing frontend regression test for '$' in restored replacement
✅ Edge Case: Frontend regex mis-parses block-math-equation attrs containing '>'
OptionsDisplay: compact → Showing less information. Comment with these commands to change the behavior for this request:
Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source |
|



Summary
Backport of #32313 to the
1.13release branch.Math equations (
<block-math-equation>nodes) inserted via BlockEditor's MathEquation extension were silently stripped on save in the 1.13 release. This backport applies the same two-layer fix:sanitize.utils.ts): nonce-based placeholder-protect pattern for<block-math-equation>tags around DOMPurify; function replacer to avoid$regex interpretation in LaTeX stringsDescriptionSanitizer.java): addsblock-math-equationelement +math_equation/iseditingattributes to the OWASP HTML sanitizer allowlistmath-equation.less): removesbackground-color: black+color: whitefrom the selection state (KaTeX text was invisible when the node was clicked)Cherry-picked commits (merge commit skipped):
214b904a— initial fixc92aa816— nonce-based placeholders + function replacer improvementTest plan
mvn test -pl openmetadata-service -Dtest=DescriptionSanitizerTestpassesyarn test sanitize.utilspasses🤖 Generated with Claude Code