# 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: 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:

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

The question should be specific, self-contained, and written in natural language.
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.
