# Plugin security

A plugin is code someone else wrote. Phantom limits what it can see and
what it can break, and is plain about what it cannot prevent.

## What Phantom does

- **Nothing runs on install.** A package is checked (size, file kinds,
  paths, manifest) and stored disabled.
- **Consent before running.** A plugin runs only after you grant every
  permission it asks for, and an update that asks for more is disabled
  until you grant again.
- **A separate process per call.** Each call starts a new Python process
  in isolated mode, in an empty working folder, with an environment that
  holds none of Phantom's settings, tokens or keys. It cannot import
  Phantom or the libraries installed for it (only the standard library,
  the SDK and the package's own files), and it never touches the
  database.
- **Signatures you choose to trust.** A package signed by a publisher
  you trust is marked as theirs, its updates must come from the same
  publisher, and you can refuse unsigned packages; see
  [Signing plugins](./signing).
- **Only the call's data.** The process gets exactly the report, file or
  body of that call. Reports and bodies are masked by your export policy
  before the plugin sees them, like a download: by default credentials
  are replaced, and in *ask* mode they stay masked unless you reveal them.
- **Limits.** 20 seconds per call; on Linux and macOS also CPU time and
  1 GiB of memory; at most 32 MiB of reply.
- **Untrusted replies.** Every reply is checked for its shape and size.
  Imported entries go through the same validation as a HAR file. Body
  views are shown as plain text. Report formats cannot be HTML or SVG,
  and downloads are served with a policy that runs no script.
- **Failures stay contained.** Errors, crashes and timeouts end that
  call; three in a row disable the plugin.
- **Yours only.** Agents cannot manage or call plugins.

## What it does not do

The plugin's process runs as **your operating system user**. It can read
files your user can read and open network connections. Phantom does not
sandbox the filesystem or the network, because no portable way to do so
exists for Python across Linux, macOS and Windows.

So treat installing a plugin like installing any program:

- Install plugins only from authors you trust, and prefer signed ones.
- Read the source; plugins are small Python files, and the package is
  what you install.
- Compare the SHA-256 shown in Settings › Plugins with the one the author
  published.
- Pin a plugin you have reviewed, so an update cannot replace it
  unnoticed.

In Docker, the backend container runs as an unprivileged user, so a
plugin there reaches only what that container can.

## Distribution

Phantom has no plugin registry or automatic downloads: you install
packages you chose. A public catalog with signed packages, publisher
identity and security reporting is planned for later and will come with
its own review of dependencies and signing.

## Reporting a problem

If a plugin misbehaves, disable it and report it to its author. If you
find a way for a plugin to get past these limits, report it to Phantom as
a security issue (see [Support](../support.md)).
