Skip to content

plugin validate accepts step fields and step types that the executors ignore or reject #1130

Closed

Description

@scttfrdmn

spawn plugin validate --strict passes specs that the executors then run differently from how they're written. Each case below is checked against main (pkg/plugin/validate.go, pkg/plugin/local_executor.go, pkg/pluginruntime/remote_executor.go):

  1. push in local.deprovision passes validation, because validate.go:183 allows run or push. But RunDeprovision (local_executor.go:161-166) returns unsupported deprovision step type, so the error only appears at teardown.
  2. local.reconcile is validated (validate.go:184, :227, :360), but nothing outside spec.go:102 and the validator reads Local.Reconcile, so those steps never run.
  3. capture: on a remote step is ignored. remote_executor.go never reads step.Capture, so outputs captured on the instance are silently empty.
  4. background: / as_user: on a local step are ignored. local_executor.go reads neither.

Fix: decide per case whether to implement it or reject it, and make the validator say so. A validator gate should then check that every Step field and type the validator accepts in a section is read by that section's executor (discover the fields from the struct; don't list them).

Related, found the same way:

  • Local steps get no {{ instance.login_user }}, so spore-sync hardcodes ec2-user.
  • spec.go:138 says "the registry's publish-time CI requires it [sha256] on official plugins' fetch steps". Nothing in spore-plugins' .github, tests or scripts checks a step sha256. (spored does enforce it when set: remote_executor.go:210-216.)
  • template.go:167 says "Instance values are trusted … and left unescaped", but shellEscapeContext quotes them too (:176-178).

Found during spore-host/spore-host#585 part 2.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions