Railway Postgres startup wrapper has a permission bug in /usr/local/bin/wrapper.sh.
siddhi-bansal
HOBBYOP

22 days ago

Railway Postgres startup wrapper has a permission bug in /usr/local/bin/wrapper.sh.

In fork_collation_refresh(), it creates:

tmpfile=$(mktemp /tmp/collation-refresh.XXXXXX.sql)

The wrapper runs as root, so mktemp creates a root-owned 0600 file. Then it runs:

gosu postgres psql -v ON_ERROR_STOP=0 -q -f "$tmpfile"

Because psql runs as postgres, it cannot read the root-owned temp file, causing:

collation-refresh: psql: error: /tmp/collation-refresh.X.sql: Permission denied

Postgres itself recovers successfully and is ready to accept connections; the failure is in the collation-refresh helper.

Solved

1 Replies

Railway
BOT

22 days ago

Thanks for the detailed bug report. The Postgres image is open source at github.com/railwayapp-templates/postgres-ssl, and you're welcome to open an issue or PR there so the maintainers can track and fix the tmpfile ownership in fork_collation_refresh(). As you noted, Postgres itself is unaffected since the collation-refresh helper is non-critical.


Status changed to Awaiting User Response Railway 22 days ago


Railway
BOT

15 days ago

This thread has been marked as solved automatically due to a lack of recent activity. Please re-open this thread or create a new one if you require further assistance. Thank you!

Status changed to Solved Railway 15 days ago


Welcome!

Sign in to your Railway account to join the conversation.

Loading...