secrets set: cap stdin, Cygwin terminals, --literal (#1056 R1)
Review R1, P2-3 to P2-5. The stdin terminal check also asks isatty.IsCygwinTerminal, so a Git Bash or MSYS2 terminal is refused before reading. Stdin is read through a LimitReader at 64 KiB plus one byte (secretsStdinMaxBytes; no per-value limit exists, the console takes 256 KiB per request and sealing adds about 4/3) and more is refused without echoing it. The variable-name refusal now applies to secrets set only: env set accepts FILTER=FILTER=active again, and secrets set --literal stores such a value on purpose. Golden lines for secrets set -h carry the new flag.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
3 files changed,
+164
−33
appconfig_cli.go+48 −19secrets_stdin_test.go+114 −12testdata/clireg-golden.jsonl+2 −2
diff --git a/appconfig_cli.go b/appconfig_cli.go| index bb25ac501..83aaa4a06 100644 |
| --- a/appconfig_cli.go |
| +++ b/appconfig_cli.go |
| @@ -414,18 +414,35 @@ 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, or a value that starts with its own |
| -// key and "=". Shared by `env set` and `secrets set`. |
| +// without an "=" or with an empty key. `env set`'s parser; `secrets set` |
| +// adds its stdin form and its variable-name refusal (parseSecretsArgs). An |
| +// env value like FILTER=FILTER=active is plausible, so env set keeps it. |
| func parseKV(args []string) (map[string]string, error) { |
| - return parseSecretsArgs(args, nil) |
| + return parseSecretsArgs(args, nil, false) |
| } |
| // secretsStdin is where `secrets set KEY -` reads its value, and whether |
| -// that is a terminal. go-isatty, as `domains buy` uses, rather than |
| +// that is a terminal. A var so tests can stand a pipe in. |
| +var secretsStdin = func() (io.Reader, bool) { |
| + return os.Stdin, stdinTerminal(os.Stdin.Fd(), isatty.IsTerminal, isatty.IsCygwinTerminal) |
| +} |
| + |
| +// stdinTerminal is go-isatty's answer, 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()) } |
| +// told it is at a terminal. A Cygwin or MSYS2 terminal on Windows is a |
| +// pipe to the console check, so it is asked separately (#1056 review R1): |
| +// reading there would sit waiting and echo a typed secret. |
| +func stdinTerminal(fd uintptr, console, cygwin func(uintptr) bool) bool { |
| + return console(fd) || cygwin(fd) |
| +} |
| + |
| +// secretsStdinMaxBytes caps what `secrets set KEY -` reads. No per-value |
| +// limit exists for config values; the console takes 256 KiB per request |
| +// (configPutMaxBytes) and sealing grows a value by about 4/3, so 64 KiB of |
| +// plaintext is a generous single secret that still fits. Read as N+1 bytes |
| +// so a wrong file or an unending producer costs bounded memory. |
| +const secretsStdinMaxBytes = 64 << 10 |
| // 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 |
| @@ -434,12 +451,14 @@ var secretsStdin = func() (io.Reader, bool) { return os.Stdin, isatty.IsTerminal |
| // 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. |
| +// blinking cursor wants a secret. More than secretsStdinMaxBytes is refused |
| +// unread past the cap. stdin nil (env set) leaves the form unrecognised, |
| +// which is parseKV's old not-a-pair refusal. refuseNamed turns on |
| +// checkValueNotNamed for every value; `secrets set --literal` turns it off. |
| // |
| // 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) { |
| +func parseSecretsArgs(args []string, stdin func() (io.Reader, bool), refuseNamed bool) (map[string]string, error) { |
| if len(args) == 0 { |
| return nil, fmt.Errorf("at least one KEY=value pair is required") |
| } |
| @@ -462,8 +481,10 @@ func parseSecretsArgs(args []string, stdin func() (io.Reader, bool)) (map[string |
| // 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 |
| + if refuseNamed { |
| + if err := checkValueNotNamed(k, v); err != nil { |
| + return nil, err |
| + } |
| } |
| out[k] = v |
| } |
| @@ -474,19 +495,24 @@ func parseSecretsArgs(args []string, stdin func() (io.Reader, bool)) (map[string |
| if terminal { |
| return nil, fmt.Errorf(secretsCopyStdinTerminal, stdinKey, stdinKey) |
| } |
| - b, err := io.ReadAll(r) |
| + b, err := io.ReadAll(io.LimitReader(r, secretsStdinMaxBytes+1)) |
| 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) |
| } |
| + if len(b) > secretsStdinMaxBytes { |
| + return nil, fmt.Errorf(secretsCopyStdinTooLarge, stdinKey) |
| + } |
| 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 |
| + if refuseNamed { |
| + if err := checkValueNotNamed(stdinKey, v); err != nil { |
| + return nil, err |
| + } |
| } |
| out[stdinKey] = v |
| return out, nil |
| @@ -503,12 +529,14 @@ func checkValueNotNamed(k, v string) error { |
| 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. |
| +// The words of #1056's refusals. The verb's own "secrets set:" prefix is |
| +// added at the call site. The first three passed Luna's copy pass; the |
| +// --literal clause and the size refusal (review R1) have not yet. |
| const ( |
| - secretsCopyNamedValue = "%s: the value starts with %s=, so it includes the variable name: nothing stored. Give the value on its own." |
| + secretsCopyNamedValue = "%s: the value starts with %s=, so it includes the variable name: nothing stored. Give the value on its own, or add --literal if it really starts that way." |
| 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." |
| + secretsCopyStdinTooLarge = "%s: the value on stdin is larger than 64 KiB: nothing stored." |
| ) |
| func runEnvSet(args []string) { |
| @@ -1089,11 +1117,12 @@ func runSecretsSet(args []string) { |
| environment := environmentFlag(fs, "named environment bundle to set in (omit for the default bundle)") |
| acctRaw, acctIDRaw, regPath, acctOf := accountFlagsWithRegistry(fs) |
| consoleFlag := consoleOption(fs, "console origin to work through (API mode only; default: the only logged-in one)") |
| + literal := fs.Bool("literal", false, "store a value that starts with its own key and = as it is") |
| fs.Usage = flagUsage(fs, "") |
| fs.Parse(args) |
| - usage := "usage: carlos secrets set --app <a> [--environment <name>] [--console <origin>] KEY=value [KEY2=value2 ...] [KEY -]" |
| + usage := "usage: carlos secrets set --app <a> [--environment <name>] [--console <origin>] [--literal] KEY=value [KEY2=value2 ...] [KEY -]" |
| checkEnvironmentFlag(*environment) |
| - kv, err := parseSecretsArgs(fs.Args(), secretsStdin) |
| + kv, err := parseSecretsArgs(fs.Args(), secretsStdin, !*literal) |
| if err != nil { |
| log.Fatalf("secrets set: %v", err) |
| } |
diff --git a/secrets_stdin_test.go b/secrets_stdin_test.go| index 29a1b7c7f..b12145a90 100644 |
| --- a/secrets_stdin_test.go |
| +++ b/secrets_stdin_test.go |
| @@ -1,7 +1,7 @@ |
| // 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 "=". |
| +// in argv, and `secrets set` refuses a value that starts with its own key |
| +// name and "=" unless --literal says it means it. `env set` does not. |
| package main |
| import ( |
| @@ -15,6 +15,7 @@ import ( |
| "testing" |
| "github.com/carlosframework/platform/internal/appconfig" |
| + "github.com/mattn/go-isatty" |
| ) |
| // pipe stands in for secretsStdin: a reader that records whether it was |
| @@ -48,7 +49,7 @@ func TestParseSecretsArgsReadsOneValueFromStdin(t *testing.T) { |
| } { |
| t.Run(tc.name, func(t *testing.T) { |
| _, stdin := stdinOf(tc.stdin, false) |
| - got, err := parseSecretsArgs(tc.args, stdin) |
| + got, err := parseSecretsArgs(tc.args, stdin, true) |
| if err != nil { |
| t.Fatal(err) |
| } |
| @@ -62,7 +63,7 @@ func TestParseSecretsArgsReadsOneValueFromStdin(t *testing.T) { |
| // 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) |
| + kv, err := parseSecretsArgs([]string{"KEY", "-"}, stdin, true) |
| if err != nil { |
| t.Fatal(err) |
| } |
| @@ -74,7 +75,7 @@ func TestSecretsSetEmptyStdinValueIsRefused(t *testing.T) { |
| func TestParseSecretsArgsRefusesATerminalWithoutReading(t *testing.T) { |
| p, stdin := stdinOf("s3cret\n", true) |
| - _, err := parseSecretsArgs([]string{"KEY", "-"}, stdin) |
| + _, err := parseSecretsArgs([]string{"KEY", "-"}, stdin, true) |
| if err == nil || !strings.Contains(err.Error(), "terminal") { |
| t.Fatalf("err = %v, want the terminal refusal", err) |
| } |
| @@ -85,7 +86,7 @@ func TestParseSecretsArgsRefusesATerminalWithoutReading(t *testing.T) { |
| func TestParseSecretsArgsTakesOneStdinKey(t *testing.T) { |
| _, stdin := stdinOf("s3cret\n", false) |
| - _, err := parseSecretsArgs([]string{"A", "-", "B", "-"}, stdin) |
| + _, err := parseSecretsArgs([]string{"A", "-", "B", "-"}, stdin, true) |
| if err == nil || !strings.Contains(err.Error(), "only one") { |
| t.Fatalf("err = %v, want the one-stdin-key refusal", err) |
| } |
| @@ -95,7 +96,7 @@ func TestParseSecretsArgsTakesOneStdinKey(t *testing.T) { |
| func TestParseSecretsArgsHalfAStdinFormIsNotAPair(t *testing.T) { |
| for _, args := range [][]string{{"-"}, {"KEY"}, {"A=1", "-"}, {"KEY", "-", "-"}} { |
| p, stdin := stdinOf("s3cret\n", false) |
| - _, err := parseSecretsArgs(args, stdin) |
| + _, err := parseSecretsArgs(args, stdin, true) |
| 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) |
| } |
| @@ -108,10 +109,9 @@ func TestParseSecretsArgsHalfAStdinFormIsNotAPair(t *testing.T) { |
| 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} { |
| + _, fromStdin := parseSecretsArgs([]string{"CARLOS_SERVICE_TOKEN", "-"}, stdin, true) |
| + _, fromArg := parseSecretsArgs([]string{"CARLOS_SERVICE_TOKEN=CARLOS_SERVICE_TOKEN=" + secret}, nil, true) |
| + for name, err := range map[string]error{"stdin": fromStdin, "argument": fromArg} { |
| if err == nil || !strings.Contains(err.Error(), "includes the variable name") { |
| t.Fatalf("%s: err = %v, want the variable-name refusal", name, err) |
| } |
| @@ -123,12 +123,114 @@ func TestSecretsSetRefusesAValueCarryingItsOwnName(t *testing.T) { |
| 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 { |
| + if _, err := parseSecretsArgs([]string{arg}, nil, true); err != nil { |
| t.Fatalf("%q refused: %v", arg, err) |
| } |
| } |
| } |
| +// env set keeps a value that starts with its own name (FILTER=active under |
| +// FILTER is plausible config), and secrets set --literal (refuseNamed |
| +// false) stores one on purpose, from an argument or from stdin. |
| +func TestNamedValueAllowedForEnvSetAndLiteral(t *testing.T) { |
| + want := map[string]string{"FILTER": "FILTER=active"} |
| + if got, err := parseKV([]string{"FILTER=FILTER=active"}); err != nil || !reflect.DeepEqual(got, want) { |
| + t.Fatalf("env set: %q %v, want %q", got, err, want) |
| + } |
| + if got, err := parseSecretsArgs([]string{"FILTER=FILTER=active"}, nil, false); err != nil || !reflect.DeepEqual(got, want) { |
| + t.Fatalf("--literal argument: %q %v, want %q", got, err, want) |
| + } |
| + _, stdin := stdinOf("FILTER=active\n", false) |
| + if got, err := parseSecretsArgs([]string{"FILTER", "-"}, stdin, false); err != nil || !reflect.DeepEqual(got, want) { |
| + t.Fatalf("--literal stdin: %q %v, want %q", got, err, want) |
| + } |
| +} |
| + |
| +// --literal through the verb, against a real console: the value is stored |
| +// as given. |
| +func TestSecretsSetLiteralStoresANamedValue(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}) |
| + runCapturingRealStdout(t, func() { |
| + runSecretsSet([]string{"-account", "ops", "-app", "shop", "--literal", "FILTER=FILTER=active"}) |
| + }) |
| + 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["FILTER"].Envelope) |
| + if err != nil || string(got) != "FILTER=active" { |
| + t.Fatalf("stored value = %q %v, want FILTER=active", got, err) |
| + } |
| +} |
| + |
| +// The terminal answer is go-isatty's console check OR its Cygwin/MSYS2 |
| +// check: a Windows Git Bash or MSYS2 terminal is a pipe to the first. |
| +func TestStdinTerminalAsksBothChecks(t *testing.T) { |
| + yes := func(uintptr) bool { return true } |
| + no := func(uintptr) bool { return false } |
| + for _, tc := range []struct { |
| + console, cygwin func(uintptr) bool |
| + want bool |
| + }{{no, no, false}, {yes, no, true}, {no, yes, true}, {yes, yes, true}} { |
| + if got := stdinTerminal(0, tc.console, tc.cygwin); got != tc.want { |
| + t.Fatalf("stdinTerminal = %v, want %v", got, tc.want) |
| + } |
| + } |
| + // And the real checks on a real pipe: not a terminal. |
| + r, w, err := os.Pipe() |
| + if err != nil { |
| + t.Fatal(err) |
| + } |
| + defer r.Close() |
| + defer w.Close() |
| + if stdinTerminal(r.Fd(), isatty.IsTerminal, isatty.IsCygwinTerminal) { |
| + t.Fatal("a pipe reads as a terminal") |
| + } |
| +} |
| + |
| +// endless is a producer that never stops. |
| +type endless struct{ n int } |
| + |
| +func (e *endless) Read(b []byte) (int, error) { |
| + for i := range b { |
| + b[i] = 'a' |
| + } |
| + e.n += len(b) |
| + return len(b), nil |
| +} |
| + |
| +// Stdin is capped at secretsStdinMaxBytes: exactly the cap is a value, one |
| +// byte more is refused without echoing it, and an endless producer is read |
| +// no further than the cap and one byte. |
| +func TestSecretsStdinIsCapped(t *testing.T) { |
| + at := strings.Repeat("a", secretsStdinMaxBytes) |
| + _, stdin := stdinOf(at, false) |
| + got, err := parseSecretsArgs([]string{"KEY", "-"}, stdin, true) |
| + if err != nil || got["KEY"] != at { |
| + t.Fatalf("exactly %d bytes: len %d, %v", secretsStdinMaxBytes, len(got["KEY"]), err) |
| + } |
| + _, stdin = stdinOf(at+"b", false) |
| + _, err = parseSecretsArgs([]string{"KEY", "-"}, stdin, true) |
| + if err == nil || !strings.Contains(err.Error(), "larger than 64 KiB") || strings.Contains(err.Error(), "aaaa") { |
| + t.Fatalf("one byte over: err = %v, want the size refusal without the value", err) |
| + } |
| + e := &endless{} |
| + _, err = parseSecretsArgs([]string{"KEY", "-"}, func() (io.Reader, bool) { return e, false }, true) |
| + if err == nil || !strings.Contains(err.Error(), "larger than 64 KiB") { |
| + t.Fatalf("endless: err = %v, want the size refusal", err) |
| + } |
| + if e.n > 2*secretsStdinMaxBytes { |
| + t.Fatalf("endless producer read %d bytes, want about the cap", e.n) |
| + } |
| +} |
| + |
| // 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) { |
diff --git a/testdata/clireg-golden.jsonl b/testdata/clireg-golden.jsonl| index 84075d4fb..b81e2104f 100644 |
| --- a/testdata/clireg-golden.jsonl |
| +++ b/testdata/clireg-golden.jsonl |
| @@ -671,8 +671,8 @@ |
| {"case":"secrets genkey | skipped","skipped":"prints a freshly generated key pair: no two runs agree"} |
| {"case":"secrets list | --zz-unknown-flag","argv":["secrets","list","--zz-unknown-flag"],"exit":2,"stdout":"","stderr":"flag provided but not defined: -zz-unknown-flag\nusage: carlos secrets list [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 list (omit for the default bundle)\n --registry <string> registry database (resolves --account) (default: $DIR/data/registry.db)\n"} |
| {"case":"secrets list | -h","argv":["secrets","list","-h"],"exit":0,"stdout":"","stderr":"usage: carlos secrets list [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 list (omit for the default bundle)\n --registry <string> registry database (resolves --account) (default: $DIR/data/registry.db)\n"} |
| -{"case":"secrets set | --zz-unknown-flag","argv":["secrets","set","--zz-unknown-flag"],"exit":2,"stdout":"","stderr":"flag provided but not defined: -zz-unknown-flag\nusage: 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 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 set | --zz-unknown-flag","argv":["secrets","set","--zz-unknown-flag"],"exit":2,"stdout":"","stderr":"flag provided but not defined: -zz-unknown-flag\nusage: 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 --literal store a value that starts with its own key and = as it is\n --registry <string> registry database (resolves --account) (default: $DIR/data/registry.db)\n"} |
| +{"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 --literal store a value that starts with its own key and = as it is\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 --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"} |