Repository navigation
fix(pgvector): bump 0.8.2 -> 0.8.7 (CVE-2026-103484) and block publishing an older build #19
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
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| #!/usr/bin/env bash | ||
| # Fails if the image ships a pgvector build that is vulnerable to | ||
| # CVE-2026-103484 (out-of-bounds write during an IVFFlat index build, | ||
| # https://github.com/pgvector/pgvector/issues/1036 — affected <= 0.8.6, | ||
| # fixed in 0.8.7). | ||
| # | ||
| # Asserted against the *installed* extension and the *loaded* library, never | ||
| # against a Dockerfile ARG or a tag. The extension version is only SQL | ||
| # metadata, so the library is checked too: 0.8.7 is the first release whose | ||
| # vector.so exports `sparsevec_vector_dims`, added by the same commit as the | ||
| # fix (ee00d39), and binding a C function to that symbol fails on any older | ||
| # build. Nothing here builds an index or writes out of bounds. | ||
| # | ||
| # Usage: verify-pgvector-security.sh <container-name> | ||
| set -euo pipefail | ||
|
|
||
| container="${1:?usage: verify-pgvector-security.sh <container>}" | ||
| psql() { docker exec -i "$container" psql -U postgres -X -q -At -v ON_ERROR_STOP=1 "$@"; } | ||
|
|
||
| PGVECTOR_MIN_VERSION="${PGVECTOR_MIN_VERSION:-0.8.7}" | ||
|
|
||
| fail() { echo "FAIL: $*" >&2; exit 1; } | ||
| ok() { echo "ok: $*"; } | ||
|
|
||
| below_floor() { | ||
| [ "$(printf '%s\n%s\n' "$PGVECTOR_MIN_VERSION" "$1" | sort -V | head -1)" != "$PGVECTOR_MIN_VERSION" ] | ||
| } | ||
|
|
||
| # 1. the version the image installs by default | ||
| available="$(psql -c "SELECT default_version FROM pg_available_extensions WHERE name = 'vector'")" | ||
| [ -n "$available" ] || fail "pgvector is not available in this image" | ||
| if below_floor "$available"; then | ||
| fail "pgvector default_version $available is below the patched floor $PGVECTOR_MIN_VERSION" | ||
| fi | ||
|
|
||
| # 2. the version a database actually gets | ||
| psql -c 'CREATE EXTENSION IF NOT EXISTS vector' >/dev/null | ||
| installed="$(psql -c "SELECT extversion FROM pg_extension WHERE extname = 'vector'")" | ||
| if below_floor "$installed"; then | ||
| fail "pgvector extension $installed is below the patched floor $PGVECTOR_MIN_VERSION" | ||
| fi | ||
| ok "pgvector $installed >= $PGVECTOR_MIN_VERSION" | ||
|
|
||
| # 3. the library itself carries the fix commit | ||
| psql >/dev/null 2>&1 <<'SQL' || fail "vector.so does not export sparsevec_vector_dims — library predates the CVE-2026-103484 fix" | ||
| BEGIN; | ||
| CREATE FUNCTION pg_temp.pgvector_fix_probe(sparsevec) RETURNS integer | ||
| AS '$libdir/vector', 'sparsevec_vector_dims' LANGUAGE C IMMUTABLE STRICT; | ||
| ROLLBACK; | ||
| SQL | ||
| ok "vector.so exports sparsevec_vector_dims (CVE-2026-103484 fix compiled in)" | ||
|
|
||
| echo "pgvector security verification passed" | ||
Oops, something went wrong.
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.
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.
🟡 security · medium
Symbol probe is never called, so step 3 cannot fail
The CVE-2026-103484 probe in
scripts/verify-pgvector-security.sh:45-50only runsCREATE FUNCTION pg_temp.pgvector_fix_probe(sparsevec) ... AS '$libdir/vector', 'sparsevec_vector_dims'and immediately rolls back. PostgreSQL resolves the C symbol lazily at first call, so a pre-fixvector.sostill passes this step and the "fix compiled in" assertion is vacuous; only the SQL version checks in steps 1-2 are actually enforced.📋 Prompt for AI Agents
In scripts/verify-pgvector-security.sh around lines 45-50, the heredoc creates the probe function but never calls it, so PostgreSQL never resolves the 'sparsevec_vector_dims' symbol and the CVE fix assertion always passes. Insert
SELECT pg_temp.pgvector_fix_probe(sparsevec '1:1'::sparsevec);(any valid sparsevec literal) after the CREATE FUNCTION and keep the ROLLBACK after the SELECT.