Repository navigation
ci: block publishing a PostgreSQL server below 18.7 (CVE-2026-6460) #18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| #!/usr/bin/env bash | ||
| # Fails if the image's PostgreSQL server predates the 18.7 security release | ||
| # (CVE-2026-6460 and the other fixes shipped with it). | ||
| # | ||
| # The base image is the floating `postgres:18-alpine` tag, so a rebuild picks up | ||
| # whatever minor that tag points at; this asserts against the *running* server, | ||
| # not the Dockerfile ARG. `composite_type_mismatch` is the server parameter the | ||
| # CVE-2026-6460 fix introduced, so its presence proves that fix is compiled in. | ||
| # | ||
| # Usage: verify-postgres-security.sh <container-name> | ||
| set -euo pipefail | ||
|
|
||
| container="${1:?usage: verify-postgres-security.sh <container>}" | ||
| psql() { docker exec -i "$container" psql -U postgres -X -q -At "$@"; } | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🟠 bug · high Set The 📋 Prompt for AI AgentsIn scripts/verify-postgres-security.sh line 14, change the wrapper to |
||
|
|
||
| # 18.7 — lowest minor carrying the 2026-11-12 security fixes. | ||
| PG_MIN_VERSION_NUM="${PG_MIN_VERSION_NUM:-180007}" | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🟠 bug · high Wrong The default floor 📋 Prompt for AI AgentsIn scripts/verify-postgres-security.sh line 17, change the default from 180007 to 180700. PostgreSQL encodes minor releases in the hundreds digit of server_version_num (18.7 = 1810000 + 7100 = 180700), so 180007 actually means 18.0.7 and the current gate passes vulnerable 18.1–18.6 servers. Keep the env-overridable form. |
||
|
|
||
| fail() { echo "FAIL: $*" >&2; exit 1; } | ||
| ok() { echo "ok: $*"; } | ||
|
|
||
| version_num="$(psql -c 'SHOW server_version_num')" | ||
| [ "$version_num" -ge "$PG_MIN_VERSION_NUM" ] \ | ||
| || fail "server_version_num $version_num is below the patched floor $PG_MIN_VERSION_NUM" | ||
| ok "postgres $(psql -c 'SHOW server_version') >= $PG_MIN_VERSION_NUM" | ||
|
|
||
| mismatch="$(psql -c 'SHOW composite_type_mismatch' 2>&1)" \ | ||
| || fail "composite_type_mismatch is unknown — server lacks the CVE-2026-6460 fix" | ||
| [ "$mismatch" = "error" ] || fail "composite_type_mismatch is '$mismatch', expected 'error'" | ||
| ok "composite_type_mismatch = error (CVE-2026-6460 check active)" | ||
|
|
||
| # Every C extension must load against this server's ABI: an extension built | ||
| # against an older minor fails here with "undefined symbol". | ||
| for ext in vector postgis pg_textsearch pg_partman pg_stat_statements; do | ||
| psql -c "CREATE EXTENSION IF NOT EXISTS $ext" >/dev/null || fail "CREATE EXTENSION $ext failed" | ||
| done | ||
| ok "vector, postgis, pg_textsearch, pg_partman, pg_stat_statements load" | ||
|
|
||
| echo "PostgreSQL security verification passed" | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🟡 bug · medium
Add timeout to the
pg_isreadywait loopsThe
until docker exec postgis-verify pg_isready -U postgres -q; do sleep 1; doneloops in both the PR and push gate steps have no timeout (.github/workflows/docker.yml:92). A container whose Postgres never becomes ready — bad entrypoint, crashed initdb — hangs the job until the 360-minute default job timeout. This wastes runner minutes and delays the real signal that the gate failed; the same unbounded loop appears at line 117.📋 Prompt for AI Agents
In .github/workflows/docker.yml, in the 'Verify PostGIS security (PR, amd64)' step (around line 92) and the 'Verify PostGIS security (pushed digest)' step (around line 117), replace the unbounded
until docker exec postgis-verify pg_isready -U postgres -q; do sleep 1; doneloop with a bounded wait, e.g. a counter that exits 1 after 300 seconds and printsdocker logs postgis-verify. This prevents a 6-hour CI hang when the container fails to start.