Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions bin/postgresql14.23/bearsampp.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
postgresqlVersion = "14.23"
postgresqlCtlExe = "bin/pg_ctl.exe"
postgresqlCliExe = "bin/psql.exe"
postgresqlDumpExe = "bin/pg_dump.exe"
postgresqlDumpAllExe = "bin/pg_dumpall.exe"
postgresqlConf = "data/postgresql.conf"
postgresqlUserConf = "data/pg_hba.conf"
postgresqlAltConf = "postgresql.conf.ber"
postgresqlAltUserConf = "pg_hba.conf.ber"
postgresqlPort = "5432"
postgresqlRootUser = "postgres"
postgresqlRootPwd = ""

bundleRelease = "@RELEASE_VERSION@"
5 changes: 5 additions & 0 deletions bin/postgresql14.23/init.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
@ECHO OFF

%~dp0bin\initdb.exe -U postgres -A trust -E utf8 -D "%~dp0data" > "~BEARSAMPP_WIN_PATH~\logs\postgresql-install.log" 2>&1
copy /y "%~dp0postgresql.conf.ber" "%~dp0data\postgresql.conf"
copy /y "%~dp0pg_hba.conf.ber" "%~dp0data\pg_hba.conf"
3 changes: 3 additions & 0 deletions bin/postgresql14.23/pg_hba.conf.ber
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# TYPE DATABASE USER ADDRESS METHOD
host all all 127.0.0.1/32 trust
host all all ::1/128 trust
35 changes: 35 additions & 0 deletions bin/postgresql14.23/postgresql.conf.ber
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#------------------------------------------------------------------------------
# FILE LOCATIONS
#------------------------------------------------------------------------------
data_directory = '~BEARSAMPP_LIN_PATH~/bin/postgresql/postgresql14.23/data'
hba_file = '~BEARSAMPP_LIN_PATH~/bin/postgresql/postgresql14.23/data/pg_hba.conf'
ident_file = '~BEARSAMPP_LIN_PATH~/bin/postgresql/postgresql14.23/data/pg_ident.conf'

#------------------------------------------------------------------------------
# CONNECTIONS AND AUTHENTICATION
#------------------------------------------------------------------------------
listen_addresses = '*'
port = 5432
max_connections = 100

#------------------------------------------------------------------------------
# RESOURCE USAGE (except WAL)
#------------------------------------------------------------------------------
shared_buffers = 32MB

#------------------------------------------------------------------------------
# ERROR REPORTING AND LOGGING
#------------------------------------------------------------------------------
log_destination = 'stderr'
logging_collector = on
log_directory = '~BEARSAMPP_LIN_PATH~/logs'
log_filename = 'postgresql.log'
log_file_mode = 0777
log_truncate_on_rotation = off
log_rotation_age = 0
log_rotation_size = 0

client_min_messages = notice
log_min_messages = warning
log_min_error_statement = error
log_min_duration_statement = -1
14 changes: 14 additions & 0 deletions bin/postgresql15.18/bearsampp.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
postgresqlVersion = "15.18"
postgresqlCtlExe = "bin/pg_ctl.exe"
postgresqlCliExe = "bin/psql.exe"
postgresqlDumpExe = "bin/pg_dump.exe"
postgresqlDumpAllExe = "bin/pg_dumpall.exe"
postgresqlConf = "data/postgresql.conf"
postgresqlUserConf = "data/pg_hba.conf"
postgresqlAltConf = "postgresql.conf.ber"
postgresqlAltUserConf = "pg_hba.conf.ber"
postgresqlPort = "5432"
postgresqlRootUser = "postgres"
postgresqlRootPwd = ""

bundleRelease = "@RELEASE_VERSION@"
5 changes: 5 additions & 0 deletions bin/postgresql15.18/init.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
@ECHO OFF

%~dp0bin\initdb.exe -U postgres -A trust -E utf8 -D "%~dp0data" > "~BEARSAMPP_WIN_PATH~\logs\postgresql-install.log" 2>&1
copy /y "%~dp0postgresql.conf.ber" "%~dp0data\postgresql.conf"
copy /y "%~dp0pg_hba.conf.ber" "%~dp0data\pg_hba.conf"
3 changes: 3 additions & 0 deletions bin/postgresql15.18/pg_hba.conf.ber
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# TYPE DATABASE USER ADDRESS METHOD
host all all 127.0.0.1/32 trust
host all all ::1/128 trust
35 changes: 35 additions & 0 deletions bin/postgresql15.18/postgresql.conf.ber
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#------------------------------------------------------------------------------
# FILE LOCATIONS
#------------------------------------------------------------------------------
data_directory = '~BEARSAMPP_LIN_PATH~/bin/postgresql/postgresql15.18/data'
hba_file = '~BEARSAMPP_LIN_PATH~/bin/postgresql/postgresql15.18/data/pg_hba.conf'
ident_file = '~BEARSAMPP_LIN_PATH~/bin/postgresql/postgresql15.18/data/pg_ident.conf'

#------------------------------------------------------------------------------
# CONNECTIONS AND AUTHENTICATION
#------------------------------------------------------------------------------
listen_addresses = '*'
port = 5432
max_connections = 100

#------------------------------------------------------------------------------
# RESOURCE USAGE (except WAL)
#------------------------------------------------------------------------------
shared_buffers = 32MB

#------------------------------------------------------------------------------
# ERROR REPORTING AND LOGGING
#------------------------------------------------------------------------------
log_destination = 'stderr'
logging_collector = on
log_directory = '~BEARSAMPP_LIN_PATH~/logs'
log_filename = 'postgresql.log'
log_file_mode = 0777
log_truncate_on_rotation = off
log_rotation_age = 0
log_rotation_size = 0

client_min_messages = notice
log_min_messages = warning
log_min_error_statement = error
log_min_duration_statement = -1
14 changes: 14 additions & 0 deletions bin/postgresql16.14/bearsampp.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
postgresqlVersion = "16.14"
postgresqlCtlExe = "bin/pg_ctl.exe"
postgresqlCliExe = "bin/psql.exe"
postgresqlDumpExe = "bin/pg_dump.exe"
postgresqlDumpAllExe = "bin/pg_dumpall.exe"
postgresqlConf = "data/postgresql.conf"
postgresqlUserConf = "data/pg_hba.conf"
postgresqlAltConf = "postgresql.conf.ber"
postgresqlAltUserConf = "pg_hba.conf.ber"
postgresqlPort = "5432"
postgresqlRootUser = "postgres"
postgresqlRootPwd = ""

bundleRelease = "@RELEASE_VERSION@"
5 changes: 5 additions & 0 deletions bin/postgresql16.14/init.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
@ECHO OFF

%~dp0bin\initdb.exe -U postgres -A trust -E utf8 -D "%~dp0data" > "~BEARSAMPP_WIN_PATH~\logs\postgresql-install.log" 2>&1
copy /y "%~dp0postgresql.conf.ber" "%~dp0data\postgresql.conf"
copy /y "%~dp0pg_hba.conf.ber" "%~dp0data\pg_hba.conf"
3 changes: 3 additions & 0 deletions bin/postgresql16.14/pg_hba.conf.ber
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# TYPE DATABASE USER ADDRESS METHOD
host all all 127.0.0.1/32 trust
host all all ::1/128 trust
35 changes: 35 additions & 0 deletions bin/postgresql16.14/postgresql.conf.ber
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#------------------------------------------------------------------------------
# FILE LOCATIONS
#------------------------------------------------------------------------------
data_directory = '~BEARSAMPP_LIN_PATH~/bin/postgresql/postgresql16.14/data'
hba_file = '~BEARSAMPP_LIN_PATH~/bin/postgresql/postgresql16.14/data/pg_hba.conf'
ident_file = '~BEARSAMPP_LIN_PATH~/bin/postgresql/postgresql16.14/data/pg_ident.conf'

#------------------------------------------------------------------------------
# CONNECTIONS AND AUTHENTICATION
#------------------------------------------------------------------------------
listen_addresses = '*'
port = 5432
max_connections = 100

#------------------------------------------------------------------------------
# RESOURCE USAGE (except WAL)
#------------------------------------------------------------------------------
shared_buffers = 32MB

#------------------------------------------------------------------------------
# ERROR REPORTING AND LOGGING
#------------------------------------------------------------------------------
log_destination = 'stderr'
logging_collector = on
log_directory = '~BEARSAMPP_LIN_PATH~/logs'
log_filename = 'postgresql.log'
log_file_mode = 0777
log_truncate_on_rotation = off
log_rotation_age = 0
log_rotation_size = 0

client_min_messages = notice
log_min_messages = warning
log_min_error_statement = error
log_min_duration_statement = -1
14 changes: 14 additions & 0 deletions bin/postgresql17.10/bearsampp.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
postgresqlVersion = "17.10"
postgresqlCtlExe = "bin/pg_ctl.exe"
postgresqlCliExe = "bin/psql.exe"
postgresqlDumpExe = "bin/pg_dump.exe"
postgresqlDumpAllExe = "bin/pg_dumpall.exe"
postgresqlConf = "data/postgresql.conf"
postgresqlUserConf = "data/pg_hba.conf"
postgresqlAltConf = "postgresql.conf.ber"
postgresqlAltUserConf = "pg_hba.conf.ber"
postgresqlPort = "5432"
postgresqlRootUser = "postgres"
postgresqlRootPwd = ""

bundleRelease = "@RELEASE_VERSION@"
5 changes: 5 additions & 0 deletions bin/postgresql17.10/init.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
@ECHO OFF

%~dp0bin\initdb.exe -U postgres -A trust -E utf8 -D "%~dp0data" > "~BEARSAMPP_WIN_PATH~\logs\postgresql-install.log" 2>&1
copy /y "%~dp0postgresql.conf.ber" "%~dp0data\postgresql.conf"
copy /y "%~dp0pg_hba.conf.ber" "%~dp0data\pg_hba.conf"
3 changes: 3 additions & 0 deletions bin/postgresql17.10/pg_hba.conf.ber
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# TYPE DATABASE USER ADDRESS METHOD
host all all 127.0.0.1/32 trust
host all all ::1/128 trust
35 changes: 35 additions & 0 deletions bin/postgresql17.10/postgresql.conf.ber
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#------------------------------------------------------------------------------
# FILE LOCATIONS
#------------------------------------------------------------------------------
data_directory = '~BEARSAMPP_LIN_PATH~/bin/postgresql/postgresql17.10/data'
hba_file = '~BEARSAMPP_LIN_PATH~/bin/postgresql/postgresql17.10/data/pg_hba.conf'
ident_file = '~BEARSAMPP_LIN_PATH~/bin/postgresql/postgresql17.10/data/pg_ident.conf'

#------------------------------------------------------------------------------
# CONNECTIONS AND AUTHENTICATION
#------------------------------------------------------------------------------
listen_addresses = '*'
port = 5432
max_connections = 100

#------------------------------------------------------------------------------
# RESOURCE USAGE (except WAL)
#------------------------------------------------------------------------------
shared_buffers = 32MB

#------------------------------------------------------------------------------
# ERROR REPORTING AND LOGGING
#------------------------------------------------------------------------------
log_destination = 'stderr'
logging_collector = on
log_directory = '~BEARSAMPP_LIN_PATH~/logs'
log_filename = 'postgresql.log'
log_file_mode = 0777
log_truncate_on_rotation = off
log_rotation_age = 0
log_rotation_size = 0

client_min_messages = notice
log_min_messages = warning
log_min_error_statement = error
log_min_duration_statement = -1
14 changes: 14 additions & 0 deletions bin/postgresql18.4/bearsampp.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
postgresqlVersion = "18.4"
postgresqlCtlExe = "bin/pg_ctl.exe"
postgresqlCliExe = "bin/psql.exe"
postgresqlDumpExe = "bin/pg_dump.exe"
postgresqlDumpAllExe = "bin/pg_dumpall.exe"
postgresqlConf = "data/postgresql.conf"
postgresqlUserConf = "data/pg_hba.conf"
postgresqlAltConf = "postgresql.conf.ber"
postgresqlAltUserConf = "pg_hba.conf.ber"
postgresqlPort = "5432"
postgresqlRootUser = "postgres"
postgresqlRootPwd = ""

bundleRelease = "@RELEASE_VERSION@"
5 changes: 5 additions & 0 deletions bin/postgresql18.4/init.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
@ECHO OFF

%~dp0bin\initdb.exe -U postgres -A trust -E utf8 -D "%~dp0data" > "~BEARSAMPP_WIN_PATH~\logs\postgresql-install.log" 2>&1

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Action required

1. Initdb path unquoted 🐞 Bug ☼ Reliability

The new init.bat scripts invoke %~dp0bin\initdb.exe without quoting the executable path, which will
fail when the module path contains spaces. This breaks database initialization and leaves the
PostgreSQL bundle unusable.
Agent Prompt
### Issue description
Windows batch parsing splits on spaces; calling `%~dp0bin\initdb.exe` without quotes fails when `%~dp0` contains spaces.

### Issue Context
This pattern exists in all newly added PostgreSQL version folders’ `init.bat`.

### Fix Focus Areas
- bin/postgresql14.23/init.bat[1-5]
- bin/postgresql15.18/init.bat[1-5]
- bin/postgresql16.14/init.bat[1-5]
- bin/postgresql17.10/init.bat[1-5]
- bin/postgresql18.4/init.bat[1-5]

### What to change
- Update the invocation to quote the executable path, e.g.:
  - `"%~dp0bin\initdb.exe" -U postgres ...`
- Keep the existing quoting for `-D "%~dp0data"` as-is.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

copy /y "%~dp0postgresql.conf.ber" "%~dp0data\postgresql.conf"
copy /y "%~dp0pg_hba.conf.ber" "%~dp0data\pg_hba.conf"
3 changes: 3 additions & 0 deletions bin/postgresql18.4/pg_hba.conf.ber
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# TYPE DATABASE USER ADDRESS METHOD
host all all 127.0.0.1/32 trust
host all all ::1/128 trust
Comment on lines +2 to +3

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Action required

2. Trust auth enabled 🐞 Bug ⛨ Security

The new PostgreSQL bundles initialize and configure authentication as trust, allowing any local OS
user to connect as any database role (including postgres) without a password. This enables
unauthorized database access on shared/multi-user machines.
Agent Prompt
### Issue description
The bundle uses `trust` authentication in both cluster initialization (`initdb -A trust`) and runtime access rules (`pg_hba.conf`), allowing passwordless access.

### Issue Context
Even though `pg_hba.conf` is limited to localhost, `trust` still permits any local user to authenticate as any DB role.

### Fix Focus Areas
- bin/postgresql14.23/init.bat[1-5]
- bin/postgresql14.23/pg_hba.conf.ber[1-3]
- bin/postgresql15.18/init.bat[1-5]
- bin/postgresql15.18/pg_hba.conf.ber[1-3]
- bin/postgresql16.14/init.bat[1-5]
- bin/postgresql16.14/pg_hba.conf.ber[1-3]
- bin/postgresql17.10/init.bat[1-5]
- bin/postgresql17.10/pg_hba.conf.ber[1-3]
- bin/postgresql18.4/init.bat[1-5]
- bin/postgresql18.4/pg_hba.conf.ber[1-3]

### What to change
- Change `initdb` auth to a password-based method (e.g., `-A scram-sha-256` or `-A md5`) and ensure an initial superuser password is set/managed.
- Update `pg_hba.conf.ber` entries to match (e.g., `scram-sha-256` instead of `trust`) for localhost rules.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

35 changes: 35 additions & 0 deletions bin/postgresql18.4/postgresql.conf.ber
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#------------------------------------------------------------------------------
# FILE LOCATIONS
#------------------------------------------------------------------------------
data_directory = '~BEARSAMPP_LIN_PATH~/bin/postgresql/postgresql18.4/data'
hba_file = '~BEARSAMPP_LIN_PATH~/bin/postgresql/postgresql18.4/data/pg_hba.conf'
ident_file = '~BEARSAMPP_LIN_PATH~/bin/postgresql/postgresql18.4/data/pg_ident.conf'

#------------------------------------------------------------------------------
# CONNECTIONS AND AUTHENTICATION
#------------------------------------------------------------------------------
listen_addresses = '*'
port = 5432
max_connections = 100

#------------------------------------------------------------------------------
# RESOURCE USAGE (except WAL)
#------------------------------------------------------------------------------
shared_buffers = 32MB

#------------------------------------------------------------------------------
# ERROR REPORTING AND LOGGING
#------------------------------------------------------------------------------
log_destination = 'stderr'
logging_collector = on
log_directory = '~BEARSAMPP_LIN_PATH~/logs'
log_filename = 'postgresql.log'
log_file_mode = 0777
log_truncate_on_rotation = off
log_rotation_age = 0
log_rotation_size = 0

client_min_messages = notice
log_min_messages = warning
log_min_error_statement = error
log_min_duration_statement = -1
27 changes: 20 additions & 7 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ plugins {
id 'base'
}

// Load build properties from gradle.properties
// Load build properties from build.properties
def buildProps = new Properties()
file('gradle.properties').withInputStream { buildProps.load(it) }
file('build.properties').withInputStream { buildProps.load(it) }

// Project information
group = 'com.bearsampp.modules'
Expand All @@ -35,14 +35,14 @@ ext {
rootDir = projectDir.parent
devPath = file("${rootDir}/dev").absolutePath

// Bundle properties from gradle.properties
// Bundle properties from build.properties
bundleName = buildProps.getProperty('bundle.name', 'postgresql')
bundleRelease = buildProps.getProperty('bundle.release', '1.0.0')
bundleType = buildProps.getProperty('bundle.type', 'bins')
bundleFormat = buildProps.getProperty('bundle.format', '7z')

// Build paths - with configurable base path
// Priority: 1) gradle.properties, 2) Environment variable, 3) Default
// Priority: 1) build.properties, 2) Environment variable, 3) Default
def buildPathFromProps = buildProps.getProperty('build.path', '').trim()
def buildPathFromEnv = System.getenv('BEARSAMPP_BUILD_PATH') ?: ''
def defaultBuildPath = "${rootDir}/bearsampp-build"
Expand Down Expand Up @@ -592,9 +592,9 @@ tasks.register('release') {
println "Preparing archive..."

// Determine build output path following Bruno pattern
// bearsampp-build/{bundleType}/{bundleName}
// bearsampp-build/{bundleType}/{bundleName}/{bundleRelease}
def buildPath = file(buildBasePath)
def buildBinsPath = file("${buildPath}/${bundleType}/${bundleName}")
def buildBinsPath = file("${buildPath}/${bundleType}/${bundleName}/${bundleRelease}")
buildBinsPath.mkdirs()

// Build archive filename
Expand Down Expand Up @@ -856,7 +856,20 @@ tasks.register('listReleases') {

println "\nAvailable PostgreSQL Releases (modules-untouched):"
println "-".multiply(80)
props.sort { a, b -> a.key <=> b.key }.each { version, url ->
props.sort { a, b ->
def aParts = a.key.tokenize('.').collect { it.isInteger() ? it.toInteger() : it }
def bParts = b.key.tokenize('.').collect { it.isInteger() ? it.toInteger() : it }
for (int i = 0; i < Math.max(aParts.size(), bParts.size()); i++) {
def aVal = i < aParts.size() ? aParts[i] : 0
def bVal = i < bParts.size() ? bParts[i] : 0
if (aVal.getClass() != bVal.getClass()) {
aVal = aVal.toString()
bVal = bVal.toString()
}
if (aVal != bVal) return aVal <=> bVal
}
return 0
}.each { version, url ->
println " ${version.padRight(10)} -> ${url}"
}
println "-".multiply(80)
Expand Down
6 changes: 6 additions & 0 deletions build.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
bundle.name = postgresql
bundle.release = 2025.6.2
bundle.type = bins
bundle.format = 7z

#build.path = C:/Bearsampp-build
6 changes: 0 additions & 6 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
# Gradle Build Properties for Bearsampp Module PostgreSQL

# Bundle configuration
bundle.name = postgresql
bundle.release = 2025.3.8
bundle.type = bins
bundle.format = 7z

# Gradle daemon configuration
org.gradle.daemon=true
org.gradle.parallel=true
Expand Down
Loading