# Watcher “watcher.actions.email.html.sanitization” table attributes

**URL:** <https://discuss.elastic.co/t/watcher-watcher-actions-email-html-sanitization-table-attributes/50971>\
**Category:** Elasticsearch\
**Tags:** elastic-stack-alerting\
**Created:** [May 25, 2016, 4:56pm UTC](https://discuss.elastic.co/t/watcher-watcher-actions-email-html-sanitization-table-attributes/50971 "2016-05-25T16:56:13Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![santhosh](https://avatars.discourse-cdn.com/v4/letter/s/f07891/32.png) [@santhosh](https://discuss.elastic.co/u/santhosh)\
**Post date:** [May 25, 2016, 4:56pm UTC](https://discuss.elastic.co/t/watcher-watcher-actions-email-html-sanitization-table-attributes/50971/1 "2016-05-25T16:56:13Z")

</div>

I construct email alerts in elasticsearch watcher using HTML and I have also configured to sanitize following html tags in elasticsearch.yml

```
watcher.actions.email.html.sanitization:
  allow: _tables, _blocks, _formatting, _links, _styles

```

But in my alerts, I see the table is constructed but the table attributes were not considered while constructing the table. For example, the border, cellpadding and colspan were never applied on my table. Table example given below

`<table border='1' cellpadding='5' style='font-family:sans-serif;font-size:13px'><thead><tr><th>Type</th><th colspan='5'>Version</th></tr></thead><tbody> etc.`

I can still achieve it by completely disabling the HTML sanitization like below, but it was not recommended as it involved security risks.

`watcher.actions.email.html.sanitization.enabled: false`

I have even tried to use `allow: _tables:all`, but it didn't work and it doesn't seem to be the right thing.

Is there a way to achieve it by enabling only few tags along with it's attributes?

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [May 26, 2016, 7:45am UTC](https://discuss.elastic.co/t/watcher-watcher-actions-email-html-sanitization-table-attributes/50971/2 "2016-05-26T07:45:08Z")

</div>

Hey,

right now `border` and `cellpadding` attributes are always dropped. You can get the `style` attribute working by allowing `_styles` in the sanitizer config.

Will check if it makes sense to open up more attributes here.

--Alex

---

<div class="post-metadata">

**Author:** ![santhosh](https://avatars.discourse-cdn.com/v4/letter/s/f07891/32.png) [@santhosh](https://discuss.elastic.co/u/santhosh)\
**Post date:** [May 26, 2016, 2:13pm UTC](https://discuss.elastic.co/t/watcher-watcher-actions-email-html-sanitization-table-attributes/50971/3 "2016-05-26T14:13:30Z")

</div>

Yes, the style attribute works. Is `colspan` attribute too dropped for table?

Is there any documentation that says what attributes are considered and what not for HTML tags?

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [May 26, 2016, 2:53pm UTC](https://discuss.elastic.co/t/watcher-watcher-actions-email-html-sanitization-table-attributes/50971/4 "2016-05-26T14:53:53Z")

</div>

Hey,

right now `colspan` is dropped. I allowed it manually for the next release (together with `rowspan` and `border` for `td/tr`), however we will come up with a more generic solution in the future, so you can configure this yourself.

Our current idea is to allow the user to configure the tags and the allowed attributes for such a tag like `a:href|class|id` or `a:_all` - would that make sense and work for you?

--Alex

---

<div class="post-metadata">

**Author:** ![santhosh](https://avatars.discourse-cdn.com/v4/letter/s/f07891/32.png) [@santhosh](https://discuss.elastic.co/u/santhosh)\
**Post date:** [May 26, 2016, 3:09pm UTC](https://discuss.elastic.co/t/watcher-watcher-actions-email-html-sanitization-table-attributes/50971/5 "2016-05-26T15:09:46Z")

</div>

Yeah sure. It does make sense. Thanks for opening up more options.

---

<div class="post-metadata">

**Author:** ![santhosh](https://avatars.discourse-cdn.com/v4/letter/s/f07891/32.png) [@santhosh](https://discuss.elastic.co/u/santhosh)\
**Post date:** [May 26, 2016, 6:43pm UTC](https://discuss.elastic.co/t/watcher-watcher-actions-email-html-sanitization-table-attributes/50971/6 "2016-05-26T18:43:40Z")

</div>

And also it would be helpful for new users if the documentation is updated saying which attributes are dropped for which tags.

---

<div class="post-metadata">

**Author:** ![santhosh](https://avatars.discourse-cdn.com/v4/letter/s/f07891/32.png) [@santhosh](https://discuss.elastic.co/u/santhosh)\
**Post date:** [June 2, 2016, 2:03pm UTC](https://discuss.elastic.co/t/watcher-watcher-actions-email-html-sanitization-table-attributes/50971/7 "2016-06-02T14:03:28Z")

</div>

@spinscale Looks like `<th>` of `<table>` also won't render in watch alerts. Is this too dropped?

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [June 6, 2016, 9:35am UTC](https://discuss.elastic.co/t/watcher-watcher-actions-email-html-sanitization-table-attributes/50971/8 "2016-06-06T09:35:41Z")

</div>

Hey,

`th` is supported. Can you provide an example, what is not working?

--Alex

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 6, 2017, 1:45pm UTC](https://discuss.elastic.co/t/watcher-watcher-actions-email-html-sanitization-table-attributes/50971/9 "2017-07-06T13:45:13Z")

</div>


