Skip to content

Plugin pushes only buffer in memory: both real transports (SSM, SSH tunnel) are never constructed #810

Closed

Description

@scttfrdmn

PushClient has three implementations. Only the in-memory buffer is ever
instantiated, so pushed plugin data never reaches an instance.

Evidence

$ grep -rn 'func New.*PushClient' --include='*.go' pkg/plugin/ | grep -v _test
pkg/plugin/push_ssh.go:28:func NewSSHTunnelPushClient(host, keyPath string) *SSHTunnelPushClient {
pkg/plugin/push_ssm.go:27:func NewSSMPushClient(ctx context.Context, instanceID, region string) (*SSMPushClient, error) {
pkg/plugin/local_executor.go:35:func NewBufferingPushClient() *BufferingPushClient {

$ grep -rn 'NewBufferingPushClient|NewSSMPushClient|NewSSHTunnelPushClient' \
    --include='*.go' . | grep -v '_test|func New'
cmd/plugin.go:212:	pushBuf := plugin.NewBufferingPushClient()

One construction site in the entire repo, and it is the buffer.

Both real transports are fully implemented and entirely unreachable — 7
functions across the two files, confirmed dead by whole-program reachability
intersected across all three GOOS targets:

  • push_ssm.go — SSM Parameter Store delivery, 2/2 functions dead
  • push_ssh.go — SSH tunnel to spored's push API, 5/5 functions dead

Why this looks like a gap rather than cleanup

spored runs a push API on loopback (pkg/pluginruntime/pushapi.go) with a
per-start 32-byte token, constant-time comparison, and delivery intended over an
SSH port-forward. The security review assessed that server as correctly
built
— auth middleware wrapping the whole mux, loopback-only bind, 0600 token
file.

So there is a well-made receiver, a well-made SSH transport to reach it, and
nothing that connects the two. BufferingPushClient accumulates in memory in
the CLI process and exits with it.

That is the shape of a feature whose last wire was never attached, not of
deliberately dead code — which is why I am filing it as a defect rather than
folding it into the dead-code inventory.

What needs deciding

  1. Is plugin push meant to work? If yes, cmd/plugin.go:212 should select
    a transport — SSH tunnel when a key is available, SSM otherwise — rather than
    always buffering. The constructors already take exactly the arguments the
    command has to hand (host/keyPath, or instanceID/region).
  2. If not, say so: remove the two transports, and make the buffering client's
    behaviour explicit in the command's help so nobody believes data was
    delivered.

Either way the current state is the worst of the three: a command that appears to
push, succeeds, and delivers nothing.

Worth checking against the plugin-push work in spore-plugins#26 before choosing —
this may be a known-unfinished edge rather than a regression.

Activity

  1. added
    bug
    on Oct 11, 2026
  2. scttfrdmn commented on Oct 11, 2026

    @scttfrdmn
    ContributorAuthor

    The premise is wrong: pushed plugin data does reach the instance. Correcting before the
    PR, because the issue's framing — "a command that appears to push, succeeds, and delivers
    nothing" — would lead someone to wire up a transport that is not needed.

    There is no spawn plugin push command

    $ spawn plugin --help
      gen-index  info  inspect  install  list  manifest  remove  search  status  validate
    

    Buffering IS the delivery mechanism

    cmd/plugin.go says so where it constructs the client:

    Push steps are buffered rather than delivered immediately, so their values can be handed
    to spored with the install request below — that guarantees they are present before the
    remote configure phase runs.

    And it does exactly that, at line 254:

    remotePluginInstall(ctx, sshHost, spec, resolvedCfg, pushBuf.Values(), prov)

    remotePluginInstall then reaches the live receiver:

    token, err := sshReadToken(ctx, instance, pluginKeyPath)
    withSSHTunnel(ctx, instance, pluginKeyPath, func() (*http.Response, error) {
        POST http://127.0.0.1:7777/v1/plugins/install  // Bearer token

    So the chain is complete and live: local push steps → BufferingPushClient →
    pushBuf.Values() → install request → SSH tunnel → spored's push API. Delivering values
    one at a time, as the dead transports would, could not give the ordering guarantee the
    install request does.

    What actually was dead

    pkg/plugin/push_ssh.go (127 lines) and push_ssm.go (52) — two alternative
    PushClient implementations that nothing constructed. The SSH one duplicates the tunnel
    and token helpers cmd/plugin.go already has and uses. Genuinely dead, genuinely
    superseded, and removed in the PR.

    So this is a dead-code removal, not a broken feature. The receiver was never clientless.

    Why the misreading was reasonable

    The doc comment on BufferingPushClient read: "records pushes in memory instead of
    delivering them to a remote runtime"
    . That is a fair description of the type and a
    misleading description of the system, and it is what three independent reads keyed on. The
    PR rewrites it to state that buffering is how delivery works, and why — the same move as
    #809, where a Go-only reading of a shell-delivered cert produced the opposite error.

    One real thing this surfaced: #855

    plugin install needs SSH unconditionally, so it cannot work on a keyless SSM-only
    instance — which spawn deliberately supports (Windows SSM-first, keyless connect,
    Provision's "keyless: SSM-only, like the Lambda" path that lagotto uses). The deleted
    push_ssm.go was a sketch of exactly that missing capability, so I filed #855 rather than
    let the gap disappear with the code.

  3. added a commit that references this issue on Oct 11, 2026
    6afc062
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions