feat(cli): add stack command options and destruction - #6517
Conversation
42ab609 to
93ff6fd
Compare
| "A credential cannot be represented losslessly as dotenv. Use --env --output-format json.", | ||
| }), | ||
| ); | ||
| return Effect.succeed(`${name}=${quote}${value}${quote}`); |
There was a problem hiding this comment.
🟡 Severity: MEDIUM
A stack credential containing a single quote but no backtick is wrapped in backticks here. If a consumer sources the generated dotenv file, the shell evaluates that content as command substitution, so an attacker-controlled credential can execute commands before environment variables are set.
Helpful? Add 👍 / 👎
💡 Fix Suggestion
Suggestion: On line 84, remove the backtick from the list of candidate quote characters. Change ["'", "\"]to["'"]. With this change, any credential or value that contains a single quote will fall through to the existing quote === undefinedcheck and fail with the error message directing users to use--output-format json`, rather than falling back to backtick quoting. Backtick-delimited strings are treated as command substitution by POSIX shells (bash, sh, zsh), so sourcing a dotenv file containing backtick-quoted values with attacker-controlled content can execute arbitrary commands. Removing backtick as a quoting option entirely eliminates this risk — dotenv files produced by this function will only ever use single-quote wrapping, which is safe to source.
93ff6fd to
3e6e5e9
Compare
3e6e5e9 to
1e87f8e
Compare
Supabase CLI previewnpx --yes https://pkg.pr.new/supabase/cli/supabase@95551dda43408c6b9d74d0565f86d2addc30edfePreview package for commit |
|
/ai-review |
|
Superseeded by #6576 |
Add service selection, bulk stopping, and explicit destruction to experimental local stacks directly on `develop`. The existing config-selected top-level `start` and `stop` aliases inherit the new options. - `start --exclude` / `-x` accepts comma-separated or repeated service names, preserves the project file, and records the effective configuration in stack state. Dependent services are also disabled: excluding REST or Analytics disables Studio. - `stop --all` preserves data and attempts every readable registered stack. It reports per-stack error details and stopped/failed/skipped counts after processing every readable stack, returning nonzero when any stack could not be verifiably stopped. - `stack destroy` permanently removes one selected stack after confirmation, with `--yes` for unattended execution. This extracts the non-status work from the earlier PR. Status and credential-export changes are excluded because the new status command has not landed on `develop`. Supersedes supabase#6517
Adds status inspection and connection-variable export for the experimental local stack backend. With `[experimental] stack = true` or `SUPABASE_EXPERIMENTAL_STACK=1`, `supabase status` and `supabase stack status` use the same implementation. With the feature disabled, the `stack` command group is absent and top-level `status` keeps its legacy behavior. Status reports identity, runtime, owner, readiness, endpoints, and configuration drift without revealing credential values. Configuration is loaded from the selected stack’s project, including when inspecting an ID from another working directory. Invalid or unreadable configuration leaves inspection available and marks drift unavailable; an absent config uses defaults. `--env` exports running-stack connection variables as dotenv or a JSON variable map. `--override-name` supports repeated or comma-separated renames and rejects invalid names or collisions. Database-only stacks export database credentials without API credentials. Stopped stacks and credential failures return an error without partial output. Legacy `-o/--output` values are rejected with guidance to use `--output-format` or `--env`. Supersedes supabase#6517. --------- Co-authored-by: avallete <andrew.valleteau@supabase.io> Co-authored-by: Colum Ferry <cferry09@gmail.com>
Add service selection, bulk stopping, environment export, and explicit destruction to the new local stack commands. These options also apply to the config-selected top-level start, stop, and status aliases.
start --excludeaccepts service names, comma-separated or repeated. It leaves the project file unchanged and records the effective start configuration in stack state.stop --allretains data and attempts every readable registered stack. Unreadable entries are skipped with warnings; skipped entries and stop failures produce a nonzero result after the remaining stacks are processed.status --envexports connection variables as dotenv or a JSON variable map, with--override-namefor application-specific names. Ordinary status does not reveal credentials. Database-only stacks can retrieve database credentials with API credentials omitted when Auth is disabled.stack destroypermanently removes one selected stack after confirmation, with--yesfor unattended execution.This follows #6516. The legacy implementations and database data remain separate.