Sanitize all the html content to solve security concerns #3082
Labels
refactor
Tech debt related tasks that need refactoring
security feature
technical debt
If not paid, jeapardizes long-term success and maintainability of the repository.
From #2905 discussion, we found that we currently use
dangerouslySetInnerHTML
to let react know this is html content. There are multiple places in our code base usingdangerouslySetInnerHTML
fonts
code reference:
OpenSearch-Dashboards/src/core/server/rendering/views/fonts.tsx
Line 257 in d7004dc
style
OpenSearch-Dashboards/src/core/server/rendering/views/styles.tsx
Line 44 in d7004dc
field
OpenSearch-Dashboards/src/plugins/advanced_settings/public/management_app/components/field/field.tsx
Line 558 in d7004dc
table_row in discover
OpenSearch-Dashboards/src/plugins/discover/public/application/components/table/table_row.tsx
Line 124 in d7004dc
field_format_editor in index management
OpenSearch-Dashboards/src/plugins/index_pattern_management/public/components/field_editor/components/field_format_editor/editors/url/label_template_flyout.tsx
Line 151 in d7004dc
OpenSearch-Dashboards/src/plugins/index_pattern_management/public/components/field_editor/components/field_format_editor/samples/samples.tsx
Line 76 in d7004dc
markdown vis
OpenSearch-Dashboards/src/plugins/opensearch_dashboards_react/public/markdown/markdown.tsx
Line 144 in 54f2aeb
metrics vis
OpenSearch-Dashboards/src/plugins/vis_type_metric/public/components/metric_vis_value.tsx
Line 94 in d7004dc
If XSS is really a concern and we think customer data is not trustful enough for security purpose, another way is to add dompurify. It is a DOM-only, super-fast, uber-tolerant XSS sanitizer for HTML, MathML and SVG.
The text was updated successfully, but these errors were encountered: