> For the complete documentation index, see [llms.txt](https://docs.rierino.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.rierino.com/sdk-dv-ui/using-dashboard/security.md). Agents can also search and read this documentation through its [MCP server](https://docs.rierino.com/~gitbook/mcp).

# Security

What a dashboard definition can do in your page, and the Content Security Policy dashboards need.

A dashboard's definition comes from your Rierino server, and anyone who can edit data visualizations there can change what it does in your page. Treat that permission like access to your page's code, and know what a definition can do:

| A definition can                                           | When                                                                                                                                                                                       |
| ---------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| Read from any GET API of the Rierino server, as the viewer | Always: its sources are requested with the viewer's credentials                                                                                                                            |
| Add HTML to the page, including HTML that runs scripts     | Always: the text of a [Hint](https://docs.rierino.com/sdk-dv-ui/values/hint.md) and a [Plotly annotation](https://docs.rierino.com/sdk-dv-ui/charts/plotly.md#annotation) is added as HTML |
| Run JavaScript                                             | Only with `allowScripts`: E-Charts [tooltip code](https://docs.rierino.com/sdk-dv-ui/charts/echarts.md#tooltips-with-code)                                                                 |

The data that sources return is shown as text, except where a definition puts it into the HTML of a Hint or an annotation.

## allowScripts

```tsx
<Dashboard client={client} id="store-overview" allowScripts />
```

The `_formatter` of an E-Charts series tooltip is JavaScript written in the definition. Without `allowScripts`, `<Dashboard>` doesn't run it and shows the chart's default tooltip instead. The Rierino admin UI always runs it.

Set `allowScripts` only for dashboards whose editors you trust as you trust your page's code.

{% hint style="warning" %}
**allowScripts doesn't stop HTML**

Hint and annotation HTML is added with or without `allowScripts`, and HTML such as an `<img>` with an `onerror` attribute runs a script. `allowScripts` keeps tooltip code from running; it doesn't make an untrusted definition safe.
{% endhint %}

## Content Security Policy

If your page has a Content Security Policy, it has to allow these for dashboards:

| Directive     | Value                          | Needed for                                                                                                     |
| ------------- | ------------------------------ | -------------------------------------------------------------------------------------------------------------- |
| `script-src`  | `'unsafe-eval'`                | **Every dashboard**: queries are compiled to JavaScript functions when they run. Also tooltip code.            |
| `style-src`   | `'unsafe-inline'`              | [Plotly](https://docs.rierino.com/sdk-dv-ui/charts/plotly.md) charts, which add their own styles to the page   |
| `style-src`   | `https://fonts.googleapis.com` | The Montserrat font                                                                                            |
| `font-src`    | `https://fonts.gstatic.com`    | The Montserrat font                                                                                            |
| `connect-src` | Your Rierino server            | The definition and the sources                                                                                 |
| `connect-src` | `https://cdn.plot.ly`          | Plotly [maps](https://docs.rierino.com/sdk-dv-ui/charts/plotly.md#maps), which load the map from Plotly's site |

For example, with the rest of the page served from its own origin:

```
Content-Security-Policy:
  default-src 'self';
  script-src 'self' 'unsafe-eval';
  style-src 'self' 'unsafe-inline' https://fonts.googleapis.com;
  font-src https://fonts.gstatic.com;
  connect-src 'self' https://your-rierino-host https://cdn.plot.ly
```

{% hint style="danger" %}
**Without 'unsafe-eval', no item shows data**

The definition loads, but the sources' rows can't be stored and no query can run: every item stays empty, without an error on the page. `onError` is called for each source, with a message about the Content Security Policy.
{% endhint %}

Without `'unsafe-inline'` styles, Plotly charts show `Error:` in place of the chart; the other components work. Without the Google Fonts entries, text falls back to the browser's default font. Without `cdn.plot.ly`, maps stay empty: to serve the map files yourself, see [Maps](https://docs.rierino.com/sdk-dv-ui/charts/plotly.md#maps).


---

# 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.rierino.com/sdk-dv-ui/using-dashboard/security.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
