Safeguard
Developer Tools•

What can a SwiftPM build tool plugin access on your machine?

SwiftPM build tool plugins run in a sandbox with no network and limited file access. See what they can read and write, and what risk remains for teams.

Safeguard Security Team
3 min read

A SwiftPM build tool plugin runs in a sandbox that blocks network access and restricts file system access. It can read the package directory and write to specific output directories. The proposal still names the risk of running third party build tools, so review plugins as you would any code that runs during your build.

What a plugin is

Under Swift evolution proposal SE-0303, a plugin is a Swift script in a plugin target that uses the PackagePlugin API. It does not do the build work itself. It returns build commands. SwiftPM runs it after package resolution and before building, once for each target that lists it.

What it can and cannot do

AreaAllowed or blocked
NetworkBlocked by the sandbox
ReadThe package directory, target context, input files, dependency closure
WriteA per plugin work directory and the built products directory
ToolsExecutables from the plugin's declared dependencies
LibrariesPackagePlugin and the Swift standard library at first

Each generated build command also runs in a sandbox that blocks network access and allows writes to the output directories the plugin names.

Where the risk remains

The sandbox limits damage, but a plugin still runs on developer machines and CI. It runs the tools it declares, and those tools generate code that is compiled into your app. A malicious or compromised plugin could generate source that behaves badly at runtime, even if it cannot call out during the build.

The proposal says plainly that running third party build tools carries inherent risk. It suggests that requiring the root package to approve plugins could help, and defers that to a later proposal. Check current Xcode and SwiftPM behaviour for how approval works today.

A review checklist

  1. List every plugin your dependency graph brings in, including transitive ones.
  2. Read what each plugin generates and which tools it runs.
  3. Prefer plugins from maintainers you can identify, and pin their versions.
  4. Re-review when a plugin updates, as you would for any code dependency.
  5. Keep plugin versions in your dependency inventory, next to libraries.
  6. Run CI builds with the same resolved versions you reviewed.

Try it yourself

Click through it at your own pace, or open it full screen. Watch how a change to dependencies can be checked before it merges, which is where a new plugin should be reviewed.

Safeguard builds an SBOM and scans your dependencies for known vulnerabilities, and you can run a free scan at gold.safeguard.sh/scan to see what your own project pulls in.

Quick check

Can a build tool plugin call a server?

Per SE-0303 the sandbox prevents network access for the plugin and its generated commands.

So are plugins safe by default?

They are constrained, not risk free. Generated code still ships in your app, so review the plugin and pin it.

Sources

Last reviewed: 19 October 2026.

Never miss an update

Weekly insights on software supply chain security, delivered to your inbox.

Self-healing security runs on Safeguard.

Your first fix PR is minutes away.

No sales call required, even your agent can complete the purchase over MCP.