-
Notifications
You must be signed in to change notification settings - Fork 14.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: adding feature flags to escape/hide html in markdown #11340
Conversation
Codecov Report
@@ Coverage Diff @@
## master #11340 +/- ##
==========================================
- Coverage 65.59% 61.57% -4.02%
==========================================
Files 832 838 +6
Lines 39448 39841 +393
Branches 3598 3655 +57
==========================================
- Hits 25874 24533 -1341
- Misses 13465 15127 +1662
- Partials 109 181 +72
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, with a few minor non-blocking recommendations
superset/config.py
Outdated
"DISPLAY_MARKDOWN_HTML": True, | ||
"ESCAPE_MARKDOWN_HTML": False, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we add comments here that explain how these affect the behaviour? Also, it could be a good idea to add a comment in UPDATING.md
in case someone is currently relying on this functionality.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The default settings in this PR mimic the current default behavior, so the feature shouldn't require any action when updating.
That said, the comments do seem valuable. I'll add 'em!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added some comments... let me know if they don't make sense.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"DISPLAY_MARKDOWN_HTML": True, | ||
|
||
# When True, this escapes HTML (rather than rendering it) in Markdown components | ||
"ESCAPE_MARKDOWN_HTML": False, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Security-first default settings would be my preferred approach. Is there a reason why the default here can't be secure out of the box?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't believe there are any security issues that exist in this implementation.
The reason these flags aren't flipped here is that it would cause the example dashboards (and perhaps customer/user dashboards) to suddenly look very broken, with a bunch of noisy HTML displayed, or (in the examples) nothing displayed at all.
* utilizing feature flag for html escapement * use src alias * Feature flag to allow hiding of HTML tags * strips js attr * better feature flag naming * simplifying * Adding comments to new feature flags * shorter comment, because pylint, * pedantic change to get black to format a file
SUMMARY
Adds feature flags (set with defaults to match current behavior) that (a) can escape/display HTML code, or (b) hide the output of HTML markup.
BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
TEST PLAN
Tested (visually, and in Chrome inspector) that HTML is escaped when
ESCAPE_MARKDOWN_HTML
is enabled, and that HTML is hidden when DISPLAY_MARKDOWN_HTML is turned off.ADDITIONAL INFORMATION