test new accepts parent-directory names and creates files outside supabase/tests
@7ttp ci sta già lavorando.
Dal 23/9/2026.
Valutazione
Questa issue non è ancora stata valutata.
Descrizione
Affected area
Database
Supabase CLI version
v2.118.0-beta.67
Operating system
macOS 15.1 (Darwin 24.1.0)
Installation method
npm (npx)
Command
tmp="$(mktemp -d)"
mkdir -p "$tmp/project"
npx --yes --package=supabase@2.118.0-beta.67 -- \
supabase --workdir "$tmp/project" test new ../../../escaped
test -f "$tmp/escaped_test.sql" && echo "created outside supabase/tests"
Actual output
{"path":"../escaped_test.sql","template":"pgtap","message":""}
created outside supabase/tests
The command exits successfully and creates escaped_test.sql outside the configured workdir. The expected supabase/tests directory is not created.
Expected behavior
test new should reject a name whose normalized output path escapes <workdir>/supabase/tests, exit non-zero, and write nothing outside that directory.
Names containing subdirectories should remain valid if their resolved destination stays within supabase/tests.
Steps to reproduce
- Create an empty temporary project directory.
- Run
supabase test newwith../../../escapedas the test name, as shown above. - Observe that the command reports success.
- Observe that the generated file is outside both the configured workdir and
supabase/tests.
Crash report ID
No response
Docker and service versions
Not applicable; this command does not use Docker or local services.
Additional context
The handler constructs the destination with path.join("supabase", "tests", name + "_test.sql"). Parent-directory segments are normalized before the write, but the result is not checked against the intended tests directory:
https://github.com/supabase/cli/blob/develop/apps/cli/src/commands/test/new/new.handler.ts#L24-L29
The command's side-effect contract documents writes only under <workdir>/supabase/tests:
The existing file check prevents overwriting an existing outside file, but the command can create a new file and parent directories outside its documented destination.
supabase migration new already performs an analogous containment check for migration names:
I searched the current and historical issues and pull requests and did not find an existing report or active fix. I would be happy to contribute a focused fix and integration test after maintainer triage if this is labeled open-for-contribution.
- Lingua principale
- TypeScript
- Stelle
- 2.4k
- Fork
- 523
- Merge medio
- 1g 1h
- PR unite (30g)
- 268
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di supabase/cli
-
🐛 Bug supabase/cli
-
🐛 Bug supabase/cli
Difficoltà 3/5 1-2 giorni Idoneità per principianti 65/100
-
bug supabase/cli
Difficoltà 3/5 1-2 giorni Idoneità per principianti 65/100
-
🐛 Bug supabase/cli
Difficoltà 3/5 1-2 giorni Idoneità per principianti 65/100
-
🐛 Bug supabase/cli
Tutte le issue di supabase/cli
Issue simili
-
bug(cli): hapi doctor inline-media prints a fabricated B:\ helper-script path in packaged installs Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
-
Crush Aperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 85/100
catppuccin/catppuccin#3125 ·
-
Add a SECURITY.md Aperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 90/100
ElementsProject/cln-application#167 · 1 commento · 1 reazione ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
Quantco/pnpm-licenses#17 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100