Bläck StudioPlugin SDK v1.0.0 · API 10
Contents

Start

Building

Beyond Bläck Studio

How it runs

Sharing

Look up

What protects the writer

  • The disk: plugins reach the books only through Bläck Studio, and can't reach the disk at all. Bläck Studio's main process works only in the books and series the writer chose in the app's own dialogs, whatever the page asks. It copies into a book only files the writer picked or dropped.
  • Plugins' changes: they go through Bläck Studio's own actions, so they can be undone, and they are saved like the writer's own changes. Bläck Studio snapshots a document under the plugin's name before the plugin first rewrites it.
  • Deleting: nothing a plugin does deletes for good. trash moves an item to the trash.
  • The network: the page and its plugins can't send requests themselves. app.net.fetch goes through Bläck Studio, which allows only https, only to the hosts in the manifest or addresses the writer entered, and only to those the writer allowed. The page also can't open an address in the browser.
  • The project's folder: a plugin with project:folder reaches that folder and nothing outside it. The checks on each path are in the main process, including any links.
  • Files: a plugin reads and changes only what the writer chose for it. The main process checks this, including any links. Settings → Plugins lists what each plugin was given, so the writer can take it back. "Deleting" a file moves it to the system's trash.
  • Programs: a plugin can run only the programs named in its manifest, by name, without a shell, and Bläck Studio stops them after a time limit.
  • Permissions: the writer allows permissions in a small Bläck Studio window, in the app's theme, that opens over the main one. No plugin runs there, and the main process takes an answer only from that window, so nothing in the page can answer for the writer. Cancel has the focus, and Allow becomes active after a short delay, so a key pressed just as the window appears allows nothing. Bläck Studio asks the same way before uninstalling a plugin and before adding a list.
  • Separate tokens: each plugin's calls carry its own token. Bläck Studio makes the tokens from a secret that it gives the page's plugin host once, before any plugin loads, and it takes the means of making tokens away before any plugin runs. So a sandboxed plugin can't use what another plugin was allowed.
  • What still depends on trust: a plugin in the window shares the page with Bläck Studio. In principle it could interfere with the app or with other plugins, as in Obsidian. It could change the books that are open, or get at what another plugin in the page was allowed. It still can't reach the rest of the disk, or the network beyond what plugins were allowed. A sandboxed plugin can do none of this.
  • A crash: when a plugin throws, Bläck Studio shows the error where it happened and in Settings → Plugins, and the rest of the app carries on.
  • Safe mode: Plugins → Restart Without Plugins starts Bläck Studio without plugins. --safe-mode on the command line does the same.