Skip to main content
cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!

Reply
IraJWatt
New Contributor II

Certification How to Use sanitization?

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 }));

 

1 ACCEPTED SOLUTION
dm-p
Honored Contributor

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





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!


On how to ask a technical question, if you really want an answer (courtesy of SQLBI)




View solution in original post

1 REPLY 1
dm-p
Honored Contributor

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





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!


On how to ask a technical question, if you really want an answer (courtesy of SQLBI)




Helpful resources

Announcements
Sticker Challenge 2026 Carousel

Join our Community Sticker Challenge 2026

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

January Power BI Update Carousel

Power BI Monthly Update - January 2026

Check out the January 2026 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Users online (14,758)