Skip to content

Security Migration to pgx/v5 and Go 1.26.1#4351

Open
noxymon wants to merge 1 commit intosqlc-dev:mainfrom
noxymon:security/migrate-pgx-v5
Open

Security Migration to pgx/v5 and Go 1.26.1#4351
noxymon wants to merge 1 commit intosqlc-dev:mainfrom
noxymon:security/migrate-pgx-v5

Conversation

@noxymon
Copy link

@noxymon noxymon commented Mar 22, 2026

Context

A security audit using govulncheck identified several critical vulnerabilities:

  1. GO-2026-4518: Denial of Service in github.com/jackc/pgproto3/v2 (used by pgx/v4).
  2. Standard Library Vulnerabilities: Multiple vulnerabilities affecting Go 1.26.0 (GO-2026-4603, GO-2026-4602, GO-2026-4601, GO-2026-4600, GO-2026-4599).

Fix Proposal

This PR migrates the remaining internal tools and test helpers from pgx/v4 to pgx/v5 v5.9.0 and updates the Go runtime to 1.26.1 to resolve all reported vulnerabilities.

Technical Implementation:

  1. Vulnerability Fix (GO-2026-4518):
    • Migrated internal/tools/sqlc-pg-gen/main.go, proc.go, and relation.go to github.com/jackc/pgx/v5.
    • Migrated internal/sqltest/pgx.go to github.com/jackc/pgx/v5.
    • This effectively removes the dependency on the vulnerable and end-of-life github.com/jackc/pgproto3/v2.
  2. Standard Library Security Patches:
    • Updated go.mod to go 1.26.1.
  3. Dependency Cleanup:
    • Executed go mod tidy to prune pgx/v4 and its indirect dependencies from the module graph.

Verification Results

  • Vulnerability Scan: govulncheck ./... returns "No vulnerabilities found."
  • Tool Integrity: internal/tools/sqlc-pg-gen compiles and functions correctly with the new driver.
  • Test Suite: Verified that PostgreSQL tests using pgx still pass.

@dosubot dosubot bot added the size:S This PR changes 10-29 lines, ignoring generated files. label Mar 22, 2026
@noxymon noxymon force-pushed the security/migrate-pgx-v5 branch from 9d8dd94 to 4d80ca4 Compare March 22, 2026 01:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:S This PR changes 10-29 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant