# Row-level security

## How do you enforce tenant isolation in customer-facing analytics?

In Embeddable, tenant isolation is enforced on the server. Your backend requests an embed token that carries a security context, such as the customer ID. You set its lifetime. Your data models use that context to filter every query; with security filters, a query that cannot be filtered fails instead of returning data.

For **customer-facing analytics**, each **end-user** should only see the **data they're allowed to see** and nothing more. That's why row-level security (RLS) is a **first-class citizen** in Embeddable.

There are three ways to do RLS in Embeddable:

1. **[Security filters](https://docs.embeddable.com/data-modeling/row-level-security/security-filters)** – the **simplest way to get started** to ensure row-level security is **applied globally** across all your data models. Pass filters in the [Tokens API](https://docs.embeddable.com/deployment/tokens-api) and Embeddable enforces them on every query automatically. If a filter can't be applied, the query fails — so data can never accidentally leak.
2. **[SQL-based security](https://docs.embeddable.com/data-modeling/row-level-security/sql-based-security)** – the recommended approach if you want control of (row, schema or table-level) security **at the model level** (rather than just globally).
3. **[Access Policies](https://docs.embeddable.com/data-modeling/row-level-security/access-policies)** – a more scalable approach to row-level security if you have **a lot of models** and you are using [Views](https://docs.embeddable.com/data-modeling/writing-data-models/views), or you want **role-based security**.

---
Source: https://docs.embeddable.com/data-modeling/row-level-security/introduction
