We've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now
Hi,
As part of the certification process there is a requirement to: "ensure DOM is manipulated safely. Use sanitization for user input or user data, before adding it to DOM."
How have others achived this?
I have implemented the code below to loop through all the data from the user and apply a sanitizeHTML function on it. I am not sure if this is enough.
options.dataViews[0].table.rows = options.dataViews[0].table.rows.map(innerArray =>
innerArray.map(element => {if (element) { return sanitizeHtml(String(element)); } else return null }));
Solved! Go to Solution.
Hi @IraJWatt,
If you're using sanitize-html, this should be enough. However, you may need to consider the permitted tags your HTML may contain to avoid arbitrary execution of JavaScript and potential attempts to load data remotely via attributes like src. For the remote loading, setting your WebAccess privilege in your capabilities as directed should prevent this, but you can also manage this within sanitize-html.
If it helps, the HTML Content visual is open source. There is a version called HTML Content (lite), certified by MS, so it can be regarded as good enough for HTML sanitization in a certified environment. You can review its sanitize-html configuration here.
Good luck!
Daniel
Proud to be a Super User!
On how to ask a technical question, if you really want an answer (courtesy of SQLBI)
Hi @IraJWatt,
If you're using sanitize-html, this should be enough. However, you may need to consider the permitted tags your HTML may contain to avoid arbitrary execution of JavaScript and potential attempts to load data remotely via attributes like src. For the remote loading, setting your WebAccess privilege in your capabilities as directed should prevent this, but you can also manage this within sanitize-html.
If it helps, the HTML Content visual is open source. There is a version called HTML Content (lite), certified by MS, so it can be regarded as good enough for HTML sanitization in a certified environment. You can review its sanitize-html configuration here.
Good luck!
Daniel
Proud to be a Super User!
On how to ask a technical question, if you really want an answer (courtesy of SQLBI)
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.