xcorecli 2.1.0__tar.gz → 2.3.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {xcorecli-2.1.0 → xcorecli-2.3.0}/PKG-INFO +1 -1
- {xcorecli-2.1.0 → xcorecli-2.3.0}/docs/commands/health.md +3 -1
- {xcorecli-2.1.0 → xcorecli-2.3.0}/docs/commands/init.md +13 -5
- xcorecli-2.3.0/docs/config/index.md +48 -0
- {xcorecli-2.1.0 → xcorecli-2.3.0}/docs/getting-started/configuration.md +1 -1
- {xcorecli-2.1.0 → xcorecli-2.3.0}/docs/getting-started/install.md +1 -1
- {xcorecli-2.1.0 → xcorecli-2.3.0}/docs/index.md +1 -1
- {xcorecli-2.1.0 → xcorecli-2.3.0}/docs/migration/index.md +17 -0
- {xcorecli-2.1.0 → xcorecli-2.3.0}/docs/plugin/install.md +26 -2
- {xcorecli-2.1.0 → xcorecli-2.3.0}/docs/plugin/marketplace.md +17 -2
- {xcorecli-2.1.0 → xcorecli-2.3.0}/docs/plugin/security.md +29 -0
- {xcorecli-2.1.0 → xcorecli-2.3.0}/docs/reference.md +35 -0
- xcorecli-2.3.0/docs/sandbox/index.md +86 -0
- {xcorecli-2.1.0 → xcorecli-2.3.0}/pyproject.toml +1 -1
- {xcorecli-2.1.0 → xcorecli-2.3.0}/uv.lock +1 -1
- {xcorecli-2.1.0 → xcorecli-2.3.0}/xcli/migrations/cli.py +105 -12
- {xcorecli-2.1.0 → xcorecli-2.3.0}/xcli/migrations/runtime.py +37 -3
- {xcorecli-2.1.0 → xcorecli-2.3.0}/xcli/plugin/install_commands.py +38 -2
- {xcorecli-2.1.0 → xcorecli-2.3.0}/xcli/plugin/marketplace_commands.py +41 -0
- xcorecli-2.3.0/xcli/plugin/shared.py +107 -0
- xcorecli-2.1.0/docs/config/index.md +0 -49
- xcorecli-2.1.0/docs/sandbox/index.md +0 -43
- xcorecli-2.1.0/xcli/plugin/shared.py +0 -59
- {xcorecli-2.1.0 → xcorecli-2.3.0}/.github/workflows/publish.yml +0 -0
- {xcorecli-2.1.0 → xcorecli-2.3.0}/.gitignore +0 -0
- {xcorecli-2.1.0 → xcorecli-2.3.0}/.python-version +0 -0
- {xcorecli-2.1.0 → xcorecli-2.3.0}/.vscode/configurationCache.log +0 -0
- {xcorecli-2.1.0 → xcorecli-2.3.0}/.vscode/dryrun.log +0 -0
- {xcorecli-2.1.0 → xcorecli-2.3.0}/.vscode/settings.json +0 -0
- {xcorecli-2.1.0 → xcorecli-2.3.0}/.vscode/targets.log +0 -0
- {xcorecli-2.1.0 → xcorecli-2.3.0}/README.md +0 -0
- {xcorecli-2.1.0 → xcorecli-2.3.0}/docs/commands/login.md +0 -0
- {xcorecli-2.1.0 → xcorecli-2.3.0}/docs/getting-started/auth.md +0 -0
- {xcorecli-2.1.0 → xcorecli-2.3.0}/docs/manager/index.md +0 -0
- {xcorecli-2.1.0 → xcorecli-2.3.0}/docs/manager/monitoring.md +0 -0
- {xcorecli-2.1.0 → xcorecli-2.3.0}/docs/manager/services.md +0 -0
- {xcorecli-2.1.0 → xcorecli-2.3.0}/docs/plugin/index.md +0 -0
- {xcorecli-2.1.0 → xcorecli-2.3.0}/docs/plugin/local.md +0 -0
- {xcorecli-2.1.0 → xcorecli-2.3.0}/docs/plugin/runtime.md +0 -0
- {xcorecli-2.1.0 → xcorecli-2.3.0}/docs/plugin/update.md +0 -0
- {xcorecli-2.1.0 → xcorecli-2.3.0}/docs/service/index.md +0 -0
- {xcorecli-2.1.0 → xcorecli-2.3.0}/docs/worker/index.md +0 -0
- {xcorecli-2.1.0 → xcorecli-2.3.0}/docs/worker/process.md +0 -0
- {xcorecli-2.1.0 → xcorecli-2.3.0}/makefile +0 -0
- {xcorecli-2.1.0 → xcorecli-2.3.0}/mkdocs.yml +0 -0
- {xcorecli-2.1.0 → xcorecli-2.3.0}/xcli/__init__.py +0 -0
- {xcorecli-2.1.0 → xcorecli-2.3.0}/xcli/_credentials.py +0 -0
- {xcorecli-2.1.0 → xcorecli-2.3.0}/xcli/_login.py +0 -0
- {xcorecli-2.1.0 → xcorecli-2.3.0}/xcli/_run.py +0 -0
- {xcorecli-2.1.0 → xcorecli-2.3.0}/xcli/_xcore.py +0 -0
- {xcorecli-2.1.0 → xcorecli-2.3.0}/xcli/config/__init__.py +0 -0
- {xcorecli-2.1.0 → xcorecli-2.3.0}/xcli/config/cli.py +0 -0
- {xcorecli-2.1.0 → xcorecli-2.3.0}/xcli/config/runtime.py +0 -0
- {xcorecli-2.1.0 → xcorecli-2.3.0}/xcli/init/__init__.py +0 -0
- {xcorecli-2.1.0 → xcorecli-2.3.0}/xcli/init/manager.py +0 -0
- {xcorecli-2.1.0 → xcorecli-2.3.0}/xcli/init/upgrade.py +0 -0
- {xcorecli-2.1.0 → xcorecli-2.3.0}/xcli/main.py +0 -0
- {xcorecli-2.1.0 → xcorecli-2.3.0}/xcli/manager/__init__.py +0 -0
- {xcorecli-2.1.0 → xcorecli-2.3.0}/xcli/manager/cli.py +0 -0
- {xcorecli-2.1.0 → xcorecli-2.3.0}/xcli/migrations/__init__.py +0 -0
- {xcorecli-2.1.0 → xcorecli-2.3.0}/xcli/plugin/__init__.py +0 -0
- {xcorecli-2.1.0 → xcorecli-2.3.0}/xcli/plugin/cli.py +0 -0
- {xcorecli-2.1.0 → xcorecli-2.3.0}/xcli/plugin/local_commands.py +0 -0
- {xcorecli-2.1.0 → xcorecli-2.3.0}/xcli/plugin/runtime_commands.py +0 -0
- {xcorecli-2.1.0 → xcorecli-2.3.0}/xcli/plugin/scaffold.py +0 -0
- {xcorecli-2.1.0 → xcorecli-2.3.0}/xcli/plugin/security_commands.py +0 -0
- {xcorecli-2.1.0 → xcorecli-2.3.0}/xcli/plugin/update_commands.py +0 -0
- {xcorecli-2.1.0 → xcorecli-2.3.0}/xcli/sandbox/__init__.py +0 -0
- {xcorecli-2.1.0 → xcorecli-2.3.0}/xcli/sandbox/cli.py +0 -0
- {xcorecli-2.1.0 → xcorecli-2.3.0}/xcli/service/__init__.py +0 -0
- {xcorecli-2.1.0 → xcorecli-2.3.0}/xcli/service/cli.py +0 -0
- {xcorecli-2.1.0 → xcorecli-2.3.0}/xcli/service/install_commands.py +0 -0
- {xcorecli-2.1.0 → xcorecli-2.3.0}/xcli/service/marketplace_commands.py +0 -0
- {xcorecli-2.1.0 → xcorecli-2.3.0}/xcli/service/shared.py +0 -0
- {xcorecli-2.1.0 → xcorecli-2.3.0}/xcli/worker/__init__.py +0 -0
- {xcorecli-2.1.0 → xcorecli-2.3.0}/xcli/worker/cli.py +0 -0
- {xcorecli-2.1.0 → xcorecli-2.3.0}/xcli/worker/worker.py +0 -0
|
@@ -39,5 +39,7 @@ xcli services
|
|
|
39
39
|
|
|
40
40
|
If `health` reports errors:
|
|
41
41
|
1. Check the logs: `make logs`
|
|
42
|
-
2.
|
|
42
|
+
2. Check your marketplace credentials aren't the issue: `xcli config show`
|
|
43
|
+
(there's no dedicated `integration.yaml` validator — it's checked
|
|
44
|
+
automatically whenever `xcli manager start` reads it)
|
|
43
45
|
3. Restart services: `make restart`
|
|
@@ -12,11 +12,19 @@ xcli init my-project
|
|
|
12
12
|
|
|
13
13
|
### Database Options
|
|
14
14
|
|
|
15
|
-
The initialization wizard supports several database backends with
|
|
16
|
-
- **
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
- **
|
|
15
|
+
The initialization wizard supports several database backends with
|
|
16
|
+
pre-configured URL templates — always the **async** driver variant, never
|
|
17
|
+
a sync one, since `xcore` is async end-to-end:
|
|
18
|
+
|
|
19
|
+
- **SQLite** (default): `sqlite+aiosqlite:///./xcore.db`
|
|
20
|
+
- **PostgreSQL**: `postgresql+asyncpg://user:pass@localhost:5432/dbname`
|
|
21
|
+
- **MySQL**: `mysql+aiomysql://user:pass@localhost:3306/dbname`
|
|
22
|
+
- **MariaDB**: `mysql+aiomysql://user:pass@localhost:3306/dbname`
|
|
23
|
+
|
|
24
|
+
`--db-url` overrides the template entirely if you need a different
|
|
25
|
+
host/user/password — but keep the `+aiosqlite`/`+asyncpg`/`+aiomysql`
|
|
26
|
+
driver suffix; a plain `postgresql://`/`mysql://` URL uses a sync driver
|
|
27
|
+
that doesn't work with this framework's async SQLAlchemy engine.
|
|
20
28
|
|
|
21
29
|
### Generated Structure
|
|
22
30
|
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# CLI Configuration
|
|
2
|
+
|
|
3
|
+
The `config` command group stores the two credentials `xcorecli` needs to
|
|
4
|
+
talk to the marketplace: an **API key** (`xdk_...`, authorizes downloads)
|
|
5
|
+
and a **signing key** (verifies the HMAC signature of every ZIP before
|
|
6
|
+
extraction). It does **not** manage `integration.yaml` or any other
|
|
7
|
+
project-level setting — see [Getting started → Configuration](../getting-started/configuration.md)
|
|
8
|
+
for that.
|
|
9
|
+
|
|
10
|
+
!!! tip "Prefer `xcli login`"
|
|
11
|
+
`xcli login` (device-code flow, opens a browser) fetches and stores
|
|
12
|
+
**both** credentials in one step, without ever printing them to the
|
|
13
|
+
terminal. `config set` below is the manual fallback — useful in a
|
|
14
|
+
non-interactive environment (CI, a container) where opening a browser
|
|
15
|
+
isn't possible.
|
|
16
|
+
|
|
17
|
+
## Commands
|
|
18
|
+
|
|
19
|
+
| Command | Description |
|
|
20
|
+
|---------|-------------|
|
|
21
|
+
| `xcli config set <key> <value>` | Store a credential — `key` must be `api-key` or `signing-key`. |
|
|
22
|
+
| `xcli config show` | Print whether each credential is set (values are masked, never shown in full). |
|
|
23
|
+
|
|
24
|
+
## Setting credentials manually
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
xcli config set api-key xdk_...
|
|
28
|
+
xcli config set signing-key <your-signing-secret>
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Both are written to `~/.xcli/config.json` — the same file `xcli login`
|
|
32
|
+
writes to, so mixing the two approaches (login once, then manually rotate
|
|
33
|
+
one key later) is safe.
|
|
34
|
+
|
|
35
|
+
## Checking status
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
xcli config show
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
```
|
|
42
|
+
api-key: set
|
|
43
|
+
signing-key: not set
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
Nothing else is configurable through this command group — there is no
|
|
47
|
+
`get`/`validate` sub-command, and no arbitrary `key.path value` form; `key`
|
|
48
|
+
is restricted to exactly `api-key` or `signing-key`.
|
|
@@ -67,4 +67,4 @@ observability:
|
|
|
67
67
|
|
|
68
68
|
## Validation
|
|
69
69
|
|
|
70
|
-
`xcorecli` validates this file upon startup to ensure all required fields are present and correctly typed
|
|
70
|
+
`xcorecli` validates this file upon startup to ensure all required fields are present and correctly typed — there is no separate command to check it manually ahead of time; `xcli manager start` (or any command that touches the running project) is itself the validation step. This is unrelated to [`xcli config`](../config/index.md), which only stores your marketplace API/signing keys, not `integration.yaml` settings.
|
|
@@ -13,7 +13,7 @@ Getting started with `xcorecli` is straightforward. The project uses [Poetry](ht
|
|
|
13
13
|
### 1. Clone the Repository
|
|
14
14
|
|
|
15
15
|
```bash
|
|
16
|
-
git clone https://github.com/
|
|
16
|
+
git clone https://github.com/xcore-team/xcoreCli.git
|
|
17
17
|
cd xcorecli
|
|
18
18
|
```
|
|
19
19
|
|
|
@@ -23,6 +23,15 @@ xcli migration init
|
|
|
23
23
|
|
|
24
24
|
This creates the `alembic/` directory, configuration files, and scans for initial models.
|
|
25
25
|
|
|
26
|
+
!!! tip "Custom directory name"
|
|
27
|
+
Pass `--dir my_migrations` to use a different directory name. The chosen
|
|
28
|
+
name is persisted to `migration.directory` in `integration.yaml`, so every
|
|
29
|
+
other `migration` command (`revision`, `upgrade`, `downgrade`, `current`,
|
|
30
|
+
`history`, `heads`, `stamp`) picks it up automatically — no need to repeat
|
|
31
|
+
`--dir` on each call. To rename an already-initialized project, use
|
|
32
|
+
`xcli migration rename <new_name>` instead of moving the folder by hand —
|
|
33
|
+
it also updates `alembic.ini` and `integration.yaml` for you.
|
|
34
|
+
|
|
26
35
|
## Safety & Backups
|
|
27
36
|
|
|
28
37
|
Before performing dangerous operations, `xcorecli` can automatically backup your database.
|
|
@@ -99,5 +108,13 @@ Check which migrations have been applied.
|
|
|
99
108
|
xcli migration history
|
|
100
109
|
```
|
|
101
110
|
|
|
111
|
+
See the database's current revision, or where the migration chain's
|
|
112
|
+
unapplied heads are:
|
|
113
|
+
|
|
114
|
+
```bash
|
|
115
|
+
xcli migration current # what revision the DB is actually stamped at
|
|
116
|
+
xcli migration heads # latest revision(s) defined in the migration scripts
|
|
117
|
+
```
|
|
118
|
+
|
|
102
119
|
!!! tip "Stamping"
|
|
103
120
|
Use `xcli migration stamp <id>` to mark the database at a specific revision without running the actual migration scripts.
|
|
@@ -32,14 +32,38 @@ To see all available versions for a plugin:
|
|
|
32
32
|
xcli plugin versions name-of-plugin
|
|
33
33
|
```
|
|
34
34
|
|
|
35
|
-
## Installing from Git or
|
|
35
|
+
## Installing from Git or a Local Zip
|
|
36
36
|
|
|
37
|
-
You can install plugins directly from a Git repository or a
|
|
37
|
+
You can install plugins directly from a Git repository or a `.zip` file
|
|
38
|
+
instead of the marketplace — neither one goes through HMAC verification,
|
|
39
|
+
that's marketplace-only, so run `xcli plugin health` afterward (see below).
|
|
38
40
|
|
|
39
41
|
```bash title="Git Install"
|
|
40
42
|
xcli plugin install my-plugin --source git --url https://github.com/user/plugin.git
|
|
41
43
|
```
|
|
42
44
|
|
|
45
|
+
```bash title="Zip Install"
|
|
46
|
+
xcli plugin install my-plugin --source zip --url ./path/to/plugin.zip
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
`--url` is required for both `git` and `zip` — omitting it fails fast
|
|
50
|
+
rather than falling back to the marketplace.
|
|
51
|
+
|
|
52
|
+
## Reinstalling
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
xcli plugin install name-of-plugin --force # overwrite an existing install
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
Without `--force`, installing over an already-installed plugin (same name)
|
|
59
|
+
is refused with a one-line message telling you to add the flag.
|
|
60
|
+
|
|
61
|
+
!!! bug "`--no-deps` currently has no effect"
|
|
62
|
+
The flag is accepted (`install --no-deps`) but the installer never
|
|
63
|
+
reads it — confirmed in `xcli/plugin/install_commands.py`: dependencies
|
|
64
|
+
install the same way whether or not you pass it. Not documented as
|
|
65
|
+
working here on purpose; treat it as reserved for now.
|
|
66
|
+
|
|
43
67
|
## Management Commands
|
|
44
68
|
|
|
45
69
|
### Detailed Info
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
# Plugin Marketplace
|
|
2
2
|
|
|
3
|
-
Discover plugins available on the marketplace before installing them
|
|
4
|
-
|
|
3
|
+
Discover plugins available on the marketplace before installing them.
|
|
4
|
+
`browse`/`search`/`info` below are read-only and public, no credentials
|
|
5
|
+
required; `mine` is the one exception (see below).
|
|
5
6
|
|
|
6
7
|
## Browse All
|
|
7
8
|
|
|
@@ -30,6 +31,20 @@ published versions.
|
|
|
30
31
|
xcli plugin marketplace info name-of-plugin
|
|
31
32
|
```
|
|
32
33
|
|
|
34
|
+
## Your Plugins
|
|
35
|
+
|
|
36
|
+
`browse`/`search` above only ever show **public** plugins — unauthenticated
|
|
37
|
+
requests, by design. To also see your own **private** plugins, use `mine`
|
|
38
|
+
instead, which sends your API key:
|
|
39
|
+
|
|
40
|
+
```bash title="Your plugins"
|
|
41
|
+
xcli plugin marketplace mine
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Needs the same API key as installing does — see
|
|
45
|
+
[Authentication](../getting-started/auth.md). `xcli login`'s personal key
|
|
46
|
+
works here even without a project-scoped key for any specific plugin.
|
|
47
|
+
|
|
33
48
|
## What's not here
|
|
34
49
|
|
|
35
50
|
Rating a plugin (`POST /plugins/{slug}/ratings`) requires a full user
|
|
@@ -29,6 +29,35 @@ For a comprehensive check of all plugins (including manifest validation and AST
|
|
|
29
29
|
xcli plugin health
|
|
30
30
|
```
|
|
31
31
|
|
|
32
|
+
## Validating Manifests
|
|
33
|
+
|
|
34
|
+
Beyond signature checks, `validate` checks the plugin manifest itself
|
|
35
|
+
(`plugin.yaml` structure, required fields) and can track its **IPC
|
|
36
|
+
surface** — the actions and events a plugin exposes to others — across
|
|
37
|
+
versions:
|
|
38
|
+
|
|
39
|
+
```bash title="Validate a plugin"
|
|
40
|
+
xcli plugin security validate my-plugin
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Without a path, it scans every plugin found via `integration.yaml`
|
|
44
|
+
instead of just one:
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
xcli plugin security validate
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
```bash title="Track breaking IPC changes"
|
|
51
|
+
xcli plugin security validate my-plugin --save # snapshot today's IPC surface
|
|
52
|
+
xcli plugin security validate my-plugin --check-breaking # diff against that snapshot
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
`--save` writes the current IPC action/event schemas to a snapshot file
|
|
56
|
+
(default `.xcore/schemas.json`, override with `--schema-file`); a later
|
|
57
|
+
`--check-breaking` run reports anything removed or changed since — useful
|
|
58
|
+
in CI to catch an accidental breaking change to a plugin's public IPC
|
|
59
|
+
contract before it ships.
|
|
60
|
+
|
|
32
61
|
## Strict Mode
|
|
33
62
|
|
|
34
63
|
Enable `strict_trusted` in your configuration to refuse any plugin that is not properly signed.
|
|
@@ -12,6 +12,15 @@ A comprehensive list of all commands available in `xcorecli`.
|
|
|
12
12
|
- `xcli services`: Show status and details of all system services (local
|
|
13
13
|
runtime — not the marketplace catalog, see `xcli service` below).
|
|
14
14
|
|
|
15
|
+
## `config` Credentials
|
|
16
|
+
|
|
17
|
+
- `config set <api-key|signing-key> <value>`: Store one credential in
|
|
18
|
+
`~/.xcli/config.json` — the manual alternative to `xcli login` above.
|
|
19
|
+
- `config show`: Print whether each credential is set (masked).
|
|
20
|
+
|
|
21
|
+
Only these two keys exist — no arbitrary `integration.yaml` settings live
|
|
22
|
+
here, see [Configuration](getting-started/configuration.md) for that file.
|
|
23
|
+
|
|
15
24
|
## `manager` Administration
|
|
16
25
|
|
|
17
26
|
- `manager start`: Start the FastAPI server (uvicorn).
|
|
@@ -50,10 +59,19 @@ A comprehensive list of all commands available in `xcorecli`.
|
|
|
50
59
|
- `marketplace browse`: List published plugins (`--sort newest|downloads|rating`).
|
|
51
60
|
- `marketplace search`: Search by name or description.
|
|
52
61
|
- `marketplace info`: Pre-install details, including published versions.
|
|
62
|
+
- `marketplace mine`: List *your* plugins — public and private alike (needs
|
|
63
|
+
an API key; `browse`/`search`/`info` above are public, no credentials).
|
|
53
64
|
|
|
54
65
|
No `rate` command — rating requires a full user session (JWT), not an API
|
|
55
66
|
key; rate plugins from the XCoreHub dashboard.
|
|
56
67
|
|
|
68
|
+
### `plugin security` Signing & validation
|
|
69
|
+
- `security sign`: HMAC-sign a plugin (`plugin.sig`).
|
|
70
|
+
- `security verify`: Verify a plugin's signature.
|
|
71
|
+
- `security validate`: Validate plugin manifest(s); `--check-breaking`
|
|
72
|
+
diffs IPC actions/events against a saved schema snapshot, `--save`
|
|
73
|
+
updates that snapshot.
|
|
74
|
+
|
|
57
75
|
### `plugin update` Maintenance
|
|
58
76
|
- `update check`: Check for new versions.
|
|
59
77
|
- `update apply`: Apply updates (--all, --dry-run).
|
|
@@ -62,7 +80,21 @@ key; rate plugins from the XCoreHub dashboard.
|
|
|
62
80
|
- `runtime load`: Activate a plugin.
|
|
63
81
|
- `runtime unload`: Deactivate a plugin.
|
|
64
82
|
- `runtime reload`: Restart a plugin.
|
|
83
|
+
- `runtime reload-all`: Restart every active plugin at once.
|
|
65
84
|
- `runtime status`: Show active plugins.
|
|
85
|
+
- `runtime call`: Invoke a plugin action directly (`--payload '{"k": "v"}'`).
|
|
86
|
+
|
|
87
|
+
## `sandbox` Isolated Execution
|
|
88
|
+
|
|
89
|
+
Run a plugin in isolation and inspect its declared resource/network/
|
|
90
|
+
filesystem policy — none of these require the plugin to already be loaded
|
|
91
|
+
by a running instance.
|
|
92
|
+
|
|
93
|
+
- `sandbox run`: Launch a plugin sandboxed, keep it running (Ctrl+C to stop).
|
|
94
|
+
- `sandbox call`: Start sandboxed, call one action, print the result, stop.
|
|
95
|
+
- `sandbox limits`: Show resource limits from the manifest.
|
|
96
|
+
- `sandbox network`: Show the declared network policy.
|
|
97
|
+
- `sandbox fs`: Show the declared filesystem policy.
|
|
66
98
|
|
|
67
99
|
## `service` Marketplace Extensions
|
|
68
100
|
|
|
@@ -104,4 +136,7 @@ confused with `xcli services`/`xcli manager services` (local runtime).
|
|
|
104
136
|
- `migration revision`: Create a new migration.
|
|
105
137
|
- `migration upgrade`: Apply migrations (--backup).
|
|
106
138
|
- `migration downgrade`: Rollback migrations.
|
|
139
|
+
- `migration current`: Show the database's current revision.
|
|
140
|
+
- `migration heads`: Show the migration chain's latest defined revision(s).
|
|
141
|
+
- `migration stamp`: Mark the DB at a revision without running scripts.
|
|
107
142
|
- `migration history`: Show migration list.
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
# Plugin Sandboxing
|
|
2
|
+
|
|
3
|
+
The Sandbox provides a secure execution environment for third-party or untrusted plugins, ensuring they cannot compromise the host system.
|
|
4
|
+
|
|
5
|
+
## Resource Isolation
|
|
6
|
+
|
|
7
|
+
Sandboxed plugins are restricted in their resource consumption to prevent "noisy neighbor" issues or intentional Denial of Service.
|
|
8
|
+
|
|
9
|
+
### Limits Configuration
|
|
10
|
+
|
|
11
|
+
You can define default limits in `integration.yaml`:
|
|
12
|
+
|
|
13
|
+
```yaml
|
|
14
|
+
security:
|
|
15
|
+
rate_limit_default:
|
|
16
|
+
calls: 200 # Max IPC calls
|
|
17
|
+
period_seconds: 60 # Per minute
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## AST-Based Whitelisting
|
|
21
|
+
|
|
22
|
+
The core of the sandbox is an AST (Abstract Syntax Tree) analyzer that scans the plugin's code before execution.
|
|
23
|
+
|
|
24
|
+
- **Whitelisted**: Only modules listed in `security.allowed_imports` can be imported.
|
|
25
|
+
- **Blacklisted**: Modules in `security.forbidden_imports` (like `os` or `subprocess`) are explicitly blocked.
|
|
26
|
+
|
|
27
|
+
!!! danger "Sandbox Bypass"
|
|
28
|
+
Attempting to bypass the sandbox via reflection or other advanced Python techniques is monitored and will result in the plugin being immediately unloaded.
|
|
29
|
+
|
|
30
|
+
## Managing the Sandbox
|
|
31
|
+
|
|
32
|
+
Use the `sandbox` command group to run a plugin in isolation and inspect the
|
|
33
|
+
policy declared in its manifest — none of these require the plugin to
|
|
34
|
+
already be loaded by a running `xcore` instance, unlike `xcli plugin
|
|
35
|
+
runtime`.
|
|
36
|
+
|
|
37
|
+
### Run
|
|
38
|
+
|
|
39
|
+
Launch a plugin in an isolated sandbox process and keep it running until
|
|
40
|
+
you interrupt it (Ctrl+C):
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
xcli sandbox run my-sandboxed-plugin
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
### Call
|
|
47
|
+
|
|
48
|
+
Start the sandbox, invoke a single action, print the result, then stop —
|
|
49
|
+
useful for testing one IPC action without keeping the process alive:
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
xcli sandbox call my-sandboxed-plugin send_email --payload '{"to": "user@example.com"}'
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
!!! warning "Sandboxed plugins only"
|
|
56
|
+
`sandbox call` refuses a plugin whose `execution_mode` isn't
|
|
57
|
+
`sandboxed` — use `xcli plugin runtime call` for a `trusted` plugin
|
|
58
|
+
instead.
|
|
59
|
+
|
|
60
|
+
### Limits
|
|
61
|
+
|
|
62
|
+
Show the resource limits declared in the plugin's manifest (timeout, max
|
|
63
|
+
memory/disk, rate limit) — read-only, no process started:
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
xcli sandbox limits my-sandboxed-plugin
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
### Network
|
|
70
|
+
|
|
71
|
+
Show the plugin's declared network policy (`network:` in `plugin.yaml`):
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
xcli sandbox network my-sandboxed-plugin
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
### Filesystem
|
|
78
|
+
|
|
79
|
+
Show the plugin's declared filesystem policy (`filesystem:` in `plugin.yaml`):
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
xcli sandbox fs my-sandboxed-plugin
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
!!! info "Trusted vs. Sandboxed"
|
|
86
|
+
By default, plugins are treated as **Sandboxed**. You must explicitly mark a plugin as **Trusted** in its `plugin.yaml` (and usually sign it) to run it with full permissions.
|