mesh/merge-gate head a1a6f6493d50 merged into trunk f10aedac5880 — pass: builds build-agent, mesh-controller → ace, g14, novox, shanks; no bus step; every …
mesh/repo-check head a1a6f6493d50 merged into trunk f10aedac5880 — pass: its merge-check.sh passed
mesh/delivery delivered
Every argument of plans that names a plan (id, wait, stop, close, retry, go) is checked once where the call becomes a command line, against the ids the mesh gives plans (plan-<digits>, release-<digits>), so a quote from a caller never reaches a command or the store (review 75 on #266).
38 lines
1.3 KiB
Go
38 lines
1.3 KiB
Go
package main
|
|
|
|
import (
|
|
"strings"
|
|
"testing"
|
|
)
|
|
|
|
// **A plan's id is checked once, where a call becomes a command line** (novox/hq issue 561): every argument of
|
|
// plans that names a plan is refused unless it is an id the mesh gives a plan, so a quote never reaches a
|
|
// command, nor the store behind it.
|
|
func TestAPlanIdThatIsNoPlansIdIsRefusedBeforeACommandStarts(t *testing.T) {
|
|
for _, arg := range []string{"id", "stop", "close", "retry", "go"} {
|
|
for _, bad := range []string{"x' or '1'='1", "plan-1'", "plan-", "plan-1 2", "batch-1", "PLAN-1"} {
|
|
args := map[string]any{arg: bad}
|
|
if arg == "stop" || arg == "close" || arg == "go" {
|
|
args["why"] = "a test"
|
|
}
|
|
argv, err := argvFor("plans", args)
|
|
if err == nil {
|
|
t.Errorf("plans %s %q was composed: %v", arg, bad, argv)
|
|
continue
|
|
}
|
|
if !strings.Contains(err.Error(), "is not a plan's id") {
|
|
t.Errorf("plans %s %q was refused for another reason: %v", arg, bad, err)
|
|
}
|
|
}
|
|
for _, good := range []string{"plan-1791813626034291775", "release-1791811938267404408"} {
|
|
args := map[string]any{arg: good}
|
|
if arg == "stop" || arg == "close" || arg == "go" {
|
|
args["why"] = "a test"
|
|
}
|
|
if _, err := argvFor("plans", args); err != nil {
|
|
t.Errorf("plans %s %q was refused: %v", arg, good, err)
|
|
}
|
|
}
|
|
}
|
|
}
|