carlos / platform Public

secrets set: read a value from stdin; refuse KEY=KEY=... (#1056)

carlos secrets set --app A KEY - takes KEY's value from stdin, so a
secret never sits in argv where a process list on a shared box shows
it. Two arguments, so it cannot collide with a value: KEY=- still sets
"-". Stdin is read to EOF after every argument has parsed, one trailing
\n or \r\n is dropped, and an empty result meets the existing
empty-value refusal. One stdin key per command. A terminal on stdin is
refused without reading; the check is go-isatty, as domains buy uses,
because /dev/null passes color.go's char-device test.

secrets set and env set (they share parseKV) refuse a value that starts
with its own key and "=", naming the key and never the value. The
clireg golden lines for the secrets usage carry the new form.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev pushed by paul@keymail.dev e1ee3f7f5d2d0bdb5af5ae4ff498ae7b18e16bbe parent b280257
3 files changed, +281 −10
  • appconfig_cli.go +84 −4
  • secrets_stdin_test.go +191 −0
  • testdata/clireg-golden.jsonl +6 −6
diff --git a/appconfig_cli.go b/appconfig_cli.go
index 21339db3d..bb25ac501 100644
--- a/appconfig_cli.go
+++ b/appconfig_cli.go
@@ -23,6 +23,7 @@ import (
"github.com/carlosframework/platform/internal/moves"
"github.com/carlosframework/platform/internal/registry"
"github.com/carlosframework/platform/internal/release"
+ "github.com/mattn/go-isatty"
)
// restartAnswer is what one config write can be said to have left behind
@@ -413,13 +414,47 @@ func unsetVars(ctx context.Context, s release.Store, acct, app, environment stri
}
// parseKV turns ["KEY=value", "KEY2=value2"] into a map, refusing anything
-// without an "=" or with an empty key. Shared by `env set` and `secrets set`.
+// without an "=" or with an empty key, or a value that starts with its own
+// key and "=". Shared by `env set` and `secrets set`.
func parseKV(args []string) (map[string]string, error) {
+ return parseSecretsArgs(args, nil)
+}
+
+// secretsStdin is where `secrets set KEY -` reads its value, and whether
+// that is a terminal. go-isatty, as `domains buy` uses, rather than
+// color.go's char-device test: /dev/null is a char device, and a script
+// running with stdin from it should get the empty-value refusal, not be
+// told it is at a terminal. A var so tests can stand a pipe in.
+var secretsStdin = func() (io.Reader, bool) { return os.Stdin, isatty.IsTerminal(os.Stdin.Fd()) }
+
+// parseSecretsArgs is parseKV plus `secrets set`'s stdin form (#1056): a
+// key followed by a lone "-" takes its value from stdin, read to EOF with
+// exactly one trailing newline (\n or \r\n) taken off, so the value never
+// sits in argv where a process list on a shared box shows it. Two separate
+// arguments, so it cannot collide with a real value: "KEY=-" still sets
+// "-". One such key per invocation, stdin read only after every argument
+// parsed, and never when stdin is a terminal, where nobody would know the
+// blinking cursor wants a secret. stdin nil (env set) leaves the form
+// unrecognised, which is parseKV's old not-a-pair refusal.
+//
+// An empty value is returned as such: checkNoEmptyValues refuses it with
+// the same words an empty KEY= gets.
+func parseSecretsArgs(args []string, stdin func() (io.Reader, bool)) (map[string]string, error) {
if len(args) == 0 {
return nil, fmt.Errorf("at least one KEY=value pair is required")
}
out := map[string]string{}
- for i, a := range args {
+ stdinKey := ""
+ for i := 0; i < len(args); i++ {
+ a := args[i]
+ if stdin != nil && a != "" && a != "-" && !strings.Contains(a, "=") && i+1 < len(args) && args[i+1] == "-" {
+ if stdinKey != "" {
+ return nil, fmt.Errorf(secretsCopyStdinTwice, stdinKey, a)
+ }
+ stdinKey = a
+ i++
+ continue
+ }
k, v, ok := strings.Cut(a, "=")
if !ok || k == "" {
// Named by position, never echoed: a mistyped `secrets set`
@@ -427,11 +462,55 @@ func parseKV(args []string) (map[string]string, error) {
// shell scrollback.
return nil, fmt.Errorf("argument %d is not a KEY=value pair", i+1)
}
+ if err := checkValueNotNamed(k, v); err != nil {
+ return nil, err
+ }
out[k] = v
}
+ if stdinKey == "" {
+ return out, nil
+ }
+ r, terminal := stdin()
+ if terminal {
+ return nil, fmt.Errorf(secretsCopyStdinTerminal, stdinKey, stdinKey)
+ }
+ b, err := io.ReadAll(r)
+ if err != nil {
+ // The read's own error, never what was read before it failed.
+ return nil, fmt.Errorf("%s: reading the value from stdin: %v", stdinKey, err)
+ }
+ v := string(b)
+ if strings.HasSuffix(v, "\r\n") {
+ v = v[:len(v)-2]
+ } else if strings.HasSuffix(v, "\n") {
+ v = v[:len(v)-1]
+ }
+ if err := checkValueNotNamed(stdinKey, v); err != nil {
+ return nil, err
+ }
+ out[stdinKey] = v
return out, nil
}
+// checkValueNotNamed refuses a value that starts with its own key and "=":
+// CARLOS_SERVICE_TOKEN=CARLOS_SERVICE_TOKEN=<secret> is the variable's whole
+// line pasted in as its value (#1056), and the app's every call then
+// answers 401 with nothing to say why. The key is named, the value never.
+func checkValueNotNamed(k, v string) error {
+ if strings.HasPrefix(v, k+"=") {
+ return fmt.Errorf(secretsCopyNamedValue, k, k)
+ }
+ return nil
+}
+
+// The words of #1056's three refusals. The verb's own "secrets set:" or
+// "env set:" prefix is added at the call site. Not yet through a copy pass.
+const (
+ secretsCopyNamedValue = "%s: the value starts with %s=, so it includes the variable name: nothing stored. Give the value on its own."
+ secretsCopyStdinTerminal = "%s: stdin is a terminal, so there is no value to read. Pipe the value in: ... | carlos secrets set --app <app> %s -"
+ secretsCopyStdinTwice = "%s and %s both read stdin: only one key can take its value from stdin."
+)
+
func runEnvSet(args []string) {
fs := flag.NewFlagSet("env set", flag.ExitOnError)
messageFlags := addMutationMessageFlags(fs)
@@ -858,6 +937,7 @@ const secretsUsage = `usage: carlos secrets <command>
commands:
set --app <a> [--environment <name>] KEY=value [KEY2=value2 ...] seal and set one or more secrets
+ --app <a> [--environment <name>] KEY - the same, reading KEY's value from stdin
unset --app <a> [--environment <name>] KEY [KEY2 ...] remove secrets
list --app <a> [--environment <name>] list a secret's key names only — never values
genkey mint a CARLOS_SECRETS_KEY/PUBKEY pair
@@ -1011,9 +1091,9 @@ func runSecretsSet(args []string) {
consoleFlag := consoleOption(fs, "console origin to work through (API mode only; default: the only logged-in one)")
fs.Usage = flagUsage(fs, "")
fs.Parse(args)
- usage := "usage: carlos secrets set --app <a> [--environment <name>] [--console <origin>] KEY=value [KEY2=value2 ...]"
+ usage := "usage: carlos secrets set --app <a> [--environment <name>] [--console <origin>] KEY=value [KEY2=value2 ...] [KEY -]"
checkEnvironmentFlag(*environment)
- kv, err := parseKV(fs.Args())
+ kv, err := parseSecretsArgs(fs.Args(), secretsStdin)
if err != nil {
log.Fatalf("secrets set: %v", err)
}
diff --git a/secrets_stdin_test.go b/secrets_stdin_test.go
new file mode 100644
index 000000000..29a1b7c7f
--- /dev/null
+++ b/secrets_stdin_test.go
@@ -0,0 +1,191 @@
+// Tests for `carlos secrets set`'s stdin form and its variable-name refusal
+// (#1056). `secrets set KEY -` reads the value from stdin so it never sits
+// in argv, and `secrets set` (and `env set`, which shares the parser)
+// refuses a value that starts with its own key name and "=".
+package main
+
+import (
+ "context"
+ "io"
+ "os"
+ "os/exec"
+ "path/filepath"
+ "reflect"
+ "strings"
+ "testing"
+
+ "github.com/carlosframework/platform/internal/appconfig"
+)
+
+// pipe stands in for secretsStdin: a reader that records whether it was
+// read, and whether it is a terminal.
+type pipe struct {
+ r io.Reader
+ terminal bool
+ read bool
+}
+
+func (p *pipe) Read(b []byte) (int, error) { p.read = true; return p.r.Read(b) }
+
+func stdinOf(value string, terminal bool) (*pipe, func() (io.Reader, bool)) {
+ p := &pipe{r: strings.NewReader(value), terminal: terminal}
+ return p, func() (io.Reader, bool) { return p, p.terminal }
+}
+
+func TestParseSecretsArgsReadsOneValueFromStdin(t *testing.T) {
+ for _, tc := range []struct {
+ name string
+ args []string
+ stdin string
+ want map[string]string
+ }{
+ {"newline stripped", []string{"KEY", "-"}, "s3cret\n", map[string]string{"KEY": "s3cret"}},
+ {"crlf stripped", []string{"KEY", "-"}, "s3cret\r\n", map[string]string{"KEY": "s3cret"}},
+ {"no newline", []string{"KEY", "-"}, "s3cret", map[string]string{"KEY": "s3cret"}},
+ {"only one newline stripped", []string{"KEY", "-"}, "s3cret\n\n", map[string]string{"KEY": "s3cret\n"}},
+ {"beside pairs", []string{"A=1", "KEY", "-", "B=2"}, "s3cret\n", map[string]string{"A": "1", "KEY": "s3cret", "B": "2"}},
+ {"empty stays empty", []string{"KEY", "-"}, "\n", map[string]string{"KEY": ""}},
+ } {
+ t.Run(tc.name, func(t *testing.T) {
+ _, stdin := stdinOf(tc.stdin, false)
+ got, err := parseSecretsArgs(tc.args, stdin)
+ if err != nil {
+ t.Fatal(err)
+ }
+ if !reflect.DeepEqual(got, tc.want) {
+ t.Fatalf("got %q, want %q", got, tc.want)
+ }
+ })
+ }
+}
+
+// An empty stdin value meets the same refusal an empty KEY= does.
+func TestSecretsSetEmptyStdinValueIsRefused(t *testing.T) {
+ _, stdin := stdinOf("", false)
+ kv, err := parseSecretsArgs([]string{"KEY", "-"}, stdin)
+ if err != nil {
+ t.Fatal(err)
+ }
+ err = checkNoEmptyValues(kv)
+ if err == nil || err.Error() != strings.Replace(secretsCopyEmpty, "%s", "KEY", 1) {
+ t.Fatalf("err = %v, want the existing empty-value refusal", err)
+ }
+}
+
+func TestParseSecretsArgsRefusesATerminalWithoutReading(t *testing.T) {
+ p, stdin := stdinOf("s3cret\n", true)
+ _, err := parseSecretsArgs([]string{"KEY", "-"}, stdin)
+ if err == nil || !strings.Contains(err.Error(), "terminal") {
+ t.Fatalf("err = %v, want the terminal refusal", err)
+ }
+ if p.read {
+ t.Fatal("read from a terminal stdin")
+ }
+}
+
+func TestParseSecretsArgsTakesOneStdinKey(t *testing.T) {
+ _, stdin := stdinOf("s3cret\n", false)
+ _, err := parseSecretsArgs([]string{"A", "-", "B", "-"}, stdin)
+ if err == nil || !strings.Contains(err.Error(), "only one") {
+ t.Fatalf("err = %v, want the one-stdin-key refusal", err)
+ }
+}
+
+// Without its key, or without its "-", the stdin form is the old error.
+func TestParseSecretsArgsHalfAStdinFormIsNotAPair(t *testing.T) {
+ for _, args := range [][]string{{"-"}, {"KEY"}, {"A=1", "-"}, {"KEY", "-", "-"}} {
+ p, stdin := stdinOf("s3cret\n", false)
+ _, err := parseSecretsArgs(args, stdin)
+ if err == nil || !strings.Contains(err.Error(), "is not a KEY=value pair") {
+ t.Fatalf("%q: err = %v, want the not-a-pair refusal", args, err)
+ }
+ if p.read {
+ t.Fatalf("%q: read stdin for a malformed form", args)
+ }
+ }
+}
+
+func TestSecretsSetRefusesAValueCarryingItsOwnName(t *testing.T) {
+ const secret = "abcdefghijklmnopqrstuvwxyz0123456789ABCDEFG"
+ _, stdin := stdinOf("CARLOS_SERVICE_TOKEN="+secret+"\n", false)
+ _, fromStdin := parseSecretsArgs([]string{"CARLOS_SERVICE_TOKEN", "-"}, stdin)
+ _, fromArg := parseSecretsArgs([]string{"CARLOS_SERVICE_TOKEN=CARLOS_SERVICE_TOKEN=" + secret}, nil)
+ _, fromEnv := parseKV([]string{"CARLOS_SERVICE_TOKEN=CARLOS_SERVICE_TOKEN=" + secret})
+ for name, err := range map[string]error{"stdin": fromStdin, "argument": fromArg, "env set": fromEnv} {
+ if err == nil || !strings.Contains(err.Error(), "includes the variable name") {
+ t.Fatalf("%s: err = %v, want the variable-name refusal", name, err)
+ }
+ if strings.Contains(err.Error(), secret) {
+ t.Fatalf("%s: refusal echoes the value: %v", name, err)
+ }
+ }
+}
+
+func TestSecretsSetAcceptsValuesThatOnlyLookLikeTheirName(t *testing.T) {
+ for _, arg := range []string{"KEY=KEYS=1", "KEY=key=1", "OTHER=KEY=1", "KEY=x KEY=1"} {
+ if _, err := parseSecretsArgs([]string{arg}, nil); err != nil {
+ t.Fatalf("%q refused: %v", arg, err)
+ }
+ }
+}
+
+// End to end against a real console: the piped value is what gets sealed
+// and stored, without its trailing newline.
+func TestSecretsSetStoresTheStdinValue(t *testing.T) {
+ fx := fskCLIFixture(t)
+ privB64, pub, err := appconfig.GenerateKey()
+ if err != nil {
+ t.Fatal(err)
+ }
+ captureStdout(t)
+ RunFleets([]string{"secrets-key", "-account", "ops", "home", pub})
+
+ _, stdin := stdinOf("hunter2\n", false)
+ orig := secretsStdin
+ secretsStdin = stdin
+ t.Cleanup(func() { secretsStdin = orig })
+ runCapturingRealStdout(t, func() {
+ runSecretsSet([]string{"-account", "ops", "-app", "shop", "API_KEY", "-"})
+ })
+ m, err := appconfig.Get(context.Background(), fx.rel, fx.account, "shop")
+ if err != nil {
+ t.Fatal(err)
+ }
+ priv, _ := appconfig.ParsePrivateKey(privB64, "test")
+ got, err := appconfig.Open(priv, appconfig.Binding{Account: fx.account, App: "shop"}, m.Vars["API_KEY"].Envelope)
+ if err != nil || string(got) != "hunter2" {
+ t.Fatalf("stored value = %q %v, want hunter2", got, err)
+ }
+}
+
+// Through the built binary, with no console anywhere: stdin is parsed
+// before any session. /dev/null is a char device but not a terminal, so it
+// gets the empty-value refusal; a pipe carrying KEY=... gets the
+// variable-name refusal, and neither echoes what was piped.
+func TestSecretsSetStdinThroughTheBinary(t *testing.T) {
+ bin := buildCarlos(t)
+ scratch := t.TempDir()
+ run := func(stdin io.Reader) string {
+ cmd := exec.Command(bin, "secrets", "set", "--app", "shop", "API_KEY", "-")
+ cmd.Env = carlosTestEnv(t, "CARLOS_CREDENTIALS="+filepath.Join(scratch, "none"), "CARLOS_DEPLOYMENT_BUCKET=", "CARLOS_DEPLOYMENT_DIR=")
+ cmd.Dir = scratch
+ cmd.Stdin = stdin
+ out, err := cmd.CombinedOutput()
+ if err == nil {
+ t.Fatalf("exited 0, want a refusal:\n%s", out)
+ }
+ return string(out)
+ }
+ devNull, err := os.Open(os.DevNull)
+ if err != nil {
+ t.Fatal(err)
+ }
+ defer devNull.Close()
+ if out := run(devNull); !strings.Contains(out, "API_KEY: empty value: nothing stored") {
+ t.Fatalf("stdin from %s: want the empty-value refusal, got:\n%s", os.DevNull, out)
+ }
+ out := run(strings.NewReader("API_KEY=hunter2\n"))
+ if !strings.Contains(out, "includes the variable name") || strings.Contains(out, "hunter2") {
+ t.Fatalf("piped API_KEY=...: want the variable-name refusal without the value, got:\n%s", out)
+ }
+}
diff --git a/testdata/clireg-golden.jsonl b/testdata/clireg-golden.jsonl
index 35b651163..84075d4fb 100644
--- a/testdata/clireg-golden.jsonl
+++ b/testdata/clireg-golden.jsonl
@@ -675,12 +675,12 @@
{"case":"secrets set | -h","argv":["secrets","set","-h"],"exit":0,"stdout":"","stderr":"usage: carlos secrets set [flags]\nflags:\n --account <string> account (sqid or name) the app belongs to (default: your only account, or the configured/chosen one; ops in direct mode)\n --account-id <string> account sqid, matched as a sqid ONLY — supersedes --account; this is the flag an ambiguity error tells you to use\n --app, -a <string> app name\n --console <string> console origin to work through (API mode only; default: the only logged-in one)\n --destination, -d <name> use the named block from .carlos/config's destinations (default: CARLOS_DESTINATION, else the file's default or only one)\n --environment, -e <string> named environment bundle to set in (omit for the default bundle)\n --registry <string> registry database (resolves --account) (default: $DIR/data/registry.db)\n"}
{"case":"secrets unset | --zz-unknown-flag","argv":["secrets","unset","--zz-unknown-flag"],"exit":2,"stdout":"","stderr":"flag provided but not defined: -zz-unknown-flag\nusage: carlos secrets unset [flags]\nflags:\n --account <string> account (sqid or name) the app belongs to (default: your only account, or the configured/chosen one; ops in direct mode)\n --account-id <string> account sqid, matched as a sqid ONLY — supersedes --account; this is the flag an ambiguity error tells you to use\n --app, -a <string> app name\n --console <string> console origin to work through (API mode only; default: the only logged-in one)\n --destination, -d <name> use the named block from .carlos/config's destinations (default: CARLOS_DESTINATION, else the file's default or only one)\n --environment, -e <string> named environment bundle to remove from (omit for the default bundle)\n --registry <string> registry database (resolves --account) (default: $DIR/data/registry.db)\n"}
{"case":"secrets unset | -h","argv":["secrets","unset","-h"],"exit":0,"stdout":"","stderr":"usage: carlos secrets unset [flags]\nflags:\n --account <string> account (sqid or name) the app belongs to (default: your only account, or the configured/chosen one; ops in direct mode)\n --account-id <string> account sqid, matched as a sqid ONLY — supersedes --account; this is the flag an ambiguity error tells you to use\n --app, -a <string> app name\n --console <string> console origin to work through (API mode only; default: the only logged-in one)\n --destination, -d <name> use the named block from .carlos/config's destinations (default: CARLOS_DESTINATION, else the file's default or only one)\n --environment, -e <string> named environment bundle to remove from (omit for the default bundle)\n --registry <string> registry database (resolves --account) (default: $DIR/data/registry.db)\n"}
-{"case":"secrets | --help","argv":["secrets","--help"],"exit":1,"stdout":"","stderr":"usage: carlos secrets <command>\n\ncommands:\n set --app <a> [--environment <name>] KEY=value [KEY2=value2 ...] seal and set one or more secrets\n unset --app <a> [--environment <name>] KEY [KEY2 ...] remove secrets\n list --app <a> [--environment <name>] list a secret's key names only — never values\n genkey mint a CARLOS_SECRETS_KEY/PUBKEY pair\n fingerprint [--file <path>] print the fingerprint of the key in a host.env, never the key\n\n--environment names a bundle at apps/<acct>/<app>/environments/<name>.json —\nsee \"carlos env\" for the full explanation; the same bundle backs both env\nvars and secrets, sealed or not. \"carlos env environments --app <a>\" lists\nan app's bundle names.\n\nset/unset/list also work through a logged-in console (carlos auth login)\nwhen CARLOS_DEPLOYMENT_BUCKET/CARLOS_DEPLOYMENT_DIR are unset —\n[--console <origin>] picks which logged-in console when more than one is\nconfigured; the store env vars win outright when set (direct-bucket mode,\nunchanged). In that mode \"secrets set\" seals with CARLOS_SECRETS_PUBKEY if\nit's set in this terminal's own environment, otherwise the console's own\nserved public key (Config.SecretsPub) if it has one — CARLOS_SECRETS_KEY\n(the PRIVATE half) never leaves the box holding it either way.\ngenkey and fingerprint are always local, in both modes.\nfor an app placed on a fleet the console serves the fleet's own key, so leave\nCARLOS_SECRETS_PUBKEY unset. register that key with \"carlos fleets secrets-key\".\n"}
-{"case":"secrets | --zz-unknown-flag","argv":["secrets","--zz-unknown-flag"],"exit":1,"stdout":"","stderr":"usage: carlos secrets <command>\n\ncommands:\n set --app <a> [--environment <name>] KEY=value [KEY2=value2 ...] seal and set one or more secrets\n unset --app <a> [--environment <name>] KEY [KEY2 ...] remove secrets\n list --app <a> [--environment <name>] list a secret's key names only — never values\n genkey mint a CARLOS_SECRETS_KEY/PUBKEY pair\n fingerprint [--file <path>] print the fingerprint of the key in a host.env, never the key\n\n--environment names a bundle at apps/<acct>/<app>/environments/<name>.json —\nsee \"carlos env\" for the full explanation; the same bundle backs both env\nvars and secrets, sealed or not. \"carlos env environments --app <a>\" lists\nan app's bundle names.\n\nset/unset/list also work through a logged-in console (carlos auth login)\nwhen CARLOS_DEPLOYMENT_BUCKET/CARLOS_DEPLOYMENT_DIR are unset —\n[--console <origin>] picks which logged-in console when more than one is\nconfigured; the store env vars win outright when set (direct-bucket mode,\nunchanged). In that mode \"secrets set\" seals with CARLOS_SECRETS_PUBKEY if\nit's set in this terminal's own environment, otherwise the console's own\nserved public key (Config.SecretsPub) if it has one — CARLOS_SECRETS_KEY\n(the PRIVATE half) never leaves the box holding it either way.\ngenkey and fingerprint are always local, in both modes.\nfor an app placed on a fleet the console serves the fleet's own key, so leave\nCARLOS_SECRETS_PUBKEY unset. register that key with \"carlos fleets secrets-key\".\n"}
-{"case":"secrets | -h","argv":["secrets","-h"],"exit":1,"stdout":"","stderr":"usage: carlos secrets <command>\n\ncommands:\n set --app <a> [--environment <name>] KEY=value [KEY2=value2 ...] seal and set one or more secrets\n unset --app <a> [--environment <name>] KEY [KEY2 ...] remove secrets\n list --app <a> [--environment <name>] list a secret's key names only — never values\n genkey mint a CARLOS_SECRETS_KEY/PUBKEY pair\n fingerprint [--file <path>] print the fingerprint of the key in a host.env, never the key\n\n--environment names a bundle at apps/<acct>/<app>/environments/<name>.json —\nsee \"carlos env\" for the full explanation; the same bundle backs both env\nvars and secrets, sealed or not. \"carlos env environments --app <a>\" lists\nan app's bundle names.\n\nset/unset/list also work through a logged-in console (carlos auth login)\nwhen CARLOS_DEPLOYMENT_BUCKET/CARLOS_DEPLOYMENT_DIR are unset —\n[--console <origin>] picks which logged-in console when more than one is\nconfigured; the store env vars win outright when set (direct-bucket mode,\nunchanged). In that mode \"secrets set\" seals with CARLOS_SECRETS_PUBKEY if\nit's set in this terminal's own environment, otherwise the console's own\nserved public key (Config.SecretsPub) if it has one — CARLOS_SECRETS_KEY\n(the PRIVATE half) never leaves the box holding it either way.\ngenkey and fingerprint are always local, in both modes.\nfor an app placed on a fleet the console serves the fleet's own key, so leave\nCARLOS_SECRETS_PUBKEY unset. register that key with \"carlos fleets secrets-key\".\n"}
-{"case":"secrets | bare","argv":["secrets"],"exit":1,"stdout":"","stderr":"usage: carlos secrets <command>\n\ncommands:\n set --app <a> [--environment <name>] KEY=value [KEY2=value2 ...] seal and set one or more secrets\n unset --app <a> [--environment <name>] KEY [KEY2 ...] remove secrets\n list --app <a> [--environment <name>] list a secret's key names only — never values\n genkey mint a CARLOS_SECRETS_KEY/PUBKEY pair\n fingerprint [--file <path>] print the fingerprint of the key in a host.env, never the key\n\n--environment names a bundle at apps/<acct>/<app>/environments/<name>.json —\nsee \"carlos env\" for the full explanation; the same bundle backs both env\nvars and secrets, sealed or not. \"carlos env environments --app <a>\" lists\nan app's bundle names.\n\nset/unset/list also work through a logged-in console (carlos auth login)\nwhen CARLOS_DEPLOYMENT_BUCKET/CARLOS_DEPLOYMENT_DIR are unset —\n[--console <origin>] picks which logged-in console when more than one is\nconfigured; the store env vars win outright when set (direct-bucket mode,\nunchanged). In that mode \"secrets set\" seals with CARLOS_SECRETS_PUBKEY if\nit's set in this terminal's own environment, otherwise the console's own\nserved public key (Config.SecretsPub) if it has one — CARLOS_SECRETS_KEY\n(the PRIVATE half) never leaves the box holding it either way.\ngenkey and fingerprint are always local, in both modes.\nfor an app placed on a fleet the console serves the fleet's own key, so leave\nCARLOS_SECRETS_PUBKEY unset. register that key with \"carlos fleets secrets-key\".\n"}
-{"case":"secrets | help","argv":["secrets","help"],"exit":1,"stdout":"","stderr":"usage: carlos secrets <command>\n\ncommands:\n set --app <a> [--environment <name>] KEY=value [KEY2=value2 ...] seal and set one or more secrets\n unset --app <a> [--environment <name>] KEY [KEY2 ...] remove secrets\n list --app <a> [--environment <name>] list a secret's key names only — never values\n genkey mint a CARLOS_SECRETS_KEY/PUBKEY pair\n fingerprint [--file <path>] print the fingerprint of the key in a host.env, never the key\n\n--environment names a bundle at apps/<acct>/<app>/environments/<name>.json —\nsee \"carlos env\" for the full explanation; the same bundle backs both env\nvars and secrets, sealed or not. \"carlos env environments --app <a>\" lists\nan app's bundle names.\n\nset/unset/list also work through a logged-in console (carlos auth login)\nwhen CARLOS_DEPLOYMENT_BUCKET/CARLOS_DEPLOYMENT_DIR are unset —\n[--console <origin>] picks which logged-in console when more than one is\nconfigured; the store env vars win outright when set (direct-bucket mode,\nunchanged). In that mode \"secrets set\" seals with CARLOS_SECRETS_PUBKEY if\nit's set in this terminal's own environment, otherwise the console's own\nserved public key (Config.SecretsPub) if it has one — CARLOS_SECRETS_KEY\n(the PRIVATE half) never leaves the box holding it either way.\ngenkey and fingerprint are always local, in both modes.\nfor an app placed on a fleet the console serves the fleet's own key, so leave\nCARLOS_SECRETS_PUBKEY unset. register that key with \"carlos fleets secrets-key\".\n"}
-{"case":"secrets | zz-unknown","argv":["secrets","zz-unknown"],"exit":1,"stdout":"","stderr":"usage: carlos secrets <command>\n\ncommands:\n set --app <a> [--environment <name>] KEY=value [KEY2=value2 ...] seal and set one or more secrets\n unset --app <a> [--environment <name>] KEY [KEY2 ...] remove secrets\n list --app <a> [--environment <name>] list a secret's key names only — never values\n genkey mint a CARLOS_SECRETS_KEY/PUBKEY pair\n fingerprint [--file <path>] print the fingerprint of the key in a host.env, never the key\n\n--environment names a bundle at apps/<acct>/<app>/environments/<name>.json —\nsee \"carlos env\" for the full explanation; the same bundle backs both env\nvars and secrets, sealed or not. \"carlos env environments --app <a>\" lists\nan app's bundle names.\n\nset/unset/list also work through a logged-in console (carlos auth login)\nwhen CARLOS_DEPLOYMENT_BUCKET/CARLOS_DEPLOYMENT_DIR are unset —\n[--console <origin>] picks which logged-in console when more than one is\nconfigured; the store env vars win outright when set (direct-bucket mode,\nunchanged). In that mode \"secrets set\" seals with CARLOS_SECRETS_PUBKEY if\nit's set in this terminal's own environment, otherwise the console's own\nserved public key (Config.SecretsPub) if it has one — CARLOS_SECRETS_KEY\n(the PRIVATE half) never leaves the box holding it either way.\ngenkey and fingerprint are always local, in both modes.\nfor an app placed on a fleet the console serves the fleet's own key, so leave\nCARLOS_SECRETS_PUBKEY unset. register that key with \"carlos fleets secrets-key\".\n"}
+{"case":"secrets | --help","argv":["secrets","--help"],"exit":1,"stdout":"","stderr":"usage: carlos secrets <command>\n\ncommands:\n set --app <a> [--environment <name>] KEY=value [KEY2=value2 ...] seal and set one or more secrets\n --app <a> [--environment <name>] KEY - the same, reading KEY's value from stdin\n unset --app <a> [--environment <name>] KEY [KEY2 ...] remove secrets\n list --app <a> [--environment <name>] list a secret's key names only — never values\n genkey mint a CARLOS_SECRETS_KEY/PUBKEY pair\n fingerprint [--file <path>] print the fingerprint of the key in a host.env, never the key\n\n--environment names a bundle at apps/<acct>/<app>/environments/<name>.json —\nsee \"carlos env\" for the full explanation; the same bundle backs both env\nvars and secrets, sealed or not. \"carlos env environments --app <a>\" lists\nan app's bundle names.\n\nset/unset/list also work through a logged-in console (carlos auth login)\nwhen CARLOS_DEPLOYMENT_BUCKET/CARLOS_DEPLOYMENT_DIR are unset —\n[--console <origin>] picks which logged-in console when more than one is\nconfigured; the store env vars win outright when set (direct-bucket mode,\nunchanged). In that mode \"secrets set\" seals with CARLOS_SECRETS_PUBKEY if\nit's set in this terminal's own environment, otherwise the console's own\nserved public key (Config.SecretsPub) if it has one — CARLOS_SECRETS_KEY\n(the PRIVATE half) never leaves the box holding it either way.\ngenkey and fingerprint are always local, in both modes.\nfor an app placed on a fleet the console serves the fleet's own key, so leave\nCARLOS_SECRETS_PUBKEY unset. register that key with \"carlos fleets secrets-key\".\n"}
+{"case":"secrets | --zz-unknown-flag","argv":["secrets","--zz-unknown-flag"],"exit":1,"stdout":"","stderr":"usage: carlos secrets <command>\n\ncommands:\n set --app <a> [--environment <name>] KEY=value [KEY2=value2 ...] seal and set one or more secrets\n --app <a> [--environment <name>] KEY - the same, reading KEY's value from stdin\n unset --app <a> [--environment <name>] KEY [KEY2 ...] remove secrets\n list --app <a> [--environment <name>] list a secret's key names only — never values\n genkey mint a CARLOS_SECRETS_KEY/PUBKEY pair\n fingerprint [--file <path>] print the fingerprint of the key in a host.env, never the key\n\n--environment names a bundle at apps/<acct>/<app>/environments/<name>.json —\nsee \"carlos env\" for the full explanation; the same bundle backs both env\nvars and secrets, sealed or not. \"carlos env environments --app <a>\" lists\nan app's bundle names.\n\nset/unset/list also work through a logged-in console (carlos auth login)\nwhen CARLOS_DEPLOYMENT_BUCKET/CARLOS_DEPLOYMENT_DIR are unset —\n[--console <origin>] picks which logged-in console when more than one is\nconfigured; the store env vars win outright when set (direct-bucket mode,\nunchanged). In that mode \"secrets set\" seals with CARLOS_SECRETS_PUBKEY if\nit's set in this terminal's own environment, otherwise the console's own\nserved public key (Config.SecretsPub) if it has one — CARLOS_SECRETS_KEY\n(the PRIVATE half) never leaves the box holding it either way.\ngenkey and fingerprint are always local, in both modes.\nfor an app placed on a fleet the console serves the fleet's own key, so leave\nCARLOS_SECRETS_PUBKEY unset. register that key with \"carlos fleets secrets-key\".\n"}
+{"case":"secrets | -h","argv":["secrets","-h"],"exit":1,"stdout":"","stderr":"usage: carlos secrets <command>\n\ncommands:\n set --app <a> [--environment <name>] KEY=value [KEY2=value2 ...] seal and set one or more secrets\n --app <a> [--environment <name>] KEY - the same, reading KEY's value from stdin\n unset --app <a> [--environment <name>] KEY [KEY2 ...] remove secrets\n list --app <a> [--environment <name>] list a secret's key names only — never values\n genkey mint a CARLOS_SECRETS_KEY/PUBKEY pair\n fingerprint [--file <path>] print the fingerprint of the key in a host.env, never the key\n\n--environment names a bundle at apps/<acct>/<app>/environments/<name>.json —\nsee \"carlos env\" for the full explanation; the same bundle backs both env\nvars and secrets, sealed or not. \"carlos env environments --app <a>\" lists\nan app's bundle names.\n\nset/unset/list also work through a logged-in console (carlos auth login)\nwhen CARLOS_DEPLOYMENT_BUCKET/CARLOS_DEPLOYMENT_DIR are unset —\n[--console <origin>] picks which logged-in console when more than one is\nconfigured; the store env vars win outright when set (direct-bucket mode,\nunchanged). In that mode \"secrets set\" seals with CARLOS_SECRETS_PUBKEY if\nit's set in this terminal's own environment, otherwise the console's own\nserved public key (Config.SecretsPub) if it has one — CARLOS_SECRETS_KEY\n(the PRIVATE half) never leaves the box holding it either way.\ngenkey and fingerprint are always local, in both modes.\nfor an app placed on a fleet the console serves the fleet's own key, so leave\nCARLOS_SECRETS_PUBKEY unset. register that key with \"carlos fleets secrets-key\".\n"}
+{"case":"secrets | bare","argv":["secrets"],"exit":1,"stdout":"","stderr":"usage: carlos secrets <command>\n\ncommands:\n set --app <a> [--environment <name>] KEY=value [KEY2=value2 ...] seal and set one or more secrets\n --app <a> [--environment <name>] KEY - the same, reading KEY's value from stdin\n unset --app <a> [--environment <name>] KEY [KEY2 ...] remove secrets\n list --app <a> [--environment <name>] list a secret's key names only — never values\n genkey mint a CARLOS_SECRETS_KEY/PUBKEY pair\n fingerprint [--file <path>] print the fingerprint of the key in a host.env, never the key\n\n--environment names a bundle at apps/<acct>/<app>/environments/<name>.json —\nsee \"carlos env\" for the full explanation; the same bundle backs both env\nvars and secrets, sealed or not. \"carlos env environments --app <a>\" lists\nan app's bundle names.\n\nset/unset/list also work through a logged-in console (carlos auth login)\nwhen CARLOS_DEPLOYMENT_BUCKET/CARLOS_DEPLOYMENT_DIR are unset —\n[--console <origin>] picks which logged-in console when more than one is\nconfigured; the store env vars win outright when set (direct-bucket mode,\nunchanged). In that mode \"secrets set\" seals with CARLOS_SECRETS_PUBKEY if\nit's set in this terminal's own environment, otherwise the console's own\nserved public key (Config.SecretsPub) if it has one — CARLOS_SECRETS_KEY\n(the PRIVATE half) never leaves the box holding it either way.\ngenkey and fingerprint are always local, in both modes.\nfor an app placed on a fleet the console serves the fleet's own key, so leave\nCARLOS_SECRETS_PUBKEY unset. register that key with \"carlos fleets secrets-key\".\n"}
+{"case":"secrets | help","argv":["secrets","help"],"exit":1,"stdout":"","stderr":"usage: carlos secrets <command>\n\ncommands:\n set --app <a> [--environment <name>] KEY=value [KEY2=value2 ...] seal and set one or more secrets\n --app <a> [--environment <name>] KEY - the same, reading KEY's value from stdin\n unset --app <a> [--environment <name>] KEY [KEY2 ...] remove secrets\n list --app <a> [--environment <name>] list a secret's key names only — never values\n genkey mint a CARLOS_SECRETS_KEY/PUBKEY pair\n fingerprint [--file <path>] print the fingerprint of the key in a host.env, never the key\n\n--environment names a bundle at apps/<acct>/<app>/environments/<name>.json —\nsee \"carlos env\" for the full explanation; the same bundle backs both env\nvars and secrets, sealed or not. \"carlos env environments --app <a>\" lists\nan app's bundle names.\n\nset/unset/list also work through a logged-in console (carlos auth login)\nwhen CARLOS_DEPLOYMENT_BUCKET/CARLOS_DEPLOYMENT_DIR are unset —\n[--console <origin>] picks which logged-in console when more than one is\nconfigured; the store env vars win outright when set (direct-bucket mode,\nunchanged). In that mode \"secrets set\" seals with CARLOS_SECRETS_PUBKEY if\nit's set in this terminal's own environment, otherwise the console's own\nserved public key (Config.SecretsPub) if it has one — CARLOS_SECRETS_KEY\n(the PRIVATE half) never leaves the box holding it either way.\ngenkey and fingerprint are always local, in both modes.\nfor an app placed on a fleet the console serves the fleet's own key, so leave\nCARLOS_SECRETS_PUBKEY unset. register that key with \"carlos fleets secrets-key\".\n"}
+{"case":"secrets | zz-unknown","argv":["secrets","zz-unknown"],"exit":1,"stdout":"","stderr":"usage: carlos secrets <command>\n\ncommands:\n set --app <a> [--environment <name>] KEY=value [KEY2=value2 ...] seal and set one or more secrets\n --app <a> [--environment <name>] KEY - the same, reading KEY's value from stdin\n unset --app <a> [--environment <name>] KEY [KEY2 ...] remove secrets\n list --app <a> [--environment <name>] list a secret's key names only — never values\n genkey mint a CARLOS_SECRETS_KEY/PUBKEY pair\n fingerprint [--file <path>] print the fingerprint of the key in a host.env, never the key\n\n--environment names a bundle at apps/<acct>/<app>/environments/<name>.json —\nsee \"carlos env\" for the full explanation; the same bundle backs both env\nvars and secrets, sealed or not. \"carlos env environments --app <a>\" lists\nan app's bundle names.\n\nset/unset/list also work through a logged-in console (carlos auth login)\nwhen CARLOS_DEPLOYMENT_BUCKET/CARLOS_DEPLOYMENT_DIR are unset —\n[--console <origin>] picks which logged-in console when more than one is\nconfigured; the store env vars win outright when set (direct-bucket mode,\nunchanged). In that mode \"secrets set\" seals with CARLOS_SECRETS_PUBKEY if\nit's set in this terminal's own environment, otherwise the console's own\nserved public key (Config.SecretsPub) if it has one — CARLOS_SECRETS_KEY\n(the PRIVATE half) never leaves the box holding it either way.\ngenkey and fingerprint are always local, in both modes.\nfor an app placed on a fleet the console serves the fleet's own key, so leave\nCARLOS_SECRETS_PUBKEY unset. register that key with \"carlos fleets secrets-key\".\n"}
{"case":"services create | --zz-unknown-flag","argv":["services","create","--zz-unknown-flag"],"exit":2,"stdout":"","stderr":"flag provided but not defined: -zz-unknown-flag\nusage: carlos services create [flags]\nflags:\n --account <string> account (sqid or name) to mint the credential in (default: your only account, or the configured/chosen one)\n --account-id <string> account sqid, matched as a sqid ONLY — supersedes --account\n --app, -a <string> bind the credential to one app (default: account-wide)\n --commands <string> command prefixes a run credential may run, comma-separated, words space-separated: \"import classic,import sync\" (required with --role run)\n --console <string> console to create it through (default: the only logged-in one)\n --destination, -d <name> use the named block from .carlos/config's destinations (default: CARLOS_DESTINATION, else the file's default or only one)\n --json print the credential and its bare secret as one JSON object, for a script\n --role <string> role: publish, deploy, instance, operate, service, run, team or admin (required)\n --rungs <string> rungs a deploy credential may move, comma-separated: canary, edge, beta (required with --role deploy)\n --scope <string> scope name a team credential holds: the environments it owns (required with --role team, with --app)\n"}
{"case":"services create | -h","argv":["services","create","-h"],"exit":0,"stdout":"","stderr":"usage: carlos services create [flags]\nflags:\n --account <string> account (sqid or name) to mint the credential in (default: your only account, or the configured/chosen one)\n --account-id <string> account sqid, matched as a sqid ONLY — supersedes --account\n --app, -a <string> bind the credential to one app (default: account-wide)\n --commands <string> command prefixes a run credential may run, comma-separated, words space-separated: \"import classic,import sync\" (required with --role run)\n --console <string> console to create it through (default: the only logged-in one)\n --destination, -d <name> use the named block from .carlos/config's destinations (default: CARLOS_DESTINATION, else the file's default or only one)\n --json print the credential and its bare secret as one JSON object, for a script\n --role <string> role: publish, deploy, instance, operate, service, run, team or admin (required)\n --rungs <string> rungs a deploy credential may move, comma-separated: canary, edge, beta (required with --role deploy)\n --scope <string> scope name a team credential holds: the environments it owns (required with --role team, with --app)\n"}
{"case":"services ls | --zz-unknown-flag","argv":["services","ls","--zz-unknown-flag"],"exit":2,"stdout":"","stderr":"flag provided but not defined: -zz-unknown-flag\nusage: carlos services ls [flags]\nflags:\n --account <string> account (sqid or name) to list credentials for (default: your only account, or the configured/chosen one)\n --account-id <string> account sqid, matched as a sqid ONLY — supersedes --account\n --console <string> console to list through (default: the only logged-in one)\n --destination, -d <name> use the named block from .carlos/config's destinations (default: CARLOS_DESTINATION, else the file's default or only one)\n"}