# Tenant-author tokens

The second kind of embed token, for your customers' own authors, and what keeps it in bounds.

This page is for security reviewers, beside the [Security model](security-model.md). GOAT's server can issue a second kind of embed token, a tenant-author token, for your customers' own authors. The embed script has no authoring screens yet, but the server accepts these tokens today.

## When one can be issued

Both of these must be on:

- An Admin has turned on Embedded authoring in a collection's Settings tab. The tab turns it on for all tenants. An Admin can limit it, through the API, to a list of tenants or to tenants whose attributes match (the labels you give each tenant; see [Tenants and access](/docs/embed/tenants-and-access)). With matching attributes, an Author who changes a tenant's attributes also changes whether that tenant is covered.
- Your backend asks for the token with an API key that has the `mintAuthor` scope, with `"role": "tenant-author"`, the collection, and your user's id.

## What the holder can do

- Run queries it writes itself, not only saved charts, on the datasets attached to that collection, unless a dataset is turned off for tenant authors. Its own queries can read any column of those datasets, including columns classified PII or Sensitive, within the rows the tenant filter allows. Turning actions off in its token does not narrow what these queries read. The collection's Settings tab counts the datasets with such columns.
- Create charts and dashboards in that collection, and edit those made by its tenant's own authors, as the collection's Create, Edit their own, and Turn on Show the rows switches allow.
- Copy a dashboard whose level is Customizable, which an operator sets when publishing (see [Choose who can see it](/docs/build-dashboards/publish-and-share#2-choose-who-can-see-it)). Once the copy is published, the tenant's viewers see it in place of the original.
- Publish its dashboards to its own tenant. GOAT refuses any grant of a tenant-authored dashboard to another tenant or to every tenant.
- Read filter value lists, as a viewer can.

## Its controls

| Control | What it does |
|---|---|
| The same tenant filter | On a dataset with a tenant key, every query it runs, its own included, is filtered on the server to the token's tenant, as a viewer's is. On a dataset with no tenant key and sharing off, it is refused. |
| A check on every request | Each request checks again, from GOAT's own records, that the install-wide switch is on and the tenant is active. It checks that Embedded authoring is still on for the collection and covers the tenant, and that the author is not suspended. For a query, it checks that the dataset is attached to the collection and available to tenant authors. The records are at most 60 seconds old, so turning any of these off stops open sessions within a minute, not when the token expires. |
| A ceiling per author | Its queries count against a ceiling of its own, 300 a minute with bursts of 40 by default, apart from the tenant's viewers. A query it writes is never answered from the cache, so each one runs in BigQuery and is billed. |
| An install-wide switch | An Admin can turn tenant authoring off for the whole install with `"tenantAuthoringEnabled": false` through the settings API. It is on by default. |

## Things to know

- A dataset with no tenant key is shared by default, and a tenant author's own queries on a shared dataset read every customer's rows. Before turning on Embedded authoring, turn sharing off on such datasets, or detach them from the collection.
- Removing a tenant's access to a dashboard does not remove that dashboard's charts from the tenant's own published dashboards. A chart a tenant author placed there stays visible to that tenant until the tenant's dashboard is unpublished or its grant is removed.
- Filter value lists skip the check on every request. Suspending one author, or turning the install-wide switch off, does not stop that author's token from reading filter value lists. Those lists stay limited to the columns a filter shows on a dashboard granted to the tenant, under the tenant filter. They stop when the tenant is suspended, or when the grant or filter behind the column goes away. They also stop when the dataset is detached from the collection or turned off for tenant authors, and when the token expires, at most 24 hours after it was issued. To stop them sooner for one dataset, detach it or turn it off for tenant authors; to stop them for everything, suspend the tenant.
