> For the complete documentation index, see [llms.txt](https://docs.servoy.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.servoy.com/guides/deploy/other-topics/security-cross-site-scripting.md).

# Security: Cross-site Scripting

## Overview

Cross-Site Scripting (XSS) is an attack to a website where data that contains scripts is executed and malicous code created by one user may be run by another user.

Servoy will sanitize all data that is shown in the WebClient and the NGClient to prevent this in Servoy solutions.

## Trusting data as html

In some situations data used in elements contains html that has to be shown as-is.

Only in cases where the source of the html can be fully trusted, an element should be configured to disable sanitizing.

This is done via the `UI_PROPERTY.TRUST_DATA_AS_HTML` client property on an element:

```javascript
elements.usernameLabel.putClientProperty(APP_UI_PROPERTY.TRUST_DATA_AS_HTML, true);
```

When this property is set on an element, data from its dataProvider will be trusted and not sanitized.

Alternatively, sanitizing of data can be turned off for the entire running client by applying the same property on the application node:

```javascript
application.putClientProperty(APP_UI_PROPERTY.TRUST_DATA_AS_HTML, true);
```

{% hint style="danger" %}
**Using this at application level is highly discouraged, your system may be vulnerable to XSS attacks.**
{% endhint %}

For more information see [UICONSTANTS](/reference/servoycore/dev-api/application/uiconstants.md#trust_data_as_html).


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.servoy.com/guides/deploy/other-topics/security-cross-site-scripting.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
