Untrusted modules
Besides trusted modules, an admin can add a module of their own: a single file, a sandbox package, made by a developer they know. An untrusted module runs in a sandbox. It can only do what the admin allowed when installing it, and never sees drafts, users, visitors, form submissions or orders.
Untrusted modules are off by default. An admin switches them on with Allow untrusted modules on the Modules screen.
How to write one is in the developer guide, Untrusted modules.
What users can do
Admins:
- Allow or stop untrusted modules on this instance. Stopping only blocks new uploads: modules already installed stay as they are.
- Upload a module: choose its sandbox package (
<name>.shade-module.json, at most 1 MB). SHADE checks it and shows what it asks for, like a trusted module's consent: a line saying it is an untrusted module that gets only what it declares, then each capability in plain words with its lines:- keeping its own data (an older sandbox package always has it);
- its routes, each with whether anyone or signed-in team members call it;
- if asked: reading the published content of the site;
- if asked: emailing the admins of this site, never anyone else;
- if asked: connecting to the internet addresses it lists, and only those, over https. SHADE makes each connection itself and refuses any address inside your server's own network, also when a listed address leads there;
- its admin pages;
- if asked: work it does on its own at set times, each schedule with when it runs ("tidy (every 3600 s)"), never more often than every 15 minutes and at most five; a new schedule, or one that runs at another time, asks you again when you update it;
- and whether it wants to hear when pages or content are published.
An untrusted module may not have what only trusted modules get (processes, users' accounts, account routes…): a sandbox package that requires one cannot be installed, with one sentence saying why; an optional one is shown as Skipped. Optional capabilities have a switch and stay off unless you switch them on. - Install it on the install screen every module uses (see Managing modules), by ticking I have read what this module asks for, and install it, which agrees to its required capabilities. It is installed switched off.
- Fill in its Settings and switch it on, like a trusted module.
- Update it by uploading a newer sandbox package with the same name. If the new version asks for more than the installed one (a capability, an internet address, an admin page, and also a new route, a route made public, or a new reaction to publishing), the new requests are marked New and the admin consents again.
- Switch it off: it stops at once and its data is kept.
- Remove a module that is off, after downloading its data if wanted: the module, its stored data, its settings and everything SHADE keeps for it (messages it planned, work it queued) are deleted for good. Installed again under the same name, it starts with none of it.
- A sandbox package cannot take the name of a trusted module, also not of one installed or waiting for approval that runs only after the next restart.
Untrusted modules are marked Untrusted on the Modules screen, with their author and what they may do.
Admin pages from a module
An untrusted module may add pages for admins: forms SHADE shows with its own fields (text, numbers, choices), for example the weather stations a module should show. The consent screen lists them.
- While the module is on, its pages are in the settings area's Modules group, with their title in the admin's language.
- Save checks the fields (required ones, numbers within range) and keeps the values for the module. Its code reads them; nothing of the module runs in the admin.
- Only admins see these pages.
Signed sandbox packages
A module's maker can sign its sandbox package, so an instance can tell who made it:
- An instance trusts the signing keys set by the person who runs it. No outside service is asked.
- Signed with a trusted key: it can be uploaded even while untrusted modules are not allowed (Upload a signed module). The consent screen says who signed it, and its card's trust badge says Untrusted, and Signed by … when tapped. The consent is still asked, and the module stays untrusted: a signature says who made it, not what it may do.
- Changed after signing: refused.
- Signed with a key this instance does not trust: treated as unsigned, and the consent screen says so.
- An update without the trusted signature of the installed version is warned about on the consent screen.
Who may do it
Only admins (packages.manage). Editors and AI users cannot upload, install or remove modules.
Good to know
- Nobody checks an untrusted module's code. The sandbox limits what it can do, and how much of the server it may use: each module runs on its own with a memory cap, and SHADE watches its processing power and memory. A module that uses too much for a minute is stopped and switched off; the Modules screen says so on its card. Switch it on again once its maker fixed it.
- A module that is switched off can no longer reach SHADE at all, also in the seconds before its sandbox stops it.
- A module that crashes is in the error log once, and stays stopped until it is updated, or switched off and on again. One that fails to start is tried again about every minute.
- The person who runs the instance can change those caps (by default 128 MB of memory and half of one processor core).
- Its answers to visitors are data only, never a page.
- Its schedules run in its sandbox, as the module itself, with what you agreed to and no more: 10 seconds a run, one run of each at a time. How each run ended shows on its card on the Modules page, and a failed one in the error log, as for a trusted module. Switched off or removed, its schedules stop at once.
- Every step (allowing untrusted modules, installing, updating, removing, exporting) is in the audit log.
Limitations
By design, an untrusted module cannot change content, and adds nothing to the website's pages. Its admin pages are forms of simple fields, for admins only.