Repository navigation
Conversation
A sync plugin is a program the bundle brings and the server runs: in a sandbox and under a compute budget, but with no memory limit short of its address space, and inside the server's own process. A server that deploys for others had run whichever a bundle brought. - `AllowedPlugins`: any, for a server on the user's own machine; or the ones known, by the sha256 of the module, which is also what `icp project bundle` records for it. Never by name or path, which are the bundle's. `KNOWN_PLUGINS` is the built-in list: the static-site sync plugin v1.0.0 and v0.4.3, and the asset canister sync plugin. - Held twice. On the upload (`vet_plugins`): the project is loaded once the bundle has arrived, and every canister it declares looked at, so the refusal comes then (422) and the bundle is not kept; a project that does not load is refused there too. And by the deploy (`check_bundle`), on the modules it is about to run for the canisters it is deploying, before anything is created. The refusal names the plugin's hash and what the server runs. - `DeployConfig::allowed_plugins` (`MCP_DEPLOY_ALLOWED_PLUGINS` on the bundled binary) adds hashes to the built-in list; one that is not a sha256 stops the server from starting. - The upload outcome `plugin_not_allowed` is counted. Co-Authored-By: Claude Fable 5.2 <[email protected]> Claude-Session: https://claude.ai/code/session_01XSXgo38kH12wagL3rstXfV
There was a problem hiding this comment.
🟡 Changes recommended
Plugin allow-list propagation lacks regression coverage, while generated curl commands suppress plugin-refusal details and deployment guidance incorrectly recommends rebuilding for every 422 response.
2 open issues
What changed in this PR
Adds hash-based sync-plugin allowlisting to hosted deployments ahead of gateway use, while leaving local deployments unrestricted.
Changes:
- Checks plugin module hashes during upload and deploy preflight.
- Supports operator-added hashes through configuration, rejecting malformed entries at startup.
- Adds refusal metrics, tests, and documentation for the hosted plugin policy.
| File | Description |
|---|---|
src/metrics/deploy.rs |
Adds the plugin_not_allowed upload outcome. |
src/main.rs |
Parses the plugin allowlist environment variable. |
src/deploy.rs |
Applies hosted policy and maps refusals to HTTP 422 and metrics. |
README.md |
Documents trusted plugins, configuration, and refusal behavior. |
deploy/native/README.md |
Explains plugin policy for native deployments. |
crates/imcp2-deploy/static/skills/deploy-with-mcp.md |
Guides agents on handling unlisted plugins. |
crates/imcp2-deploy/src/uploads.rs |
Vets uploaded plugins and discards refused bundles. |
crates/imcp2-deploy/src/lib.rs |
Exports policy types and selects hosted versus local policy. |
crates/imcp2-deploy/src/host.rs |
Defines known hashes, validates policies, and checks plugin bytes. |
crates/imcp2-deploy/src/deploy.rs |
Carries plugin policy into deploy preflight. |
Review effort: Max
Comment on lines
+74
to
+75
| on the upload (`422`) or by the deploy, and the refusal lists the hashes | ||
| the server runs. That is not something to retry or work around: tell the |
| let uploads = | ||
| Uploads::with_budget(dir.join("uploads"), config.limits(), config.stored_bytes()); | ||
| Uploads::with_budget(dir.join("uploads"), config.limits(), config.stored_bytes()) | ||
| .allowing(plugins); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Stacked on #252. Last of four follow-ups preparing the hosted deploy tools for the gateway.
Why
A sync plugin is a program the bundle brings and the server runs. It runs in a sandbox (WASI, read-only access to its own deploy directory, no network) under a compute budget, but with no memory limit short of its address space, and inside the server's own process. In the gateway that process is the gateway. Until now a hosted server ran whichever plugin a bundle carried.
What changes
A hosted server runs only the plugins it knows, identified by the SHA-256 of the module. That is the same hash
icp project bundlerecords for the plugin, and the bundler writes the plugin's bytes verbatim, so it is the hash of the released file. Name and path are never used, since the bundle chooses both.Built-in list (
KNOWN_PLUGINS):6deedcc2127a3bda014af9e08aff83ee58c95125050acb296676aa234906a08eafb5d626761e891a42e5c36e8799bf521823de9f55c5102860bd3a237d3b164fca7cb5666c30d2875f8d5e10535f8a53f97a86c79c263f7d5bdac2fdd1bbf83cThe check runs twice:
vet_plugins). Once the bundle has arrived the project is loaded and every canister it declares is checked, whichever environment a deploy would later name. A bundle with an unlisted plugin gets422and is not kept.check_bundle). The modules about to run, for the canisters being deployed, are checked before anything is created. This is the authoritative check.The refusal names the plugin's path and hash and lists what the server runs.
Configuration
DeployConfig::allowed_pluginsadds hashes to the built-in list (MCP_DEPLOY_ALLOWED_PLUGINSon the bundled binary, comma- or space-separated). An entry that is not a SHA-256 makesDeploys::newfail, so the server does not start on a list it misread.The local server is unchanged: the bundle there is the user's own, and it runs whatever the bundle brings.
Side effects worth knowing
plugin_not_allowedinimcp2_deploy_uploads_total.Not done here
The plugin runtime still has no memory limiter; that belongs upstream in
icp-sync-plugin. With this change the question of what an unknown plugin might allocate is answered by not running it.Testing
422, and the counter.deploy-feature tests pass; clippy clean with and without the feature.🤖 Generated with Claude Code
https://claude.ai/code/session_01XSXgo38kH12wagL3rstXfV