Repository navigation
feat(plugin): permissions declaration block (#388) - #392
Merged
Merged
Conversation
A plugin.yaml can now declare its capability surface as explicit, author-provided metadata: `permissions.controller` (env vars read, network, expected commands) and `permissions.instance` (root, network, ports opened, files managed). This is declarative, not enforced sandboxing — ports/files touched inside opaque `run` shell steps can't be inferred statically, so a plugin declares them for pre-install review. `spawn plugin validate` now checks the block: env-var names must be valid, ports in range, and controller.env must be a superset of local.env_passthrough so the declaration can't understate what the plugin actually reads. Pairs with the upcoming `spawn plugin inspect` preview (#387), which will render this block before install. Closes #388
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
This was referenced Jul 31, 2026
scttfrdmn
added a commit
that referenced
this pull request
Aug 1, 2026
* chore(deps): bump substrate test dependency to v0.81.0 Test-only; no runtime or API change (root + lambda/dns-updater). The reason to take it now is substrate#412: RunInstances previously accepted an empty ImageId and launched an instance, so our guard against launching without a resolved AMI had no offline test that could fail -- the bug we filed it for shipped, and was caught only by a paid smoke test against real AWS. Substrate now returns MissingParameter / HTTP 400 when no AMI resolves from any source (request or launch template), so that path is reachable in -short tests. Fixing it also surfaced a substrate request-parser defect: an explicitly-empty query-protocol body parameter was coerced to the bare-key sentinel "1", so ImageId= arrived as the string 1 and launched from an AMI named 1 -- affecting every EC2/IAM/STS/SQS/SNS parameter sent empty. Also newly testable offline: Invalid*ID.NotFound for explicit EC2 IDs (#391), symbolic Error.Code per service (#392), Lambda invoke omitting FunctionError and LogResult (#393), S3 Range and conditional requests (#396, #397), x-amz-checksum-* verification (#399), storage classes and CopyObject metadata directives (#398), Content-Encoding surviving a multipart upload (#406), and a seedable SQS create-then-lookup consistency window with the correct QueueDoesNotExist code -- the legacy dotted form was uncatchable as a typed error in either SDK, which is what the taskpool queue-lifecycle tests assert on (#413). Note: cmd's TestCatalogValid fails on main already (two private ECR images in the shipped app catalog, #392) and is unrelated to this bump. * fix(ttl-reaper): bump accountlifecycle past the substrate import move The Security job on this branch (and on main — this is not PR-introduced) failed with `go: updates to go.mod needed` in lambda/ttl-reaper. Cause is Go MVS plus upstream tag timing, not any commit here: ttl-reaper requires spore-host/lambda/accountlifecycle at a pseudo-version whose *test* imported substrate at its old root path. Substrate moved that package to /emulator in v0.70.0, so once v0.80.0 (2026-08-01 02:11Z) and v0.81.0 (06:12Z) were tagged — after spawn main's last green Security run (2026-07-31 17:52Z) — resolution broke with no local change involved. #509 fixed the import; this bumps the pin to that merged commit (14e273c). Verified: `go mod tidy -diff` clean, `go build ./...` clean, and govulncheck (v1.3.0, as CI pins) reports no vulnerabilities. Note the go.sum-only tidy drift in alert-handler, autoscale-orchestrator and sweep-orchestrator is pre-existing on main and does not affect govulncheck, which is what the job actually runs. Left alone here to keep this fix scoped.
This was referenced Aug 3, 2026
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.
Implements #388 (from the docs-review follow-ups).
What
Adds an optional
permissions:block toplugin.yamlso a plugin declares its capability surface up front, split by where it applies:It's declarative metadata, not enforced sandboxing — ports opened and files written inside opaque
runshell steps can't be inferred statically, so the plugin declares them for pre-install review. This is the foundation forspawn plugin inspect(#387), which will render the block before you install.Validation
spawn plugin validate(and the identical spored-sideValidate) now checks the block:controller.envnames must be valid POSIX env identifiersinstance.portsmust be in 1–65535controller.envmust be a superset oflocal.env_passthrough— since env_passthrough is what spawn actually injects, this stops the declaration from understating what a plugin readsAbsent (
nil) means "not declared" — fully backward compatible.Tests
pkg/plugin/validate_test.go: positive round-trip of a full permissions block, plus negative cases (bad env name, out-of-range port, env_passthrough not covered).Notes
gofmt/go vet/go test ./pkg/plugin/clean. (Repo-widemake checkhas pre-existing unused-var lint failures insweepgroup.go/agent.go/test/e2eand an interactiveTestCatalogValid, all unrelated to this change.)docs-genchange (spec field, not a new command/flag).Closes #388