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).
27 lines
1.0 KiB
Go
27 lines
1.0 KiB
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"regexp"
|
|
)
|
|
|
|
// planID is every id the mesh gives a plan: a merge's walk or batch (plan-<nanoseconds>) or a release
|
|
// (release-<nanoseconds>).
|
|
var planID = regexp.MustCompile(`^(plan|release)-[0-9]+$`)
|
|
|
|
// planIDArguments are the arguments of plans that name a plan. wait is among them for when it is declared
|
|
// (novox/hq issue 229); an argument not declared is refused before this is asked.
|
|
var planIDArguments = []string{"id", "wait", "stop", "close", "retry", "go"}
|
|
|
|
// plainPlanIDs refuses a plans call naming a plan by anything but a plan's id (novox/hq issue 561): checked
|
|
// once, where the call becomes a command line, so nothing else a caller sent reaches a command or the store.
|
|
func plainPlanIDs(given map[string]string) error {
|
|
for _, arg := range planIDArguments {
|
|
if id, named := given[arg]; named && !planID.MatchString(id) {
|
|
return fmt.Errorf("plans %s: %q is not a plan's id (plan-<digits> or release-<digits>, as `plans` "+
|
|
"lists them); nothing was done", arg, id)
|
|
}
|
|
}
|
|
return nil
|
|
}
|