Repository navigation
[1.13] fix(backend): skip HTML sanitizer for pure-markdown descriptions - #34563
gh-bot-collate[bot] wants to merge 5 commits into
Conversation
…33064) 2 3 DescriptionSanitizer ran OWASP sanitize() on every description, including 4 ones with no HTML at all. The sanitizer HTML-encodes text characters it 5 encounters in non-HTML context, converting backticks to ` and 6 apostrophes to ', which breaks Markdown code spans and is visible to 7 API/MCP consumers that do not decode HTML entities. 8 9 Guard: skip policy.sanitize() when the substituted string contains no '<'. 10 If there is no '<' there is no markup to sanitize, and skipping preserves 11 Markdown syntax verbatim. Content that does contain '<' continues through 12 the existing sanitizer path unchanged. 13 14 Fixes #32410 Co-authored-by: Akash Singh <[email protected]> Co-authored-by: Vishnu Jain <[email protected]> (cherry picked from commit 544626c)
|
This PR has had no activity for 30 days and will be closed in 7 days if no further activity occurs. |
mohityadav766
left a comment
There was a problem hiding this comment.
Reviewed the latest head against merged #33064, current main, and the actual target branch 1.13. This backport remains relevant: main has the Markdown-preserving conditional, but 1.13 still invokes MARKDOWN_POLICY unconditionally. The port correctly uses the target branch's policy field and preserves the entity-link substitution/restoration order; the three regression tests match the original fix. No new actionable correctness finding from this defensive static review. Existing style comments are not duplicated. Latest-head service unit tests and Playwright passed, although the SSO workflow reports failure. No local tests or browser validation performed.
Reviewed head: ccb673dcb0ca8b4f1797bfa339bb31ec9005b495.
|
Readiness follow-up: pushed normal 1.13 update 3ba0bb5 (target d8bab23). The PR diff remains only DescriptionSanitizer and its test. All 31 DescriptionSanitizerTest cases pass in the Maven reactor package build. The target already contains the seven import-format corrections reported by py-checkstyle; isort --check-only passes on all seven after this update. Remaining diagnosis from the previous head:
Fresh checks must validate this updated head. No approvals, merges, or bypasses performed; no repeated manual reruns. |
Automated backport of #33064 to
1.13.544626cad6362543ad4b7c18f2e3169e1750b6fdResolution notes
Backport notes: PR #33064 → 1.13
Conflict
openmetadata-service/src/main/java/org/openmetadata/service/util/DescriptionSanitizer.javaconflicted on the single changed line in
sanitize(). The hunk only conflicted because of anaming difference between branches: on
mainthe OWASPPolicyFactoryfield is calledpolicy,while on
1.13it is still namedMARKDOWN_POLICY(the rename topolicyhappened separately onmainand is out of scope for this backport).Resolution
Applied the source PR's actual fix — skip
sanitize()when the string contains no<— using the1.13field name:No other logic changed.
Test file
DescriptionSanitizerTest.javacherry-picked without conflict; all three new tests(
pureMarkdownBackticksAreNotEncoded,pureMarkdownApostrophesAreNotEncoded,entityLinkWithSurroundingMarkdownIsPreserved) are present as-is.For the reviewer
MARKDOWN_POLICYis indeed the correct/onlyPolicyFactoryinstance used bysanitize()on1.13(it is — confirmed by reading the full file).Opened from openmetadata-collate, which holds the credentials needed to open a PR here. It merges itself once this branch's required checks pass — no review needed. If a check fails it stays open and the author of #33064 is asked to look.
resolver run
The behavior appears safe, but the explicit Java requirements must be satisfied before merging.
Findings
Summary
Preserves pure-markdown descriptions by skipping
MARKDOWN_POLICYwhen the text, after entity-link replacement, contains no<.Reviews (1) · Last reviewed commit: "Merge branch '1.13' into backport/1.13/p..." · Reviewed by Greptile