Skip to content

feat(cli): add stack command options and destruction - #6517

Open
jgoux wants to merge 5 commits into
feat/stack-command-routingfrom
feat/stack-command-options
Open

feat(cli): add stack command options and destruction#6517
jgoux wants to merge 5 commits into
feat/stack-command-routingfrom
feat/stack-command-options

Conversation

@jgoux

@jgoux jgoux commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

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 --exclude accepts service names, comma-separated or repeated. It leaves the project file unchanged and records the effective start configuration in stack state.
  • stop --all retains 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 --env exports connection variables as dotenv or a JSON variable map, with --override-name for 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 destroy permanently removes one selected stack after confirmation, with --yes for unattended execution.

This follows #6516. The legacy implementations and database data remain separate.

@jgoux
jgoux requested a review from a team as a code owner September 8, 2026 08:46
@jgoux
jgoux force-pushed the feat/stack-command-options branch from 42ab609 to 93ff6fd Compare September 8, 2026 10:01
"A credential cannot be represented losslessly as dotenv. Use --env --output-format json.",
}),
);
return Effect.succeed(`${name}=${quote}${value}${quote}`);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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.

@jgoux
jgoux force-pushed the feat/stack-command-options branch from 93ff6fd to 3e6e5e9 Compare September 8, 2026 11:32
@jgoux
jgoux force-pushed the feat/stack-command-options branch from 3e6e5e9 to 1e87f8e Compare September 8, 2026 12:32
@github-actions

github-actions Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Supabase CLI preview

npx --yes https://pkg.pr.new/supabase/cli/supabase@95551dda43408c6b9d74d0565f86d2addc30edfe

Preview package for commit 95551dd.

@jgoux

jgoux commented Sep 8, 2026

Copy link
Copy Markdown
Contributor Author

/ai-review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant