Skip to content

[1.13] fix(backend): skip HTML sanitizer for pure-markdown descriptions - #34563

Closed
gh-bot-collate[bot] wants to merge 5 commits into
1.13from
backport/1.13/pr-33064
Closed

gh-bot-collate[bot] wants to merge 5 commits into
1.13from
backport/1.13/pr-33064

Conversation

@gh-bot-collate

@gh-bot-collate gh-bot-collate Bot commented Oct 2, 2026 •

Copy link
Copy Markdown

Automated backport of #33064 to 1.13.

Source PR #33064
Author @a-kash-singh
Merge commit 544626cad6362543ad4b7c18f2e3169e1750b6fd
Method Conflicts resolved by Claude — worth a read of the diff.

Resolution notes

Backport notes: PR #33064 → 1.13

Conflict

openmetadata-service/src/main/java/org/openmetadata/service/util/DescriptionSanitizer.java
conflicted on the single changed line in sanitize(). The hunk only conflicted because of a
naming difference between branches: on main the OWASP PolicyFactory field is called policy,
while on 1.13 it is still named MARKDOWN_POLICY (the rename to policy happened separately on
main and is out of scope for this backport).

Resolution

Applied the source PR's actual fix — skip sanitize() when the string contains no < — using the
1.13 field name:

String toSanitize = replaced.toString();
String sanitized = toSanitize.contains("<") ? MARKDOWN_POLICY.sanitize(toSanitize) : toSanitize;

No other logic changed.

Test file

DescriptionSanitizerTest.java cherry-picked without conflict; all three new tests
(pureMarkdownBackticksAreNotEncoded, pureMarkdownApostrophesAreNotEncoded,
entityLinkWithSurroundingMarkdownIsPreserved) are present as-is.

For the reviewer

  • Verify MARKDOWN_POLICY is indeed the correct/only PolicyFactory instance used by
    sanitize() on 1.13 (it is — confirmed by reading the full file).
  • No other behavioral changes were introduced; this is a 1:1 port of the main fix.

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

RetriggerView in GreptileConfidence Score: 4/5

The behavior appears safe, but the explicit Java requirements must be satisfied before merging.

Findings

  1. P2 Unchanged locals lack `final` ▶
  2. P2 New check uses a literal ▶

Summary

Preserves pure-markdown descriptions by skipping MARKDOWN_POLICY when the text, after entity-link replacement, contains no <.

  • Pure Markdown descriptions keep their original characters.

Reviews (1) · Last reviewed commit: "Merge branch '1.13' into backport/1.13/p..." · Reviewed by Greptile

…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 &#96; and
     6	apostrophes to &#39;, 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)
@github-actions

Copy link
Copy Markdown
Contributor

This PR has had no activity for 30 days and will be closed in 7 days if no further activity occurs.
Feel free to reopen it if you'd like to continue working on it.

@mohityadav766 mohityadav766 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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.

Copy link
Copy Markdown
Member

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:

  • Service tests: 6,230 tests, 501 errors. The initial SearchIndex static initializer dereferences a null Entity.getSearchRepository() from SearchRepositoryTest, then leaves the class uninitializable. On untouched common-base d9cbea1, SearchRepositoryTest + ReindexingUtilTest pass all 65 in the default local order, but running with -Dsurefire.runOrder=alphabetical reproduces the same initial error and 50 cascading ReindexingUtilTest errors. These source/test files are also unchanged on current 1.13. This is a baseline test-order/initialization defect, not introduced by the sanitizer diff; maintainers should fix that shared baseline before rerunning this gate.
  • Python 3.10: six DeltaLake setup errors follow Hadoop UserGroupInformation -> Subject.getSubject throwing UnsupportedOperationException, followed by JAVA_GATEWAY_EXITED. CI owners should check the runner JDK against the Spark/Hadoop runtime. Python 3.12: five Looker Liquid-rendering tests fail (unrendered conditional returned). These source/tests are unchanged from the target; this needs baseline/dependency investigation rather than a sanitizer change. Python 3.11 passed.
  • External collate-ci Compatibility checks only exposes mvn -B clean install -DskipTests -pl '!collate-ui,!collate-dist' exiting 1, with no compiler diagnostics or annotations. I cannot attribute that failure from this output. If it recurs on the updated head, the CI owner needs to provide its actual build log and confirm the paired 1.13 checkout.

Fresh checks must validate this updated head. No approvals, merges, or bypasses performed; no repeated manual reruns.

@harshach harshach closed this Nov 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

safe to test Add this label to run secure Github workflows on PRs Stale

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants