recommendedXssWhiteList.js 739 B

12345678910111213141516171819
  1. /**
  2. * reference: https://meta.stackexchange.com/questions/1777/what-html-tags-are-allowed-on-stack-exchange-sites
  3. * added tags: h4, h5, h6, span, div, iframe, table, thead, tbody, tfoot, th, td, tr, colgroup, col
  4. * added attributes: class, style
  5. */
  6. const tags = [
  7. 'a', 'b', 'blockquote', 'blockquote', 'code', 'del', 'dd', 'dl', 'dt', 'em',
  8. 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'i', 'img', 'kbd', 'li', 'ol', 'p', 'pre',
  9. 's', 'sup', 'sub', 'strong', 'strike', 'ul', 'br', 'hr', 'span', 'div', 'iframe',
  10. 'table', 'thead', 'tbody', 'tfoot', 'th', 'td', 'tr', 'colgroup', 'col',
  11. ];
  12. const attrs = ['src', 'href', 'class', 'id', 'width', 'height', 'alt', 'title', 'style'];
  13. module.exports = {
  14. 'tags': tags,
  15. 'attrs': attrs,
  16. };