rusackas opened a new pull request, #40621:
URL: https://github.com/apache/superset/pull/40621
### SUMMARY
SafeMarkdown previously passed `transformLinkUri={null}` to
`<ReactMarkdown>`, which disabled react-markdown's built-in link-protocol
handling entirely. This made link safety depend implicitly on which rehype
plugins happened to be active for a given render path.
This change adds an explicit, exported pure transformer
(`transformMarkdownLinkUri`) that drops `javascript:`, `vbscript:`, and `data:`
link protocols (case-insensitive, tolerant of leading whitespace) while leaving
all other link schemes intact — including the custom schemes that have been
supported since #26211. Link handling no longer depends on which rehype plugins
are active.
### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
<!--- Skip this if not applicable -->
### TESTING INSTRUCTIONS
Unit tests were added for the exported `transformMarkdownLinkUri` function
(react-markdown is globally mocked in the test harness, so the pure function is
tested directly):
```
cd superset-frontend
npx jest packages/superset-ui-core/test/components/SafeMarkdown.test.tsx
```
The tests assert that `javascript:`, `vbscript:`, and `data:` URIs
(including mixed-case and leading-whitespace variants) are reduced to an empty
string, while `https://`, `mailto:`, relative paths, and anchor links pass
through unchanged.
### ADDITIONAL INFORMATION
<!--- Check any relevant boxes with "x" -->
<!--- HINT: Include "Fixes #nnn" if you are fixing an existing issue -->
- [ ] Has associated issue:
- [ ] Required feature flags:
- [ ] Changes UI
- [ ] Includes DB Migration (follow approval process in
[SIP-59](https://github.com/apache/superset/issues/13351))
- [ ] Migration is atomic, supports rollback & is backwards-compatible
- [ ] Confirm DB migration upgrade and downgrade tested
- [ ] Runtime estimates and downtime expectations provided
- [ ] Introduces new feature or API
- [ ] Removes existing feature or API
🤖 Generated with [Claude Code](https://claude.com/claude-code)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]