Skip to content

Fixes 38683: Remove vulnerable Showdown Markdown dependency - #38684

Open
shah-harshit wants to merge 1 commit into
mainfrom
shah-harshit/38683-remove-showdown
Open

shah-harshit wants to merge 1 commit into
mainfrom
shah-harshit/38683-remove-showdown

Conversation

@shah-harshit

Copy link
Copy Markdown
Contributor

Describe your changes:

Fixes #38683

Remove the remaining Showdown runtime uses and dependency. Feed/comment and service-documentation Markdown now use Marked behind the existing MarkdownToHTMLConverter.makeHtml API. Description emoji lookup now uses static data rather than invoking a second Markdown parser.

Showdown 2.1.0 remains affected by GHSA-cr32-g25g-vxjj, GHSA-22g5-r2x5-97cx, and GHSA-rmmh-p597-ppvv; the current alerts list no patched version. This removes the package from the dependency graph. Alerts can clear after this lands on the default branch and dependency scanning processes it.

Follow-up to #38542 and #38663. No changes to backend APIs, schemas, ingestion, or submodule pointers.

Type of change:

  • Bug fix

High-level design:

  • Feed conversion uses a synchronous Marked lexer/parser. A document-scoped heading counter preserves existing ASCII anchor IDs and duplicate suffixes. Retain disabled task checkboxes and task-list markup, table alignment, line breaks, literal single tildes, explicit-link behavior, and mention HTML. Two-space nested lists now retain all levels.
  • Description conversion retains its existing Marked extensions. Replace its emoji parser call with a frozen 1,175-entry dictionary, preserving Unicode values and the two legacy HTML-based shortcodes. Keep the original MIT notice with this data. Only own dictionary entries can become emoji tokens; unknown names continue to fall through to Marked, preserving colon-adjacent autolinks and code/escape handling.
  • Remove showdown, @types/showdown, and their unreferenced Commander 9 lock entry. No packages are added and all other lock content stays unchanged. The dictionary avoids another runtime dependency and vocabulary drift.
  • Existing sanitization boundaries remain in place. Like the previous converter, Marked output is not a sanitizer; unsafe links and HTML are exercised through the real DOMPurify boundary in tests.

Tests:

Use cases covered

Feed nesting, paragraphs, line breaks, bold/emphasis/strikethrough, disabled task checkboxes, aligned tables, heading IDs and duplicate reset across documents, explicit links, unchanged bare URLs, mention HTML, literal code, unsafe link/event-handler sanitization, empty input, service-documentation sections/admonitions, and description emoji compatibility including inherited-property names.

Unit tests

Commit: a437b0d3adf1a07b93486fc2eebb569507280408.

10 suites passed, 291 tests passed, 0 failed using standard Jest setup with --no-cache --runInBand --coverage, after physically removing the installed Showdown packages:

  • src/utils/BlockEditorPureUtils.test.ts
  • src/utils/BlockEditorUtils.test.ts
  • src/utils/FeedUtilsPure.markdown.test.ts
  • src/utils/FeedUtils.test.tsx
  • src/utils/FeedUtilsPure.buildMentionLink.test.ts
  • src/utils/FeedUtilsPure.getFeedCounts.test.ts
  • src/utils/ServiceUtils.test.ts
  • src/components/ActivityFeed/ActivityFeedCardNew/CommentCard.test.tsx
  • src/components/ActivityFeed/ActivityFeedCard/FeedCardBody/FeedCardBodyNew.test.tsx
  • src/components/common/CommentComposer/CommentComposer.test.tsx

After selecting Marked's explicitly synchronous lexer/parser API, reran the six affected feed, documentation, and component suites: 83 passed, 0 failed. The four unchanged description/count/mention suites reuse the ten-suite evidence above.

  • The nested-list regression fails with the original feed converter and passes after migration.
  • All 1,175 dictionary entries equal the previous renderer's output; exhaustive local comparison passed before removal and again after formatting.
  • New feed converter: 20/20 instrumented statements covered. Description utility: 93.13% lines, 92.55% branches in the ten-suite run. The final six-suite coverage run covers 59.29% of the larger feed utility module; unrelated helpers were outside that focused rerun.
  • Focused strict TypeScript check passes for the exact new feed converter and static emoji dictionary.
  • Organize imports, ESLint, Prettier, and git diff --check pass on changed files.
  • yarn list --pattern showdown --offline --ignore-engines succeeds with no matches. Neither installed package resolves; no tracked manifest, lockfile, or runtime import references either dependency.
  • Full application type checking, production build, full Jest suite, and fresh full dependency installation were not run. Yarn removal's reinstall phase was stopped as the disk filled; the three unreferenced lock blocks were pruned without changing any remaining lock content, then checked with Yarn's offline dependency graph.

Backend integration tests

Not applicable — no backend changes.

Ingestion integration tests

Not applicable — no ingestion changes.

Playwright (UI) tests

Not run locally for this OSS parser/dependency follow-up. Real DOM parser and component tests above cover affected behavior.

Manual testing performed

No new browser session. Validated rendered DOM outcomes, documentation markup, dependency removal, and exact emoji parity locally as listed above.

UI screen recording:

Not applicable — standalone security/dependency fix with no component, layout, styling, or theme changes. Existing task-list markup and alignment are preserved and checked in DOM tests.

Checklist:

  • Title and linked issue identify Remove vulnerable Showdown dependency from feed and description rendering #38683.
  • Non-obvious compatibility, document-local state, and dictionary constraints have explanatory comments.
  • Focused tests, formatting, dependency graph, and scoped type checks pass; broader checks are explicitly listed above.
  • Self-review against REVIEW.md at a437b0d3adf1a07b93486fc2eebb569507280408: no blocking findings. Test map: description converter/dictionary to BlockEditorPureUtils.test.ts; feed converter to FeedUtilsPure.markdown.test.ts; documentation consumer to ServiceUtils.test.ts.
  • Schema migration: not applicable.
  • Recording requirement: not applicable to standalone security fix.
  • Decision record: not applicable — preserve existing contracts while replacing the parser implementation.

@shah-harshit
shah-harshit requested a review from a team as a code owner November 25, 2026 12:22
@shah-harshit shah-harshit added UI UI specific issues safe to test Add this label to run secure Github workflows on PRs skip-pr-checks Bypass PR metadata validation check labels Nov 25, 2026
@shah-harshit shah-harshit self-assigned this Nov 25, 2026
@gitar-bot

gitar-bot Bot commented Nov 25, 2026 •

Copy link
Copy Markdown
Code Review ✅ Approved 🟡 Medium risk

Replacing Showdown with Marked changes Markdown rendering for feeds and service docs; parser differences could alter displayed content despite preserved sanitization.

Replaces the Showdown Markdown runtime with Marked for feed, comment, and service-documentation rendering, and swaps the description emoji parser for a static 1,175-entry dictionary, then removes the showdown and @types/showdown dependencies. No open findings; the change is approved.

Verification

Rules No rules evaluated

Functional validation Not enabled

Set up

Auto-approval Not enabled

Set up

For more verification details, comment gitar display:verbose.

Options

Display: compact → Showing compact verification results.

Comment with these commands to change the behavior for this request:

Compact
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source

@github-actions

Copy link
Copy Markdown
Contributor

UI browser tests

Ran: all test files (openmetadata-ui/src/main/resources/ui/package.json affects every browser test)

Result: ✅ 1072 passed · 154 skipped

Changed code executed by these browser tests: 16 / 23 lines (70%)

File Changed lines Executed %
src/utils/BlockEditorPureUtils.ts 3 1 33%
src/utils/FeedUtilsPure.ts 19 14 74%
src/constants/MarkdownEmojis.constants.ts 1 1 100%

This branch has not been deployed

No deployments
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 skip-pr-checks Bypass PR metadata validation check UI UI specific issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Remove vulnerable Showdown dependency from feed and description rendering

1 participant