HTL context override on data-sly-attribute.href
good morning.
I am working on part of a script that outputs search results and includes links to reorder these results using data-sly-attribute.href properties on <a> links.
I have found that the values trigger the XSS detection in HTL and removes the attribute. I have some test code below that demonstrate these cases
As you can see, when I use context='unsafe' the code displays, but not on the data-sly-attribute.href of the <a>. It seems like the implicit context='uri' that is set on the href overrides the passed unsafe context.
I have 2 questions.
1. Is this the correct behavior? It seems that the context passed by the expression should overrule the default context.
2. Can anyone point me to documentation to configure the xss api to accespt these uri's?
Thanks
<sly data-sly-list.orderByOption="${articleList.orderByOptions}">
<li>
<pre>
uri: ${'{0}.html?{1}' @ format=[resource.path,orderByOption.queryString], context='uri'},
unsafe: ${'{0}.html?{1}' @ format=[resource.path,orderByOption.queryString], context='unsafe'}
</pre>
<a data-sly-attribute.href="${'{0}.html?{1}' @ format=[resource.path,orderByOption.queryString], context='unsafe'}"
data-sly-attribute.class="${'{0}' @ format=[orderByOption.text == articleList.activeOrderByOption.text ? 'active' : '']}"
data-orderby="${orderByOption.orderBy}"
data-orderby-sort="${orderByOption.orderBySort}">${orderByOption.text}</a>
</li>
</sly>
results in:
<li>
<pre>
uri: ,
unsafe: /content/test-uc/news/search/jcr:content/main/article_list.html?article-list-id=163453488&manualArticles=&term=&authors=&contacts=&displayDateRangeType=&displayDateStart=&displayDateEnd=&tags=&anyAll=&showEvents=&articlesExclude=&authorsExclude=&tagsExclude=&limit=10&orderBy=story.[jcr:content/dispDate]&orderBySort=desc
</pre>
<a data-orderby="story.[jcr:content/dispDate]" data-orderby-sort="desc" class="active">Newest First</a>
</li>
<li>
<pre>
uri: ,
unsafe: /content/test-uc/news/search/jcr:content/main/article_list.html?article-list-id=163453488&manualArticles=&term=&authors=&contacts=&displayDateRangeType=&displayDateStart=&displayDateEnd=&tags=&anyAll=&showEvents=&articlesExclude=&authorsExclude=&tagsExclude=&limit=10&orderBy=story.[jcr:content/dispDate]&orderBySort=asc
</pre>
<a data-orderby="story.[jcr:content/dispDate]" data-orderby-sort="asc">Oldest First</a>
</li>
<li>
<pre>
uri: ,
unsafe: /content/test-uc/news/search/jcr:content/main/article_list.html?article-list-id=163453488&manualArticles=&term=&authors=&contacts=&displayDateRangeType=&displayDateStart=&displayDateEnd=&tags=&anyAll=&showEvents=&articlesExclude=&authorsExclude=&tagsExclude=&limit=10&orderBy=story.[jcr:score]&orderBySort=desc
</pre>
<a data-orderby="story.[jcr:score]" data-orderby-sort="desc">Best Match First</a>
</li>
<li>
<pre>
uri: ,
unsafe: /content/test-uc/news/search/jcr:content/main/article_list.html?article-list-id=163453488&manualArticles=&term=&authors=&contacts=&displayDateRangeType=&displayDateStart=&displayDateEnd=&tags=&anyAll=&showEvents=&articlesExclude=&authorsExclude=&tagsExclude=&limit=10&orderBy=story.[jcr:score]&orderBySort=asc
</pre>
<a data-orderby="story.[jcr:score]" data-orderby-sort="asc">Worst Match First Descending</a>
</li>
