Skip to content

fix(plugin): strict launch config and plugin config decoding (#1116) - #1210

Merged
scttfrdmn merged 2 commits into
mainfrom
fix/plugin-strict-decode
Oct 20, 2026
Merged

scttfrdmn merged 2 commits into
mainfrom
fix/plugin-strict-decode

Conversation

@scttfrdmn

Copy link
Copy Markdown
Contributor

Fixes #1116

Owner decision on #1116: strict decoding is accepted as a behaviour change in this minor release (CHANGELOG ### Changed).

What changes:

  1. collectPluginDeclarations returns the loadLaunchConfig error instead of dropping it. buildLaunchConfig calls it up front, so a bad --config fails before any AWS work on the single, sweep, pipe and --dry-run paths; the user-data and Windows-guard call sites propagate it too.
  2. loadLaunchConfig decodes with yaml.Decoder.KnownFields(true), so a top-level instance_type:/ttl: or a plugins: entry written as name: is an error naming the line, with a hint about the file's shape. An entry with no ref is an error naming its index. An empty file is still an empty config.
  3. PluginSpec.ResolvedConfig no longer passes undeclared keys through. It rejects them and lists the keys the plugin accepts (or says it declares none). This covers spawn plugin install --config, spored's launch-time install and preflight.

Gates, each watched failing against a revert that compiles:

  • TestCollectPluginDeclarations_BadConfigFileIsAnError and TestBuildLaunchConfig_RefusesBadLaunchConfigFile fail when the error is dropped again (if cfg, err := ...; err == nil).
  • TestCollectPluginDeclarations_BadConfigFileIsAnError (name/instance_type/confg cases) fails with KnownFields(false).
  • TestResolvedConfig_RejectsUndeclaredKeys fails with the rejection disabled (&& false).

Not changed: spored's launch-time path still only logs a resolve config failure. As before for a missing required key, it records no plugin state, so spawn plugin status shows nothing. The CLI install path surfaces it.

Related: the spore-plugins integration workflow passes auth_key to tailscale, which declares only tag (required). It already failed on the missing tag, and now fails on auth_key as well. Tracked in spore-host/spore-plugins#29.

Checks: make check passes up to check-build-tags, which fails identically on unmodified main in a /private/tmp worktree. semgrep is clean. No help text changed.

@scttfrdmn scttfrdmn added this to the v0.137.0 milestone Oct 20, 2026
@codecov

codecov Bot commented Oct 20, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 78.04878% with 9 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
cmd/launch_sweep.go 0.00% 4 Missing ⚠️
cmd/launch_single.go 25.00% 1 Missing and 2 partials ⚠️
cmd/launch_config.go 83.33% 1 Missing and 1 partial ⚠️

📢 Thoughts on this report? Let us know!

A missing or unparseable launch --config file, unknown launch.yaml keys
(name: instead of ref:, instance_type:), an empty ref and undeclared
plugin config keys were all accepted silently; each is now an error.
@scttfrdmn
scttfrdmn force-pushed the fix/plugin-strict-decode branch from 939bd8f to 44bf007 Compare October 20, 2026 06:11
@scttfrdmn
scttfrdmn merged commit fefc1b3 into main Oct 20, 2026
9 checks passed
@scttfrdmn
scttfrdmn deleted the fix/plugin-strict-decode branch October 20, 2026 06:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Plugin declarations fail silently: a missing --config file, unknown launch.yaml keys and undeclared plugin config keys are all accepted

1 participant