# Plugin permissions

> Understand the permission dialog — package permissions, code scopes, service API permissions and the domains a plugin connects to

Source: https://anasaki.live/docs/en/store/plugin-permissions

A plugin can only do what it declares and an administrator approves — at install, at activation and whenever a new version asks for more. The same list is shown on the plugin's page of the store website (**Permissions this plugin uses**).

## Package permissions

| permission | Meaning in the admin |
| --- | --- |
| `head` | Adds code to the page head (.css/.js files on every page) |
| `bodyEnd` | Adds HTML/scripts at the end of the page |
| `blocks` | Adds blocks to the designer |
| `settings` | Has its own settings page |
| `webhooks` | Sends event data (e.g. a new post) to an outside website |
| `code` | Runs JavaScript on the site's server (within the code scopes below) |
| `service` | Has its own server-side program (WebAssembly in the CMS or a separate program) |

## Code scopes (JavaScript plugins)

| scope | What it allows |
| --- | --- |
| `db` | Its own tables and migrations (only `p__*` tables) |
| `content` | Read posts and pages |
| `content-write` ⚠ | Create, edit and delete posts/pages (with system rights) |
| `content-fields` ⚠ | Add fields to the post/page editor (stored in the plugin's own post meta) |
| `mail` ⚠ | Send email from the site |
| `http` ⚠ | Call outside websites — only domains the plugin declares **and** the admin allows |
| `webhooks` ⚠ | Send webhooks to any URL (public addresses only) |
| `visitor` ⚠ | Identify the site's visitors/members |
| `filters-core` ⚠ | Change system data through the core filters (content, head, email…) |
| `routes` | Add public pages/addresses to the site (declared paths only) |
| `post-types` | Declare content types of its own (since CMS 2.0.5) |
| `admin-pages` | Add admin pages, dashboard widgets and notice banners |
| `jobs` | Background and scheduled (cron) jobs |
| `middleware` | Runs before every public page request (can answer instead of the page, or redirect) |
| `head-scripts` | Inserts unfiltered scripts/HTML into every page |

⚠ = the admin marks it **Important permission — make sure you trust the developer**

> [!WARNING]
> `head-scripts` equals putting raw HTML on every page, and `middleware` can answer for any page. Even without the warning badge, approve them only for plugins you trust, such as the official Custom code and Maintenance plugins.

JavaScript plugins do **not** get direct SQL (`db.query`), cannot see the CMS's or other plugins' tables, and cannot see the system's or other plugins' cookies.

## Service API permissions (WebAssembly / external service)

| Permission | Meaning |
| --- | --- |
| `site` | Read site data (name, logo, theme) |
| `mail` | Send email through the site's email system |
| `content` | Read published posts and pages |
| `users` | Read user data (name, email, role) |
| `events` | Send events to other plugins |
| `storage` | Keep its own data in the plugin storage |
| `http` | Call outside services, only the listed domains (e.g. a payment gateway) |

## When a new version asks for more

If an update asks for a permission, scope, API permission or domain the previous version did not have, the system:

1. Updates the files but **switches the plugin off**
2. Shows &#34;This version asks for more permissions than vX — off until you approve&#34; with the list of additions
3. Switches it on again when an administrator presses **Approve and activate**

## Permissions of installed plugins

The cards on the **Installed** tab show the code scopes, the site addresses used, the domains it may call and the plugins it needs. Domains a plugin calls with `http` must also be on the site's allow list (set under Site Code → Secrets & settings).
