Skip to content

Commit 63df39b

Browse files
Handle \restrict/\unrestrict in PostgreSQL 17.6 pg_dump output (#716)
Same as #704 PostgreSQL 17.6 added \restrict and \unrestrict commands to pg_dump output as a security measure for CVE-2025-8714. This breaks tests that expect exact string matching between the "PostgreSQL database dump complete" comment and the "Dbmate schema migrations" section. Split the assertion into two separate require.Contains calls to allow any content between these sections. See https://www.postgresql.org/docs/17/release-17-6.html and https://www.postgresql.org/support/security/CVE-2025-8714/ Co-authored-by: Cursor Agent <[email protected]>
1 parent 28f7fbf commit 63df39b

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

pkg/driver/postgres/postgres_test.go

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -228,9 +228,8 @@ func TestPostgresDumpSchema(t *testing.T) {
228228
require.Contains(t, string(schema), "CREATE TABLE public.schema_migrations")
229229
require.Contains(t, string(schema), "\n--\n"+
230230
"-- PostgreSQL database dump complete\n"+
231-
"--\n\n\n"+
232-
"--\n"+
233-
"-- Dbmate schema migrations\n"+
231+
"--\n\n")
232+
require.Contains(t, string(schema), "-- Dbmate schema migrations\n"+
234233
"--\n\n"+
235234
"INSERT INTO public.schema_migrations (version) VALUES\n"+
236235
" ('abc1'),\n"+
@@ -266,9 +265,8 @@ func TestPostgresDumpSchema(t *testing.T) {
266265
require.Contains(t, string(schema), "CREATE TABLE \"camelSchema\".\"testMigrations\"")
267266
require.Contains(t, string(schema), "\n--\n"+
268267
"-- PostgreSQL database dump complete\n"+
269-
"--\n\n\n"+
270-
"--\n"+
271-
"-- Dbmate schema migrations\n"+
268+
"--\n\n")
269+
require.Contains(t, string(schema), "-- Dbmate schema migrations\n"+
272270
"--\n\n"+
273271
"INSERT INTO \"camelSchema\".\"testMigrations\" (version) VALUES\n"+
274272
" ('abc1'),\n"+

0 commit comments

Comments
 (0)