Repository navigation
fix(security): bind the local Postgres port to loopback only - #423
Open
HusseinAdeiza wants to merge 1 commit into
Open
HusseinAdeiza wants to merge 1 commit into
HusseinAdeiza wants to merge 1 commit into
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Advanced Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
docker-compose.yml published Postgres as ${DBPORT:-5432}:5432 with no
host IP, so Docker bound 0.0.0.0 and the container was reachable from any
interface. .env.example ships DBUSER=postgres / DBPASSWORD=postgres as the
defaults, so a stock `genlayer init` on a host with a public IP exposed a
superuser Postgres on 5432, which is enough for RCE via CREATE FUNCTION
plus libc.so.6.
The localnet only ever reaches Postgres over the compose network as
postgres:5432, so the published port is not needed for the stack to work.
Binding it to 127.0.0.1 keeps psql and other host-side tooling working
while removing the public exposure. Fixes #1603.
HusseinAdeiza
force-pushed
the
fix/postgres-port-loopback-only
branch
from
September 28, 2026 20:21
8cd0cb6 to
acd7be3
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1603.
On
v0.40-dev,docker-compose.yml:106published Postgres as"${DBPORT:-5432}:5432"with no host IP, so Docker bound0.0.0.0..env.exampleshipsDBUSER=postgres/DBPASSWORD=postgresas the defaults, so a stockgenlayer initon a host with a public IP exposed a superuser Postgres on 5432, which is enough for RCE viaCREATE FUNCTION+libc.so.6.The localnet only reaches Postgres over the compose network as
postgres:5432(database-migration'sDB_URL), so the published port isn't needed for the stack to work. Binding to127.0.0.1keepspsqland other host-side tooling working while removing the public exposure.Verified with
docker compose config, before and after:tests/docker-compose-ports.test.tsguards the binding so it can't silently regress. Both tests fail against the pre-fix compose file:Full suite: 814 passed. The one failing suite (
keychainManager.test.ts) is a missinglibsecret-1.so.0system library on this machine, which CI installs explicitly; it is unrelated to this change.The same line exists in
genlayer-studioatv0.123-dev:278, already covered by #1715. This PR is scoped to the CLI, which is where this report is filed and where no fix exists yet.