supabase / cli

Supabase CLI. Manage postgres migrations, run Supabase locally, deploy edge functions. Postgres backups. Generating types from your database schema.
https://supabase.com/docs/reference/cli/about
MIT License
1.07k stars 209 forks source link

Change docker ip in port from 0.0.0.0 for supabase start local development. #1397

Closed 0xBigBoss closed 5 months ago

0xBigBoss commented 1 year ago

is there anyway to change the binding IP for local supabase from 0.0.0.0 to 127.0.0.1?

image

supabase cli is also not respecting the /etc/docker/daemon.json default IP

image

daniel-j-h commented 8 months ago

Coming from https://github.com/supabase/cli/issues/1977

When running supabase start or supabase db start it looks like services are getting exposed on the network, such as the postgres database. I believe this is because when we start containers they bind to all network interfaces instead of just localhost

This is both unexpected and dangerous to have services exposed publicly on the network.

Especially because the locally running services are not secured in any way: someone in the same cafe Wifi as I am can run psql against my host and is in without any credentials

$ psql --host 192.168.2.101 --port 54322 --user postgres

psql (15.5 (Ubuntu 15.5-1.pgdg20.04+1), server 15.1 (Ubuntu 15.1-1.pgdg20.04+1))
Type "help" for help.

postgres=>

This works, I just tested it from a second computer to get access to my laptop's supabase stack running from supabase start


Ideally we'd expose services only on localhost - the equivalent of

docker run -p 127.0.0.1:54322:54322

Here's an idea how it could work

jmath3912 commented 6 months ago

any updates regarding this? i find it odd that supabase says its listening on localhost when its really listening on all interfaces

sweatybridge commented 5 months ago

Binding only to localhost interface is now possible in beta release with custom docker network support. For eg.

docker network create -o 'com.docker.network.bridge.host_binding_ipv4=127.0.0.1' local-network
npx supabase@beta start --network-id local-network