Skip to content

Keep plugin secrets out of user data (#1590) - #1616

Merged
scttfrdmn merged 2 commits into
mainfrom
fix/1590-plugin-config-userdata
Nov 13, 2026
Merged

scttfrdmn merged 2 commits into
mainfrom
fix/1590-plugin-config-userdata

Conversation

@scttfrdmn

Copy link
Copy Markdown
Contributor

Fixes #1590

What

  • No secrets in user data. BuildLinuxBootstrap writes every launch's plugin declarations into user data. It now refuses a declaration whose config sets a secret-named key, for every caller: spawn launch --config, sweeps, and SDK callers of pkg/launcher (lagotto, mcp).
    • The test is plugin.IsSecretConfigKey. It matches any key containing password, passwd, passphrase, secret, token or credential, plus key or *key unless the key is a public key.
    • That covers the registry's secret config by the names the plugins actually use: code-server and rstudio-server password, jupyterlab token, tailscale auth_key, globus setup_key.
    • The refusal names the plugin and key, never the value, and says to use spawn plugin install <instance> <ref> --config key=value. That path reaches spored over SSH, or sealed over SSM since Plugin push: encrypt calls that travel over SSM #1604.
    • The check is name-based because the CLI never sees the spec at this point; the instance resolves the ref.
  • Specs can mark secrets. ConfigParam gains secret: true. spored refuses a launch-declared plugin that sets such a key, and records the reason with recordDeclarationFailure, so spawn plugin status shows how to fix it. This catches a CLI older than this PR, or a secret whose name the pattern misses.
  • Root-only file. /etc/spawn/plugins.json is now 0600, and written inside (umask 077; cat > …) so it is never briefly world-readable. spored runs as root.

Tests

  • TestIsSecretConfigKey, TestCheckDeclarationsCarryNoSecrets (the refusal never echoes the value), TestSpecSecretKeys.
  • TestBuildLinuxBootstrap_PluginDeclarationsCarryNoSecrets covers the refusal plus 0600/umask. I watched it fail with the check disabled.
  • TestDeclaredSecretsRefusesSpecMarkedSecrets.

User data changes: the per-launch prefix's plugins.json write is now 0600/umask; the signed bootstrap body is untouched. No IAM or spored policy change, so no schema bump.

Live checks needed before merge (owner)

Run in 435415984226, with --ttl 15m.

  1. A --config file declaring code-server with config: {password: x} must make spawn launch refuse before any RunInstances, naming code-server: password. Check that no instance exists.
  2. A --config file declaring a plugin with only non-secret config (e.g. globus-connect endpoint_name) should launch normally.
    • spawn connect <i> -- stat -c '%a %U' /etc/spawn/plugins.json should print 600 root.
    • spawn plugin status <i> should show the plugin installed.
  3. On that instance, spawn plugin install <i> code-server --config password=x should work over SSM (sealed). aws ssm list-commands --region us-east-1 --query 'Commands[0].Parameters' should not contain x.
  4. Terminate the instance and leak-check.

The registry specs (spore-plugins) can add secret: true to their password/token/auth_key params. This PR does not need it.

@codecov

codecov Bot commented Nov 13, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 91.30435% with 4 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
pkg/pluginruntime/runtime.go 69.23% 4 Missing ⚠️

📢 Thoughts on this report? Let us know!

@scttfrdmn

Copy link
Copy Markdown
Contributor Author

Live check (spore-host-dev, 2026-11-13). The build integrated #1612, #1613, #1614 and #1616 on main.

Not run live: Windows (#1617), the egress proxy (#1618), the release manifest (#1619), retiring a reused DCV/MPI group, and interactive spawn connect.

scttfrdmn and others added 2 commits November 13, 2026 15:15
Plugin declarations travel in EC2 user data, readable with
ec2:DescribeInstanceAttribute, and were written to a 0644
/etc/spawn/plugins.json. The bootstrap now refuses a declaration whose
config sets a secret-named key (password, token, *key, *secret*, ...),
for every caller, and says to set it with spawn plugin install, which
reaches spored over SSH or sealed over SSM. plugins.json is written
0600 under umask 077. Specs may mark a key secret: true, which spored
refuses from a launch declaration.
@scttfrdmn
scttfrdmn force-pushed the fix/1590-plugin-config-userdata branch from e83fdb5 to db772f4 Compare November 13, 2026 23:16
@scttfrdmn
scttfrdmn marked this pull request as ready for review November 13, 2026 23:16
@scttfrdmn
scttfrdmn merged commit 53252e0 into main Nov 13, 2026
9 checks passed
@scttfrdmn
scttfrdmn deleted the fix/1590-plugin-config-userdata branch November 13, 2026 23:33
@scttfrdmn scttfrdmn mentioned this pull request Nov 14, 2026
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.

security: Plugin config from launch --config files is written into EC2 user-data and a world-readable /etc/spawn/plugins.json

1 participant