Skip to content

Plugin push: encrypt calls that travel over SSM - #1604

Merged
scttfrdmn merged 1 commit into
mainfrom
fix/sec-plugin-push-sealed
Nov 12, 2026
Merged

scttfrdmn merged 1 commit into
mainfrom
fix/sec-plugin-push-sealed

Conversation

@scttfrdmn

Copy link
Copy Markdown
Contributor

Encrypts plugin push-API calls that go over SSM.

When spawn plugin install|status|list|remove|push can't use SSH (no public IP, keyless, or SSH failing), it runs the loopback call on the instance over SSM SendCommand (#855). SSM command history keeps that text and its output. Over SSM, each call now travels sealed both ways.

Design (pkg/pushseal)

  1. GET /v1/seal-key: spored generates a single-use HPKE keypair (ML-KEM-768 + X25519, HKDF-SHA256, AES-256-GCM). It keeps the private half in memory and returns the public half.
  2. spawn seals {method, path, body, reply_key} to that key, using a reply keypair generated for this one call, and sends it to POST /v1/sealed.
  3. spored takes the key (single use, expires unused after 5 min, at most 16 held), opens the request, dispatches it to the push API's own routes, and seals the answer to the reply key.

SSM's history ends up holding only public keys and ciphertext. Both private keys exist only in memory for the length of one call, so nothing recorded can be opened later. The sealed endpoints sit behind the existing bearer-token middleware. A sealed request may only name a /v1/ push-API route: nesting, absolute URLs and other methods are refused.

  • Older spored (no /v1/seal-key, so a 404): spawn refuses the SSM path with a message to run spawn upgrade-spored <id> or use SSH. It never falls back to sending in clear.
  • SSH path: unchanged.
  • Stored state: the push token never leaves the instance (unchanged). The staging files hold only ciphertext and are removed after each call, as before. No AWS resource is created, so there is nothing to delete.

Deploy checklist impact

  • spored: the new push-API endpoints ship in spored with the release. Instances that are already running need spawn upgrade-spored before they accept plugin calls over SSM. Needs the owner's live check before merge (steps are in the PR comment).
  • No Lambda, IAM, CloudFormation or table changes.

Tests

pkg/pushseal: round trip, no plaintext on the wire, single-use and expiry, key cap, tamper rejection, inner-route allow-list. pkg/pluginruntime: a sealed status call through the real push API with auth. cmd: the existing SSM sandbox tests run the real SendCommand scripts under sh/curl against a sealing spored. They now also assert that neither the pushed secret, the config nor the spec appear in any script, any output, or anything the staged base64 decodes to. A status answer carrying a password stays out of the record too. An older spored is refused with nothing sent. A deliberate revert to clear-text SSM makes these gates fail. make check is green. semgrep scan --config=auto --error on the changed paths is clean.

@scttfrdmn

Copy link
Copy Markdown
Contributor Author

Live check before merge (owner; spore-host-dev, TTL on every launch, leak-check after)

  1. Build spawn and a linux/amd64 spored from this branch, as in Move session tokens out of EC2 tags #1603.
  2. spawn-pr launch --ttl 1h --no-public-ip (an SSM-only instance), then swap in the branch spored over SSM.
  3. spawn-pr plugin install <plugin taking a secret> --instance <id> --config <key>=LIVECHECK123, then spawn-pr plugin status <plugin> --instance <id>. Both should succeed.
  4. aws ssm list-commands --instance-id <id> --details, plus get-command-invocation output for each command id: grep -c LIVECHECK123 should be 0 in both.
  5. Against an instance on the published (older) spored, the same install is refused, and the message names spawn upgrade-spored.
  6. Terminate and leak-check.

@codecov

codecov Bot commented Nov 12, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 77.70701% with 35 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
pkg/pushseal/pushseal.go 78.83% 29 Missing ⚠️
cmd/plugin_push.go 68.75% 5 Missing ⚠️
pkg/pluginruntime/pushapi.go 75.00% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

@scttfrdmn

Copy link
Copy Markdown
Contributor Author

Live check passed (spore-host-dev us-east-1, 2026-11-12, t3.small). Inbound SSH was blocked with a temporary no-ingress SG and the local SSH control master closed, so the push really went over SSM.

step result
`plugin install jupyterlab --config token=…` against the published spored (0.163.2) refused: "spored predates encrypted plugin delivery over SSM; … would be stored in clear in SSM command history". 1 SSM command (the version probe); the config value appears nowhere.
swap in this PR's spored, same install succeeded over SSM (10 SendCommand calls), and `plugin status` works
config value in any SSM command's parameters 0 (also 0 as base64)
config value in any command invocation output 0

Teardown: the instance is terminated, and the temporary SG and scratch bucket are deleted. An independent leak check found nothing left.

Over SSM a push-API call's text and output are kept in SSM command
history. spored now hands out single-use HPKE keys (ML-KEM-768+X25519)
at /v1/seal-key and serves sealed calls at /v1/sealed; spawn seals the
request and a per-call reply key to it, so the history holds only public
keys and ciphertext. A spored without the endpoint is refused over SSM
rather than sent clear text.
@scttfrdmn
scttfrdmn force-pushed the fix/sec-plugin-push-sealed branch from 00fe277 to a687ac6 Compare November 12, 2026 19:46
@scttfrdmn
scttfrdmn marked this pull request as ready for review November 12, 2026 19:46
@scttfrdmn
scttfrdmn merged commit 8247055 into main Nov 12, 2026
9 checks passed
@scttfrdmn
scttfrdmn deleted the fix/sec-plugin-push-sealed branch November 12, 2026 20:04
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.

1 participant