# Mux plugin

The Mux plugin lets a Vaubaan Gateway mission use Mux without handing the agent a credential. Mux video through its REST API: list and read videos and live streams, import a video from a URL, publish or withdraw it, delete it, run live streams, and read playback metrics. Stream keys are never shown.

Version `0.1.0` · 7 permissions · 4 macro-actions · 17 tools · 0 gateways run this plugin (over the last 90 days).

## How Mux is modelled

1 plane, 8 things. The things that exist at the service and how they nest. Every permission is written over these; a resource of an account is one of them, named by its ref.

- **Account** — One account is one Mux access token, which works in one environment: the account's one resource, labelled by its owner.
  - Plane `video` — A Mux environment: its videos, uploads, live streams and playback.
    - `environment` (1; the resource; carries the environment, in the model only) — The resource: the Mux environment the account's token works in.
      - `asset` (1 *) — A video stored and encoded by Mux.
        - `delete` (1) — Verb leaf: the deletion of a video.
      - `upload` (1 *) — A one-time upload URL and the asset it creates.
      - `live-stream` (1 *) — An ingest point an encoder broadcasts to.
      - `playback` (1 *) — The playback ids of one asset or live stream, keyed by its id.
        - `public` (1) — Leaf: a public playback id, which anyone with the URL can play.
      - `metrics` (1) — Synthetic: Mux Data's aggregates over the environment's views.

Marks: 1 exactly one, named; n a finite, known set; * an unknown number, possibly all.

- **Account**: One account is one Mux access token, which works in one environment: the account's one resource, labelled by its owner.
- **Resource**: Importing, publishing a video publicly, deleting a video and running live streams are separate permissions; stream keys never reach the agent.
- **Environment**: No permission of this service depends on an environment: each is held once, whatever the resource. Known: none. Carried by: `video.environment`, in the model only.

## What an agent does at Mux: 4 macro-actions

A mission is made of them: the person ticks the ones the task needs and sets each to a trust level.

1. **Read videos** — Read videos, uploads, live streams and playback metrics. Finding a video, checking that an upload finished or a live stream is up, reading how playback goes for viewers. Nothing changes at Mux, and stream keys never reach the agent. (1 permission)
2. **Import and publish videos** — Import videos, open uploads, add or remove playback ids, make a video public. Bringing a video in from a URL or an upload, then deciding who can watch it: a signed playback id for the product's own players, a public one for anyone with the link. Imports are billed; a public video can be watched and copied by anyone. (3 permissions)
3. **Delete videos** — Delete videos for good. Removing a video Mux should no longer hold. Nothing brings it back, and every page that plays it breaks. (1 permission)
4. **Run live streams** — Create, enable, disable, reset and delete live streams. Preparing a live stream and switching it on or off around an event. Disabling one ends the broadcast; resetting its key cuts off the encoder until it is given the new key from the Mux dashboard. (2 permissions)

## The map

7 permissions of 4 macro-actions, in the four rows of the tree. For the chosen trust level, each cell gives yes, ask me or no, and the quota a day.

Careful ×1: Mild actions run freely; sensitive or costly ones ask first; irreversible ones are left out. Trusting ×3: Up to sensitive actions run freely; costly and irreversible ones ask first. Limits ×3. Autonomous ×10: Everything but irreversible actions runs freely; those ask first. Limits ×10.

yes: runs freely; ask me: ask me first; no: not included. A permission sits in the first row its facts answer: irreversible; costly to undo or unbounded cost; secret or personal data, whole account or bulk, moderate cost, public; otherwise harmless.

### Cannot be repaired

Careful: no. Trusting, Autonomous: ask me.

- Delete videos: Delete a video `mux.asset-delete`, irreversible — The video and its renditions are deleted at Mux; nothing restores them, and every player naming it stops working. Careful: no · Trusting: ask me · 30 a day · Autonomous: ask me · 100 a day.
- Run live streams: Delete a live stream `mux.live-delete`, irreversible — The stream, its key and its playback ids are gone; encoders and players configured for it stop working. Its recordings stay as videos. Careful: no · Trusting: ask me · 15 a day · Autonomous: ask me · 50 a day.

### Repairable, at a price

Careful, Trusting: ask me. Autonomous: runs freely.

- Import and publish videos: Add or remove a playback id `mux.playback-write`, costly to undo — Removing a playback id breaks every player and page that uses it until they are given another one. Careful: ask me · 50 a day · Trusting: ask me · 150 a day · Autonomous: yes · 500 a day.
- Import and publish videos: Make a video or live stream public `mux.playback-public`, costly to undo — Anyone holding the playback URL can watch, with no token; removing the playback id later does not recall what was watched or copied. Careful: ask me · 20 a day · Trusting: ask me · 60 a day · Autonomous: yes · 200 a day.
- Run live streams: Create, enable, disable a live stream, or reset its key `mux.live-write`, costly to undo — Disabling a stream ends a broadcast in progress, and resetting its key cuts off the encoder using the old one; a running stream is billed. Careful: ask me · 20 a day · Trusting: ask me · 60 a day · Autonomous: yes · 200 a day.

### Worth a look

Careful: ask me. Trusting, Autonomous: runs freely.

- Import and publish videos: Import a video from a URL, open an upload, or rename a video `mux.asset-write`, moderate cost — Mux downloads the URL the agent names, from wherever it points, and bills the encoding and storage of what it gets. The video is playable by nobody until a playback id is added. Careful: ask me · 50 a day · Trusting: yes · 150 a day · Autonomous: yes · 500 a day.

### Harmless

Runs freely at every level.

- Read videos: Read videos, uploads, live streams and playback metrics `mux.read-video` — Video metadata and Mux Data aggregates come back to the agent; stream keys are withheld. Nothing changes at Mux. Careful: yes · 1,000 a day · Trusting: yes · 3,000 a day · Autonomous: yes · 10,000 a day.

Careful: runs freely 1, ask me first 4, not included 2.
Trusting: runs freely 2, ask me first 5.
Autonomous: runs freely 5, ask me first 2.

Limits are counted over a mission's period: a day unless its creator picks another, or the mission's whole life for a one-off. The figures here are per day.

## A few calls, classified by the plugin

20 declared calls, run through the plugin's own classifier when this page was built; here one per macro-action and the first the catalog refuses at Careful. [The 20 calls, as code](https://github.com/vaubaan/gateway/blob/main/plugins/mux/src/examples.ts).

- `mux__list_assets {}`
  - the plugin sees: `mux.environment[env-prod-1].asset[*].R`
  - the catalog answers: Read videos, uploads, live streams and playback metrics `mux.read-video`
  - a Careful mission: yes
- `mux__create_asset {"url":"https://cdn.example.org/launch.mp4","title":"Launch"}`
  - the plugin sees: `mux.environment[env-prod-1].asset[*].W`
  - the catalog answers: Import a video from a URL, open an upload, or rename a video `mux.asset-write`
  - a Careful mission: ask me
- `mux__create_live_stream {}`
  - the plugin sees: `mux.environment[env-prod-1].live-stream[*].W`
  - the catalog answers: Create, enable, disable a live stream, or reset its key `mux.live-write`
  - a Careful mission: ask me
- `mux__delete_asset {"asset_id":"Xw3BnVq01oa4cE00x8c1"}`
  - the plugin sees: `mux.environment[env-prod-1].asset[Xw3BnVq01oa4cE00x8c1].delete.W`
  - the catalog answers: Import a video from a URL, open an upload, or rename a video `mux.asset-write`, Delete a video `mux.asset-delete`
  - a Careful mission: no

## Anything else

A call no permission covers touches `mux.uncategorized-write` instead of slipping through. No macro-action holds it; a person ticks it knowingly.

| Permission | Risk | Careful ×1 | Trusting ×3 | Autonomous ×10 |
| --- | --- | --- | --- | --- |
| Uncategorized write `mux.uncategorized-write`: Catch-all for writes without a dedicated entry. No tool of this plugin reaches it; seeing it means an entry is missing. | Repairable, at a price (costly to undo) | ask me · 50 a day | ask me · 150 a day | yes · 500 a day |

## Tools

17 tools. A tool's permissions depend on its arguments, so a mission is made of the macro-actions above, not of tools.

| Tool | What it does | Usually touches |
| --- | --- | --- |
| `mux__list_assets` | List videos | `mux.read-video` |
| `mux__get_asset` | Read a video | `mux.read-video` |
| `mux__create_asset` | Import a video from a URL | `mux.asset-write` |
| `mux__update_asset` | Rename a video | `mux.asset-write` |
| `mux__delete_asset` | Delete a video | `mux.asset-write`, `mux.asset-delete` |
| `mux__create_playback_id` | Publish a video | `mux.playback-write`, `mux.playback-public` |
| `mux__delete_playback_id` | Withdraw a playback id | `mux.playback-write` |
| `mux__create_direct_upload` | Open an upload | `mux.asset-write` |
| `mux__get_direct_upload` | Read an upload | `mux.read-video` |
| `mux__list_live_streams` | List live streams | `mux.read-video` |
| `mux__get_live_stream` | Read a live stream | `mux.read-video` |
| `mux__create_live_stream` | Create a live stream | `mux.playback-write`, `mux.live-write` |
| `mux__enable_live_stream` | Enable a live stream | `mux.live-write` |
| `mux__disable_live_stream` | Disable a live stream | `mux.live-write` |
| `mux__reset_stream_key` | Reset a stream key | `mux.live-write` |
| `mux__delete_live_stream` | Delete a live stream | `mux.live-write`, `mux.live-delete` |
| `mux__get_metric` | Read a playback metric | `mux.read-video` |

## Connecting an account

**1 of 3 · a key you create and paste** — `access token`

An access token the person creates at Mux and pastes once; nobody declares anything beforehand.

**Environment and permissions** — One environment, with Mux Video Read and Write and Mux Data Read. A token works in one environment: connect one account per environment. This gateway gives a mission only the permissions it names.

1. Sign in to the Mux dashboard as an admin of the organization.
2. **Settings › Access Tokens › Generate new token** — Open the access tokens page and start a new token. ([open](https://dashboard.mux.com/settings/access-tokens))
3. **Environment › Permissions** — Choose the environment the agents will work in, and tick the permissions below.
4. Generate the token, copy its ID and Secret Key, and paste both here. Mux shows the secret once.

| Permission at Mux | Access |
| --- | --- |
| Mux Video | read-write |
| Mux Data | read |

Where: [https://dashboard.mux.com/settings/access-tokens](https://dashboard.mux.com/settings/access-tokens)

Expiry: Mux access tokens do not expire: revoke the token on the Access Tokens page to end this account.

The connect page asks: Access Token ID, Secret Key (secret).

The service's documentation: [https://www.mux.com/docs/core/make-api-requests](https://www.mux.com/docs/core/make-api-requests)

Disconnecting: In the Mux dashboard, open Settings, then Access Tokens, and revoke the token this gateway was given.

## Health

0 gateways run this plugin (over the last 90 days).

No version of this plugin has reported a call or a gateway yet.

A version is marked validated by the community with at least 200 reports and a success rate of at least 90 %, over the last 90 days; a gateway shows that mark on the accounts of this service. The figures are refreshed at most hourly ([what they mean](/plugins/health)). It is a community signal, not a security guarantee.

Calls are counted over the last 90 days from the instances that share plugin health. Gateways are counted over the same window among the instances that also share usage statistics, so they are a lower bound. The success rate leaves out calls refused for a rejected credential: a revoked token is the user's configuration, not the plugin.

## Links

- [Connect a Mux account](/plugins/mux#connect)
- [How Mux is modelled](https://github.com/vaubaan/gateway/blob/main/docs/handbook/services/mux.md)
- [The catalog, as code](https://github.com/vaubaan/gateway/blob/main/plugins/mux/src/risk-catalog.yaml)
- [The plugin source](https://github.com/vaubaan/gateway/tree/main/plugins/mux)
- The page: [/plugins/mux](/plugins/mux)
