Compare commits
No commits in common. "c10s" and "c8" have entirely different histories.
@ -1 +0,0 @@
|
||||
1
|
||||
26
.gitignore
vendored
26
.gitignore
vendored
@ -1,25 +1 @@
|
||||
/pgjdbc-REL*.tar.gz
|
||||
/pgjdbc-parent-poms-REL*.tar.gz
|
||||
/pgjdbc-v42.3.0-rc2.tar.gz
|
||||
/postgresql-42.2.15-jdbc-src.tar.gz
|
||||
/postgresql-42.2.16-jdbc-src.tar.gz
|
||||
/postgresql-42.2.18-jdbc-src.tar.gz
|
||||
/postgresql-42.2.19-jdbc-src.tar.gz
|
||||
/postgresql-42.2.23-jdbc-src.tar.gz
|
||||
/postgresql-42.2.24-jdbc-src.tar.gz
|
||||
/postgresql-42.3.0-jdbc-src.tar.gz
|
||||
/postgresql-42.3.1-jdbc-src.tar.gz
|
||||
/postgresql-42.3.2-jdbc-src.tar.gz
|
||||
/postgresql-42.3.3-jdbc-src.tar.gz
|
||||
/postgresql-42.3.4-jdbc-src.tar.gz
|
||||
/postgresql-42.3.5-jdbc-src.tar.gz
|
||||
/postgresql-42.3.6-jdbc-src.tar.gz
|
||||
/postgresql-42.4.0-jdbc-src.tar.gz
|
||||
/postgresql-42.4.1-jdbc-src.tar.gz
|
||||
/postgresql-42.5.0-jdbc-src.tar.gz
|
||||
/postgresql-42.5.1-jdbc-src.tar.gz
|
||||
/postgresql-42.5.2-jdbc-src.tar.gz
|
||||
/postgresql-42.6.0-jdbc-src.tar.gz
|
||||
/postgresql-42.7.0-jdbc-src.tar.gz
|
||||
/postgresql-42.7.1-jdbc-src.tar.gz
|
||||
/postgresql-42.7.2-jdbc-src.tar.gz
|
||||
SOURCES/postgresql-42.2.14-src.tar.gz
|
||||
|
||||
1
.postgresql-jdbc.metadata
Normal file
1
.postgresql-jdbc.metadata
Normal file
@ -0,0 +1 @@
|
||||
ad31bb1acc9d87a02e4ac72e0501c7accb144d7a SOURCES/postgresql-42.2.14-src.tar.gz
|
||||
@ -1,136 +0,0 @@
|
||||
From e0cf9bfeac832b8f99d52a4030980be8e379b765 Mon Sep 17 00:00:00 2001
|
||||
From: Marian Koncek <mkoncek@redhat.com>
|
||||
Date: Wed, 20 May 2026 13:24:31 +0200
|
||||
Subject: [PATCH] Add tests for CVE-2026-42198
|
||||
|
||||
---
|
||||
.../java/org/postgresql/jdbc/ScramTest.java | 90 +++++++++++++++++++
|
||||
1 file changed, 90 insertions(+)
|
||||
|
||||
diff --git a/src/test/java/org/postgresql/jdbc/ScramTest.java b/src/test/java/org/postgresql/jdbc/ScramTest.java
|
||||
index c67b778..77880af 100644
|
||||
--- a/src/test/java/org/postgresql/jdbc/ScramTest.java
|
||||
+++ b/src/test/java/org/postgresql/jdbc/ScramTest.java
|
||||
@@ -15,10 +15,12 @@ import static org.junit.jupiter.api.Assumptions.assumeTrue;
|
||||
import org.postgresql.PGProperty;
|
||||
import org.postgresql.core.ServerVersion;
|
||||
import org.postgresql.test.TestUtil;
|
||||
+import org.postgresql.util.PSQLException;
|
||||
import org.postgresql.util.PSQLState;
|
||||
|
||||
import org.junit.jupiter.api.AfterAll;
|
||||
import org.junit.jupiter.api.BeforeAll;
|
||||
+import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.params.ParameterizedTest;
|
||||
import org.junit.jupiter.params.provider.Arguments;
|
||||
import org.junit.jupiter.params.provider.MethodSource;
|
||||
@@ -29,6 +31,7 @@ import java.sql.DriverManager;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Statement;
|
||||
+import java.text.NumberFormat;
|
||||
import java.util.Properties;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
@@ -125,6 +128,79 @@ class ScramTest {
|
||||
}
|
||||
}
|
||||
|
||||
+ private PSQLException scramAuthExpectingFailure(String scramMaxIterations, int serverScramIterations, String password) throws SQLException {
|
||||
+ createRoleWithCustomScramIters(serverScramIterations);
|
||||
+ Properties props = new Properties();
|
||||
+ PGProperty.USER.set(props, ROLE_NAME);
|
||||
+ PGProperty.PASSWORD.set(props, password);
|
||||
+ if (scramMaxIterations != null) {
|
||||
+ PGProperty.SCRAM_MAX_ITERATIONS.set(props, scramMaxIterations);
|
||||
+ }
|
||||
+ return assertThrows(PSQLException.class, () -> TestUtil.openDB(props));
|
||||
+ }
|
||||
+
|
||||
+ @Test
|
||||
+ void rejectIterationCountAboveDefaultCap() throws SQLException {
|
||||
+ int serverScramIterations = 789_123_456;
|
||||
+ PSQLException ex = scramAuthExpectingFailure(null, serverScramIterations, "does-not-matter");
|
||||
+ assertTrue(ex.getMessage().contains("exceeds"),
|
||||
+ "expected iteration-cap error, got: " + ex.getMessage());
|
||||
+ assertTrue(ex.getMessage().contains("scramMaxIterations"),
|
||||
+ "error should reference the connection property name, got: " + ex.getMessage());
|
||||
+ // The message is formatted through MessageFormat, which applies locale-aware grouping
|
||||
+ // to integer arguments; format the expected numbers the same way.
|
||||
+ NumberFormat nf = NumberFormat.getNumberInstance();
|
||||
+ assertTrue(ex.getMessage().contains(nf.format(serverScramIterations)),
|
||||
+ "error should include the configured cap, got: " + ex.getMessage());
|
||||
+ }
|
||||
+
|
||||
+ @Test
|
||||
+ void rejectIterationCountAboveCustomCap() throws SQLException {
|
||||
+ int scramMaxIterations = 123_456;
|
||||
+ int serverScramIterations = 789_123_456;
|
||||
+ PSQLException ex = scramAuthExpectingFailure(Integer.toString(scramMaxIterations), serverScramIterations, "does-not-matter");
|
||||
+ // The message is formatted through MessageFormat, which applies locale-aware grouping
|
||||
+ // to integer arguments; format the expected numbers the same way.
|
||||
+ NumberFormat nf = NumberFormat.getNumberInstance();
|
||||
+ assertTrue(ex.getMessage().contains(nf.format(scramMaxIterations)),
|
||||
+ "error should include the configured cap, got: " + ex.getMessage());
|
||||
+ assertTrue(ex.getMessage().contains(nf.format(serverScramIterations)),
|
||||
+ "error should include the server-supplied iteration count, got: " + ex.getMessage());
|
||||
+ }
|
||||
+
|
||||
+ @Test
|
||||
+ void rejectValidCredentialsAboveCustomCap() throws SQLException {
|
||||
+ String password = "t0pSecret";
|
||||
+ createRole(password);
|
||||
+ Properties props = new Properties();
|
||||
+ PGProperty.USER.set(props, ROLE_NAME);
|
||||
+ PGProperty.PASSWORD.set(props, password);
|
||||
+ PGProperty.SCRAM_MAX_ITERATIONS.set(props, "1234");
|
||||
+ PSQLException ex = assertThrows(PSQLException.class, () -> TestUtil.openDB(props));
|
||||
+ // The message is formatted through MessageFormat, which applies locale-aware grouping
|
||||
+ // to integer arguments; format the expected numbers the same way.
|
||||
+ NumberFormat nf = NumberFormat.getNumberInstance();
|
||||
+ assertTrue(ex.getMessage().contains(nf.format(1234)),
|
||||
+ "error should include the configured cap, got: " + ex.getMessage());
|
||||
+ }
|
||||
+
|
||||
+ @Test
|
||||
+ void acceptsValidCredentialsBelowCustomCap() throws SQLException {
|
||||
+ assumeTrue(TestUtil.haveMinimumServerVersion(con, ServerVersion.v16),
|
||||
+ "scram_iterations configuration requires PostgreSQL 16+");
|
||||
+ int serverScramIterations = Integer.parseInt(TestUtil.queryForString(con, "SHOW scram_iterations"));
|
||||
+ String password = "t0pSecret";
|
||||
+ createRole(password);
|
||||
+ Properties props = new Properties();
|
||||
+ PGProperty.USER.set(props, ROLE_NAME);
|
||||
+ PGProperty.PASSWORD.set(props, password);
|
||||
+ PGProperty.SCRAM_MAX_ITERATIONS.set(props, Integer.toString(serverScramIterations));
|
||||
+ try (Connection conn = TestUtil.openDB(props)) {
|
||||
+ String username = TestUtil.queryForString(conn, "SELECT USER");
|
||||
+ assertEquals(ROLE_NAME, username);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
private void createRole(String passwd) throws SQLException {
|
||||
try (Statement stmt = con.createStatement()) {
|
||||
stmt.execute("SET password_encryption='scram-sha-256'");
|
||||
@@ -133,4 +209,18 @@ class ScramTest {
|
||||
}
|
||||
}
|
||||
|
||||
+ private static void createRoleWithCustomScramIters(int iters) throws SQLException {
|
||||
+ TestUtil.execute(con, "DROP ROLE IF EXISTS " + ROLE_NAME);
|
||||
+ TestUtil.execute(con, "CREATE ROLE " + ROLE_NAME + " WITH LOGIN");
|
||||
+ // SCRAM-SHA-256$<iter>:<salt-base64>$<StoredKey-base64>:<ServerKey-base64>
|
||||
+ // salt: 16 zero bytes, StoredKey and ServerKey: 32 zero bytes each.
|
||||
+ String encodedPassword = "SCRAM-SHA-256$" + iters
|
||||
+ + ":AAAAAAAAAAAAAAAAAAAAAA=="
|
||||
+ + "$AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="
|
||||
+ + ":AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=";
|
||||
+ // NOTE: We must directly update the system catalog to prevent the server from trying to
|
||||
+ // verify the password at creation time. Otherwise it will try to hash empty string with
|
||||
+ // our huge number of iterations to ensure the password is not an empty string.
|
||||
+ TestUtil.execute(con, "UPDATE pg_authid SET rolpassword = '" + encodedPassword + "' WHERE rolname = '" + ROLE_NAME + "'");
|
||||
+ }
|
||||
}
|
||||
--
|
||||
2.54.0
|
||||
|
||||
259
SOURCES/CVE-2026-42198-tests.patch
Normal file
259
SOURCES/CVE-2026-42198-tests.patch
Normal file
@ -0,0 +1,259 @@
|
||||
From cda68fb74340f5b661b0014a99c24758b6c7f20b Mon Sep 17 00:00:00 2001
|
||||
From: Marian Koncek <mkoncek@redhat.com>
|
||||
Date: Mon, 8 Jun 2026 14:51:26 +0200
|
||||
Subject: [PATCH 2/2] Add tests for CVE-2026-42198
|
||||
|
||||
Co-authored-by: Cursor <cursoragent@cursor.com>
|
||||
---
|
||||
.../org/postgresql/core/ServerVersion.java | 6 +-
|
||||
.../java/org/postgresql/jdbc/ScramTest.java | 196 ++++++++++++++++++
|
||||
.../java/org/postgresql/test/TestUtil.java | 15 ++
|
||||
3 files changed, 216 insertions(+), 1 deletion(-)
|
||||
create mode 100644 src/test/java/org/postgresql/jdbc/ScramTest.java
|
||||
|
||||
diff --git a/src/main/java/org/postgresql/core/ServerVersion.java b/src/main/java/org/postgresql/core/ServerVersion.java
|
||||
index 9348ba1..e3c9bd7 100644
|
||||
--- a/src/main/java/org/postgresql/core/ServerVersion.java
|
||||
+++ b/src/main/java/org/postgresql/core/ServerVersion.java
|
||||
@@ -26,7 +26,11 @@ public enum ServerVersion implements Version {
|
||||
v9_6("9.6.0"),
|
||||
v10("10"),
|
||||
v11("11"),
|
||||
- v12("12")
|
||||
+ v12("12"),
|
||||
+ v13("13"),
|
||||
+ v14("14"),
|
||||
+ v15("15"),
|
||||
+ v16("16")
|
||||
;
|
||||
|
||||
private final int version;
|
||||
diff --git a/src/test/java/org/postgresql/jdbc/ScramTest.java b/src/test/java/org/postgresql/jdbc/ScramTest.java
|
||||
new file mode 100644
|
||||
index 0000000..60bc75a
|
||||
--- /dev/null
|
||||
+++ b/src/test/java/org/postgresql/jdbc/ScramTest.java
|
||||
@@ -0,0 +1,196 @@
|
||||
+/*
|
||||
+ * Copyright (c) 2021, PostgreSQL Global Development Group
|
||||
+ * See the LICENSE file in the project root for more information.
|
||||
+ */
|
||||
+
|
||||
+package org.postgresql.jdbc;
|
||||
+
|
||||
+import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
|
||||
+import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
+import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||
+import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
+import static org.junit.jupiter.api.Assumptions.assumeTrue;
|
||||
+
|
||||
+import org.postgresql.PGProperty;
|
||||
+import org.postgresql.core.ServerVersion;
|
||||
+import org.postgresql.test.TestUtil;
|
||||
+import org.postgresql.util.PSQLException;
|
||||
+import org.postgresql.util.PSQLState;
|
||||
+
|
||||
+import org.junit.jupiter.api.AfterAll;
|
||||
+import org.junit.jupiter.api.BeforeAll;
|
||||
+import org.junit.jupiter.api.Test;
|
||||
+import org.junit.jupiter.params.ParameterizedTest;
|
||||
+import org.junit.jupiter.params.provider.ValueSource;
|
||||
+
|
||||
+import java.sql.Connection;
|
||||
+import java.sql.ResultSet;
|
||||
+import java.sql.SQLException;
|
||||
+import java.sql.Statement;
|
||||
+import java.text.NumberFormat;
|
||||
+import java.util.Properties;
|
||||
+
|
||||
+class ScramTest {
|
||||
+
|
||||
+ private static Connection con;
|
||||
+ private static final String ROLE_NAME = "testscram";
|
||||
+
|
||||
+ @BeforeAll
|
||||
+ public static void setUp() throws Exception {
|
||||
+ con = TestUtil.openPrivilegedDB();
|
||||
+ assumeTrue(TestUtil.haveMinimumServerVersion(con, ServerVersion.v10));
|
||||
+ }
|
||||
+
|
||||
+ @AfterAll
|
||||
+ public static void tearDown() throws Exception {
|
||||
+ try (Statement stmt = con.createStatement()) {
|
||||
+ stmt.execute("DROP ROLE IF EXISTS " + ROLE_NAME);
|
||||
+ }
|
||||
+ TestUtil.closeDB(con);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Test creating a role with passwords WITH spaces and opening a connection using the same
|
||||
+ * password, should work because is the "same" password.
|
||||
+ *
|
||||
+ * <p>https://github.com/pgjdbc/pgjdbc/issues/1970
|
||||
+ */
|
||||
+ @ParameterizedTest
|
||||
+ @ValueSource(strings = {"My Space", "$ec ret", " rover june spelling ",
|
||||
+ "!zj5hs*k5 STj@DaRUy", "q\u00A0w\u2000e\u2003r\u2009t\u3000y"})
|
||||
+ void testPasswordWithSpace(String passwd) throws SQLException {
|
||||
+ createRole(passwd); // Create role password with spaces.
|
||||
+
|
||||
+ Properties props = new Properties();
|
||||
+ props.setProperty("username", ROLE_NAME);
|
||||
+ props.setProperty("password", passwd);
|
||||
+
|
||||
+ try (Connection c = assertDoesNotThrow(() -> TestUtil.openDB(props));
|
||||
+ Statement stmt = c.createStatement();
|
||||
+ ResultSet rs = stmt.executeQuery("SELECT current_user")) {
|
||||
+ assertTrue(rs.next());
|
||||
+ assertEquals(ROLE_NAME, rs.getString(1));
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Test creating a role with passwords WITHOUT spaces and opening a connection using password with
|
||||
+ * spaces should fail since the spaces should not be stripped out.
|
||||
+ *
|
||||
+ * <p>https://github.com/pgjdbc/pgjdbc/issues/2000
|
||||
+ */
|
||||
+ @ParameterizedTest
|
||||
+ @ValueSource(strings = {"My Space", "$ec ret", "rover june spelling",
|
||||
+ "!zj5hs*k5 STj@DaRUy", "q\u00A0w\u2000e\u2003r\u2009t\u3000y"})
|
||||
+ void testPasswordWithoutSpace(String passwd) throws SQLException {
|
||||
+ String passwdNoSpaces = passwd.codePoints()
|
||||
+ .filter(i -> !Character.isSpaceChar(i))
|
||||
+ .collect(StringBuilder::new, StringBuilder::appendCodePoint, StringBuilder::append)
|
||||
+ .toString();
|
||||
+
|
||||
+ createRole(passwdNoSpaces); // Create role password without spaces.
|
||||
+
|
||||
+ Properties props = new Properties();
|
||||
+ props.setProperty("username", ROLE_NAME);
|
||||
+ props.setProperty("password", passwd); // Open connection with spaces
|
||||
+
|
||||
+ SQLException ex = assertThrows(SQLException.class, () -> TestUtil.openDB(props));
|
||||
+ assertEquals(PSQLState.INVALID_PASSWORD.getState(), ex.getSQLState());
|
||||
+ }
|
||||
+
|
||||
+ private PSQLException scramAuthExpectingFailure(String scramMaxIterations, int serverScramIterations, String password) throws SQLException {
|
||||
+ createRoleWithCustomScramIters(serverScramIterations);
|
||||
+ Properties props = new Properties();
|
||||
+ props.setProperty("username", ROLE_NAME);
|
||||
+ props.setProperty("password", password);
|
||||
+ if (scramMaxIterations != null) {
|
||||
+ PGProperty.SCRAM_MAX_ITERATIONS.set(props, scramMaxIterations);
|
||||
+ }
|
||||
+ return assertThrows(PSQLException.class, () -> TestUtil.openDB(props));
|
||||
+ }
|
||||
+
|
||||
+ @Test
|
||||
+ void rejectIterationCountAboveDefaultCap() throws SQLException {
|
||||
+ int serverScramIterations = 789_123_456;
|
||||
+ PSQLException ex = scramAuthExpectingFailure(null, serverScramIterations, "does-not-matter");
|
||||
+ assertTrue(ex.getMessage().contains("exceeds"),
|
||||
+ "expected iteration-cap error, got: " + ex.getMessage());
|
||||
+ assertTrue(ex.getMessage().contains("scramMaxIterations"),
|
||||
+ "error should reference the connection property name, got: " + ex.getMessage());
|
||||
+ // The message is formatted through MessageFormat, which applies locale-aware grouping
|
||||
+ // to integer arguments; format the expected numbers the same way.
|
||||
+ NumberFormat nf = NumberFormat.getNumberInstance();
|
||||
+ assertTrue(ex.getMessage().contains(nf.format(serverScramIterations)),
|
||||
+ "error should include the configured cap, got: " + ex.getMessage());
|
||||
+ }
|
||||
+
|
||||
+ @Test
|
||||
+ void rejectIterationCountAboveCustomCap() throws SQLException {
|
||||
+ int scramMaxIterations = 123_456;
|
||||
+ int serverScramIterations = 789_123_456;
|
||||
+ PSQLException ex = scramAuthExpectingFailure(Integer.toString(scramMaxIterations), serverScramIterations, "does-not-matter");
|
||||
+ // The message is formatted through MessageFormat, which applies locale-aware grouping
|
||||
+ // to integer arguments; format the expected numbers the same way.
|
||||
+ NumberFormat nf = NumberFormat.getNumberInstance();
|
||||
+ assertTrue(ex.getMessage().contains(nf.format(scramMaxIterations)),
|
||||
+ "error should include the configured cap, got: " + ex.getMessage());
|
||||
+ assertTrue(ex.getMessage().contains(nf.format(serverScramIterations)),
|
||||
+ "error should include the server-supplied iteration count, got: " + ex.getMessage());
|
||||
+ }
|
||||
+
|
||||
+ @Test
|
||||
+ void rejectValidCredentialsAboveCustomCap() throws SQLException {
|
||||
+ String password = "t0pSecret";
|
||||
+ createRole(password);
|
||||
+ Properties props = new Properties();
|
||||
+ props.setProperty("username", ROLE_NAME);
|
||||
+ props.setProperty("password", password);
|
||||
+ PGProperty.SCRAM_MAX_ITERATIONS.set(props, "1234");
|
||||
+ PSQLException ex = assertThrows(PSQLException.class, () -> TestUtil.openDB(props));
|
||||
+ // The message is formatted through MessageFormat, which applies locale-aware grouping
|
||||
+ // to integer arguments; format the expected numbers the same way.
|
||||
+ NumberFormat nf = NumberFormat.getNumberInstance();
|
||||
+ assertTrue(ex.getMessage().contains(nf.format(1234)),
|
||||
+ "error should include the configured cap, got: " + ex.getMessage());
|
||||
+ }
|
||||
+
|
||||
+ @Test
|
||||
+ void acceptsValidCredentialsBelowCustomCap() throws SQLException {
|
||||
+ assumeTrue(TestUtil.haveMinimumServerVersion(con, ServerVersion.v16),
|
||||
+ "scram_iterations configuration requires PostgreSQL 16+");
|
||||
+ int serverScramIterations = Integer.parseInt(TestUtil.queryForString(con, "SHOW scram_iterations"));
|
||||
+ String password = "t0pSecret";
|
||||
+ createRole(password);
|
||||
+ Properties props = new Properties();
|
||||
+ props.setProperty("username", ROLE_NAME);
|
||||
+ props.setProperty("password", password);
|
||||
+ PGProperty.SCRAM_MAX_ITERATIONS.set(props, Integer.toString(serverScramIterations));
|
||||
+ try (Connection conn = TestUtil.openDB(props)) {
|
||||
+ String username = TestUtil.queryForString(conn, "SELECT USER");
|
||||
+ assertEquals(ROLE_NAME, username);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ private void createRole(String passwd) throws SQLException {
|
||||
+ try (Statement stmt = con.createStatement()) {
|
||||
+ stmt.execute("SET password_encryption='scram-sha-256'");
|
||||
+ stmt.execute("DROP ROLE IF EXISTS " + ROLE_NAME);
|
||||
+ stmt.execute("CREATE ROLE " + ROLE_NAME + " WITH LOGIN PASSWORD '" + passwd + "'");
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ private static void createRoleWithCustomScramIters(int iters) throws SQLException {
|
||||
+ TestUtil.execute("DROP ROLE IF EXISTS " + ROLE_NAME, con);
|
||||
+ TestUtil.execute("CREATE ROLE " + ROLE_NAME + " WITH LOGIN", con);
|
||||
+ // SCRAM-SHA-256$<iter>:<salt-base64>$<StoredKey-base64>:<ServerKey-base64>
|
||||
+ // salt: 16 zero bytes, StoredKey and ServerKey: 32 zero bytes each.
|
||||
+ String encodedPassword = "SCRAM-SHA-256$" + iters
|
||||
+ + ":AAAAAAAAAAAAAAAAAAAAAA=="
|
||||
+ + "$AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="
|
||||
+ + ":AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=";
|
||||
+ // NOTE: We must directly update the system catalog to prevent the server from trying to
|
||||
+ // verify the password at creation time. Otherwise it will try to hash empty string with
|
||||
+ // our huge number of iterations to ensure the password is not an empty string.
|
||||
+ TestUtil.execute("UPDATE pg_authid SET rolpassword = '" + encodedPassword + "' WHERE rolname = '" + ROLE_NAME + "'", con);
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/test/java/org/postgresql/test/TestUtil.java b/src/test/java/org/postgresql/test/TestUtil.java
|
||||
index 0ce472c..a7fe975 100644
|
||||
--- a/src/test/java/org/postgresql/test/TestUtil.java
|
||||
+++ b/src/test/java/org/postgresql/test/TestUtil.java
|
||||
@@ -1020,4 +1020,19 @@ public class TestUtil {
|
||||
}
|
||||
}
|
||||
}
|
||||
+
|
||||
+ /**
|
||||
+ * Execute a SQL query with a given connection, fetch the first row, and return its
|
||||
+ * string value.
|
||||
+ */
|
||||
+ public static String queryForString(Connection conn, String sql) throws SQLException {
|
||||
+ Statement stmt = conn.createStatement();
|
||||
+ ResultSet rs = stmt.executeQuery(sql);
|
||||
+ Assert.assertTrue("Query should have returned exactly one row but none was found: " + sql, rs.next());
|
||||
+ String value = rs.getString(1);
|
||||
+ Assert.assertFalse("Query should have returned exactly one row but more than one found: " + sql, rs.next());
|
||||
+ rs.close();
|
||||
+ stmt.close();
|
||||
+ return value;
|
||||
+ }
|
||||
}
|
||||
--
|
||||
2.54.0
|
||||
|
||||
@ -1,7 +1,8 @@
|
||||
From e2f3f886e23e76410a696ad13594387a55c6281c Mon Sep 17 00:00:00 2001
|
||||
From: Sehrope Sarkuni <sehrope@jackdb.com>
|
||||
Date: Sat, 18 Apr 2026 08:20:17 -0400
|
||||
Subject: [PATCH] fix: Limit SCRAM PBKDF2 iterations accepted from the server
|
||||
From 2f69e69103319fd336bf63194a2ebc0e602dc481 Mon Sep 17 00:00:00 2001
|
||||
From: Marian Koncek <mkoncek@redhat.com>
|
||||
Date: Mon, 8 Jun 2026 14:50:02 +0200
|
||||
Subject: [PATCH 1/2] fix: Limit SCRAM PBKDF2 iterations accepted from the
|
||||
server
|
||||
|
||||
A malicious or compromised PostgreSQL server can advertise an
|
||||
arbitrarily large PBKDF2 iteration count in its SCRAM
|
||||
@ -10,7 +11,7 @@ clientFinalMessage() before authentication can possibly fail. Combined
|
||||
with an abandoned connect-thread on loginTimeout expiry, that CPU
|
||||
continues spinning after the caller has given up.
|
||||
|
||||
We add a new `scramMaxIterations` connection property (default 100000)
|
||||
We add a new scramMaxIterations connection property (default 100000)
|
||||
and validate the iteration count from ServerFirstMessage against it
|
||||
after parsing but before the PBKDF2-heavy clientFinalMessage() step.
|
||||
Exceeding the cap throws a PSQLException with CONNECTION_REJECTED and
|
||||
@ -18,20 +19,22 @@ an error message naming the property so operators can raise it for
|
||||
trusted servers that legitimately use a higher count.
|
||||
|
||||
Fixes CVE-2026-42198
|
||||
|
||||
Co-authored-by: Cursor <cursoragent@cursor.com>
|
||||
---
|
||||
.../src/main/java/org/postgresql/PGProperty.java | 14 ++++++++++++++
|
||||
src/main/java/org/postgresql/PGProperty.java | 14 ++++++++++++++
|
||||
.../core/v3/ConnectionFactoryImpl.java | 9 ++++++++-
|
||||
.../org/postgresql/ds/common/BaseDataSource.java | 16 ++++++++++++++++
|
||||
.../postgresql/jre7/sasl/ScramAuthenticator.java | 15 ++++++++++++++-
|
||||
4 files changed, 52 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/src/main/java/org/postgresql/PGProperty.java b/src/main/java/org/postgresql/PGProperty.java
|
||||
index da11f66d..7f7b6e00 100644
|
||||
index f94b387..712ece6 100644
|
||||
--- a/src/main/java/org/postgresql/PGProperty.java
|
||||
+++ b/src/main/java/org/postgresql/PGProperty.java
|
||||
@@ -554,6 +554,20 @@ public enum PGProperty {
|
||||
"false",
|
||||
"Enable optimization to rewrite and collapse compatible INSERT statements that are batched."),
|
||||
@@ -470,6 +470,20 @@ public enum PGProperty {
|
||||
"false",
|
||||
"Enable optimization to rewrite and collapse compatible INSERT statements that are batched."),
|
||||
|
||||
+ /**
|
||||
+ * Maximum number of PBKDF2 iterations the client will accept from the server during SCRAM
|
||||
@ -51,10 +54,10 @@ index da11f66d..7f7b6e00 100644
|
||||
* Socket write buffer size (SO_SNDBUF). A value of {@code -1}, which is the default, means system
|
||||
* default.
|
||||
diff --git a/src/main/java/org/postgresql/core/v3/ConnectionFactoryImpl.java b/src/main/java/org/postgresql/core/v3/ConnectionFactoryImpl.java
|
||||
index bc0af8e4..9fbe7eba 100644
|
||||
index 9737a82..a21c0b1 100644
|
||||
--- a/src/main/java/org/postgresql/core/v3/ConnectionFactoryImpl.java
|
||||
+++ b/src/main/java/org/postgresql/core/v3/ConnectionFactoryImpl.java
|
||||
@@ -836,6 +836,13 @@ public class ConnectionFactoryImpl extends ConnectionFactory {
|
||||
@@ -666,9 +666,16 @@ public class ConnectionFactoryImpl extends ConnectionFactory {
|
||||
|
||||
case AUTH_REQ_SASL:
|
||||
LOGGER.log(Level.FINEST, " <=BE AuthenticationSASL");
|
||||
@ -66,22 +69,17 @@ index bc0af8e4..9fbe7eba 100644
|
||||
+ PSQLState.INVALID_PARAMETER_VALUE);
|
||||
+ }
|
||||
|
||||
scramAuthenticator = AuthenticationPluginManager.withPassword(AuthenticationRequestType.SASL, info, password -> {
|
||||
if (password == null) {
|
||||
@@ -850,7 +857,7 @@ public class ConnectionFactoryImpl extends ConnectionFactory {
|
||||
"The server requested SCRAM-based authentication, but the password is an empty string."),
|
||||
PSQLState.CONNECTION_REJECTED);
|
||||
}
|
||||
- return new ScramAuthenticator(user, String.valueOf(password), pgStream);
|
||||
+ return new ScramAuthenticator(user, String.valueOf(password), pgStream, scramMaxIterations);
|
||||
});
|
||||
//#if mvn.project.property.postgresql.jdbc.spec >= "JDBC4.1"
|
||||
- scramAuthenticator = new org.postgresql.jre7.sasl.ScramAuthenticator(user, password, pgStream);
|
||||
+ scramAuthenticator = new org.postgresql.jre7.sasl.ScramAuthenticator(user, password, pgStream, scramMaxIterations);
|
||||
scramAuthenticator.processServerMechanismsAndInit();
|
||||
scramAuthenticator.sendScramClientFirstMessage();
|
||||
// This works as follows:
|
||||
diff --git a/src/main/java/org/postgresql/ds/common/BaseDataSource.java b/src/main/java/org/postgresql/ds/common/BaseDataSource.java
|
||||
index c3b606fa..6416bd97 100644
|
||||
index e4e2bb3..522d81c 100644
|
||||
--- a/src/main/java/org/postgresql/ds/common/BaseDataSource.java
|
||||
+++ b/src/main/java/org/postgresql/ds/common/BaseDataSource.java
|
||||
@@ -1325,6 +1325,22 @@ public abstract class BaseDataSource implements CommonDataSource, Referenceable
|
||||
@@ -1185,6 +1185,22 @@ public abstract class BaseDataSource implements CommonDataSource, Referenceable
|
||||
PGProperty.LOGGER_FILE.set(properties, loggerFile);
|
||||
}
|
||||
|
||||
@ -105,26 +103,26 @@ index c3b606fa..6416bd97 100644
|
||||
* Generates a {@link DriverManager} URL from the other properties supplied.
|
||||
*
|
||||
diff --git a/src/main/java/org/postgresql/jre7/sasl/ScramAuthenticator.java b/src/main/java/org/postgresql/jre7/sasl/ScramAuthenticator.java
|
||||
index ff96106a..05fc2d19 100644
|
||||
index 2d97387..ea78189 100644
|
||||
--- a/src/main/java/org/postgresql/jre7/sasl/ScramAuthenticator.java
|
||||
+++ b/src/main/java/org/postgresql/jre7/sasl/ScramAuthenticator.java
|
||||
@@ -7,6 +7,7 @@ package org.postgresql.jre7.sasl;
|
||||
@@ -5,6 +5,7 @@
|
||||
|
||||
import static org.postgresql.util.internal.Nullness.castNonNull;
|
||||
package org.postgresql.jre7.sasl;
|
||||
|
||||
+import org.postgresql.PGProperty;
|
||||
import org.postgresql.core.PGStream;
|
||||
import org.postgresql.util.GT;
|
||||
import org.postgresql.util.PSQLException;
|
||||
@@ -34,6 +35,7 @@ public class ScramAuthenticator {
|
||||
@@ -31,6 +32,7 @@ public class ScramAuthenticator {
|
||||
private final String user;
|
||||
private final String password;
|
||||
private final PGStream pgStream;
|
||||
+ private final int maxIterations;
|
||||
private /* @Nullable */ ScramClient scramClient;
|
||||
private /* @Nullable */ ScramSession scramSession;
|
||||
private ScramSession./* @Nullable */ ClientFinalProcessor clientFinalProcessor;
|
||||
@@ -50,10 +52,11 @@ public class ScramAuthenticator {
|
||||
private ScramClient scramClient;
|
||||
private ScramSession scramSession;
|
||||
private ScramSession.ServerFirstProcessor serverFirstProcessor;
|
||||
@@ -48,10 +50,11 @@ public class ScramAuthenticator {
|
||||
pgStream.flush();
|
||||
}
|
||||
|
||||
@ -137,7 +135,7 @@ index ff96106a..05fc2d19 100644
|
||||
}
|
||||
|
||||
public void processServerMechanismsAndInit() throws IOException, PSQLException {
|
||||
@@ -144,6 +147,16 @@ public class ScramAuthenticator {
|
||||
@@ -129,6 +132,16 @@ public class ScramAuthenticator {
|
||||
);
|
||||
}
|
||||
|
||||
@ -155,5 +153,5 @@ index ff96106a..05fc2d19 100644
|
||||
|
||||
String clientFinalMessage = clientFinalProcessor.clientFinalMessage();
|
||||
--
|
||||
2.52.0
|
||||
2.54.0
|
||||
|
||||
35
SOURCES/postgresql-jdbc-CVE-2022-41946.patch
Normal file
35
SOURCES/postgresql-jdbc-CVE-2022-41946.patch
Normal file
@ -0,0 +1,35 @@
|
||||
From 9008dc9aade6dbfe4efafcd6872ebc55f4699cf5 Mon Sep 17 00:00:00 2001
|
||||
From: Dave Cramer <davecramer@gmail.com>
|
||||
Date: Wed, 23 Nov 2022 09:25:08 -0500
|
||||
Subject: [PATCH] Merge pull request from GHSA-562r-vg33-8x8h
|
||||
|
||||
* Fix: createTempFile vulnerability on unix like systems where temporary files can be read by other users on the system
|
||||
|
||||
---
|
||||
.../org/postgresql/util/StreamWrapper.java | 3 +-
|
||||
1 files changed, 2 insertions(+), 1 deletions(-)
|
||||
|
||||
diff --git a/src/main/java/org/postgresql/util/StreamWrapper.java b/src/main/java/org/postgresql/util/StreamWrapper.java
|
||||
index e4d48f7b..7ff49bc4 100644
|
||||
--- a/src/main/java/org/postgresql/util/StreamWrapper.java
|
||||
+++ b/src/main/java/org/postgresql/util/StreamWrapper.java
|
||||
@@ -17,6 +17,7 @@ import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
+import java.nio.file.Files;
|
||||
|
||||
/**
|
||||
* Wrapper around a length-limited InputStream.
|
||||
@@ -51,7 +52,7 @@ public class StreamWrapper {
|
||||
|
||||
if (memoryLength == -1) {
|
||||
final int diskLength;
|
||||
- final File tempFile = File.createTempFile(TEMP_FILE_PREFIX, null);
|
||||
+ final File tempFile = Files.createTempFile(TEMP_FILE_PREFIX, null).toFile();
|
||||
FileOutputStream diskOutputStream = new FileOutputStream(tempFile);
|
||||
diskOutputStream.write(rawData);
|
||||
try {
|
||||
--
|
||||
2.38.1
|
||||
|
||||
217
SOURCES/postgresql-jdbc-CVE-2024-1597.patch
Normal file
217
SOURCES/postgresql-jdbc-CVE-2024-1597.patch
Normal file
@ -0,0 +1,217 @@
|
||||
Sources of this patch:
|
||||
https://github.com/pgjdbc/pgjdbc/commit/b9b3777671c8a5cc580e1985f61337d39d47c730
|
||||
https://github.com/pgjdbc/pgjdbc/commit/990d63f6be401ab40de5eb303a75924c9e71903c
|
||||
|
||||
|
||||
diff --git a/pgjdbc/src/main/java/org/postgresql/core/v3/SimpleParameterList.java b/pgjdbc/src/main/java/org/postgresql/core/v3/SimpleParameterList.java
|
||||
index 1ce49996..b1bbb41a 100644
|
||||
--- a/pgjdbc/src/main/java/org/postgresql/core/v3/SimpleParameterList.java
|
||||
+++ b/pgjdbc/src/main/java/org/postgresql/core/v3/SimpleParameterList.java
|
||||
@@ -168,99 +170,163 @@ class SimpleParameterList implements V3ParameterList {
|
||||
bind(index, NULL_OBJECT, oid, binaryTransfer);
|
||||
}
|
||||
|
||||
+ /**
|
||||
+ * <p>Escapes a given text value as a literal, wraps it in single quotes, casts it to the
|
||||
+ * to the given data type, and finally wraps the whole thing in parentheses.</p>
|
||||
+ *
|
||||
+ * <p>For example, "123" and "int4" becomes "('123'::int)"</p>
|
||||
+ *
|
||||
+ * <p>The additional parentheses is added to ensure that the surrounding text of where the
|
||||
+ * parameter value is entered does modify the interpretation of the value.</p>
|
||||
+ *
|
||||
+ * <p>For example if our input SQL is: <code>SELECT ?b</code></p>
|
||||
+ *
|
||||
+ * <p>Using a parameter value of '{}' and type of json we'd get:</p>
|
||||
+ *
|
||||
+ * <pre>
|
||||
+ * test=# SELECT ('{}'::json)b;
|
||||
+ * b
|
||||
+ * ----
|
||||
+ * {}
|
||||
+ * </pre>
|
||||
+ *
|
||||
+ * <p>But without the parentheses the result changes:</p>
|
||||
+ *
|
||||
+ * <pre>
|
||||
+ * test=# SELECT '{}'::jsonb;
|
||||
+ * jsonb
|
||||
+ * -------
|
||||
+ * {}
|
||||
+ * </pre>
|
||||
+ **/
|
||||
+ private static String quoteAndCast(String text, String type, boolean standardConformingStrings) {
|
||||
+ StringBuilder sb = new StringBuilder((text.length() + 10) / 10 * 11); // Add 10% for escaping.
|
||||
+ sb.append("('");
|
||||
+ try {
|
||||
+ Utils.escapeLiteral(sb, text, standardConformingStrings);
|
||||
+ } catch (SQLException e) {
|
||||
+ // This should only happen if we have an embedded null
|
||||
+ // and there's not much we can do if we do hit one.
|
||||
+ //
|
||||
+ // To force a server side failure, we deliberately include
|
||||
+ // a zero byte character in the literal to force the server
|
||||
+ // to reject the command.
|
||||
+ sb.append('\u0000');
|
||||
+ }
|
||||
+ sb.append("'");
|
||||
+ if (type != null) {
|
||||
+ sb.append("::");
|
||||
+ sb.append(type);
|
||||
+ }
|
||||
+ sb.append(")");
|
||||
+ return sb.toString();
|
||||
+ }
|
||||
+
|
||||
@Override
|
||||
public String toString(int index, boolean standardConformingStrings) {
|
||||
--index;
|
||||
if (paramValues[index] == null) {
|
||||
return "?";
|
||||
} else if (paramValues[index] == NULL_OBJECT) {
|
||||
- return "NULL";
|
||||
- } else if ((flags[index] & BINARY) == BINARY) {
|
||||
+ return "(NULL)";
|
||||
+ }
|
||||
+ String textValue;
|
||||
+ String type;
|
||||
+ if ((flags[index] & BINARY) == BINARY) {
|
||||
// handle some of the numeric types
|
||||
-
|
||||
switch (paramTypes[index]) {
|
||||
case Oid.INT2:
|
||||
short s = ByteConverter.int2((byte[]) paramValues[index], 0);
|
||||
- return Short.toString(s);
|
||||
+ textValue = Short.toString(s);
|
||||
+ type = "int2";
|
||||
+ break;
|
||||
|
||||
case Oid.INT4:
|
||||
int i = ByteConverter.int4((byte[]) paramValues[index], 0);
|
||||
- return Integer.toString(i);
|
||||
+ textValue = Integer.toString(i);
|
||||
+ type = "int4";
|
||||
+ break;
|
||||
|
||||
case Oid.INT8:
|
||||
long l = ByteConverter.int8((byte[]) paramValues[index], 0);
|
||||
- return Long.toString(l);
|
||||
+ textValue = Long.toString(l);
|
||||
+ type = "int8";
|
||||
+ break;
|
||||
|
||||
case Oid.FLOAT4:
|
||||
float f = ByteConverter.float4((byte[]) paramValues[index], 0);
|
||||
if (Float.isNaN(f)) {
|
||||
- return "'NaN'::real";
|
||||
+ return "('NaN'::real)";
|
||||
}
|
||||
- return Float.toString(f);
|
||||
+ textValue = Float.toString(f);
|
||||
+ type = "real";
|
||||
+ break;
|
||||
|
||||
case Oid.FLOAT8:
|
||||
double d = ByteConverter.float8((byte[]) paramValues[index], 0);
|
||||
if (Double.isNaN(d)) {
|
||||
- return "'NaN'::double precision";
|
||||
+ return "('NaN'::double precision)";
|
||||
+ }
|
||||
+ textValue = Double.toString(d);
|
||||
+ type = "double precision";
|
||||
+ break;
|
||||
+
|
||||
+ case Oid.NUMERIC:
|
||||
+ Number n = ByteConverter.numeric((byte[]) paramValues[index]);
|
||||
+ if (n instanceof Double) {
|
||||
+ assert ((Double) n).isNaN();
|
||||
+ return "('NaN'::numeric)";
|
||||
}
|
||||
- return Double.toString(d);
|
||||
+ textValue = n.toString();
|
||||
+ type = "numeric";
|
||||
+ break;
|
||||
|
||||
case Oid.UUID:
|
||||
- String uuid =
|
||||
+ textValue =
|
||||
new UUIDArrayAssistant().buildElement((byte[]) paramValues[index], 0, 16).toString();
|
||||
- return "'" + uuid + "'::uuid";
|
||||
+ type = "uuid";
|
||||
+ break;
|
||||
|
||||
case Oid.POINT:
|
||||
PGpoint pgPoint = new PGpoint();
|
||||
pgPoint.setByteValue((byte[]) paramValues[index], 0);
|
||||
- return "'" + pgPoint.toString() + "'::point";
|
||||
+ textValue = pgPoint.toString();
|
||||
+ type = "point";
|
||||
+ break;
|
||||
|
||||
case Oid.BOX:
|
||||
PGbox pgBox = new PGbox();
|
||||
pgBox.setByteValue((byte[]) paramValues[index], 0);
|
||||
- return "'" + pgBox.toString() + "'::box";
|
||||
+ textValue = pgBox.toString();
|
||||
+ type = "box";
|
||||
+ break;
|
||||
+
|
||||
+ default:
|
||||
+ return "?";
|
||||
}
|
||||
- return "?";
|
||||
} else {
|
||||
- String param = paramValues[index].toString();
|
||||
-
|
||||
- // add room for quotes + potential escaping.
|
||||
- StringBuilder p = new StringBuilder(3 + (param.length() + 10) / 10 * 11);
|
||||
-
|
||||
- // No E'..' here since escapeLiteral escapes all things and it does not use \123 kind of
|
||||
- // escape codes
|
||||
- p.append('\'');
|
||||
- try {
|
||||
- p = Utils.escapeLiteral(p, param, standardConformingStrings);
|
||||
- } catch (SQLException sqle) {
|
||||
- // This should only happen if we have an embedded null
|
||||
- // and there's not much we can do if we do hit one.
|
||||
- //
|
||||
- // The goal of toString isn't to be sent to the server,
|
||||
- // so we aren't 100% accurate (see StreamWrapper), put
|
||||
- // the unescaped version of the data.
|
||||
- //
|
||||
- p.append(param);
|
||||
- }
|
||||
- p.append('\'');
|
||||
+ textValue = paramValues[index].toString();
|
||||
+
|
||||
int paramType = paramTypes[index];
|
||||
if (paramType == Oid.TIMESTAMP) {
|
||||
- p.append("::timestamp");
|
||||
+ type = "timestamp";
|
||||
} else if (paramType == Oid.TIMESTAMPTZ) {
|
||||
- p.append("::timestamp with time zone");
|
||||
+ type = "timestamp with time zone";
|
||||
} else if (paramType == Oid.TIME) {
|
||||
- p.append("::time");
|
||||
+ type = "time";
|
||||
} else if (paramType == Oid.TIMETZ) {
|
||||
- p.append("::time with time zone");
|
||||
+ type = "time with time zone";
|
||||
} else if (paramType == Oid.DATE) {
|
||||
- p.append("::date");
|
||||
+ type = "date";
|
||||
} else if (paramType == Oid.INTERVAL) {
|
||||
- p.append("::interval");
|
||||
+ type = "interval";
|
||||
} else if (paramType == Oid.NUMERIC) {
|
||||
- p.append("::numeric");
|
||||
+ type = "numeric";
|
||||
+ } else {
|
||||
+ type = null;
|
||||
}
|
||||
- return p.toString();
|
||||
}
|
||||
+ return quoteAndCast(textValue, type, standardConformingStrings);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -28,86 +28,57 @@
|
||||
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
# Configuration for rpmbuild, might be specified by options
|
||||
# like e.g. 'rpmbuild --define "runselftest 0"'.
|
||||
Summary: JDBC driver for PostgreSQL
|
||||
Name: postgresql-jdbc
|
||||
Version: 42.2.14
|
||||
Release: 4%{?dist}
|
||||
License: BSD
|
||||
URL: http://jdbc.postgresql.org/
|
||||
|
||||
# =============================================================================
|
||||
# IMPORTANT NOTE: This spec file is maintained on two places -- in native
|
||||
# Fedora repo [1] and in pgjdbc upstream [2]. Please, keep that in sync
|
||||
# (manual effort!) so both Fedora and Upstream can benefit from automatic
|
||||
# packaging CI, this is now done in [3] Copr project.
|
||||
# [1] https://src.fedoraproject.org/rpms/postgresql-jdbc
|
||||
# [2] https://github.com/pgjdbc/pgjdbc/tree/master/packaging/rpm
|
||||
# [3] https://copr.fedorainfracloud.org/coprs/g/pgjdbc/pgjdbc-travis/
|
||||
# ============================================================================
|
||||
Source0: https://repo1.maven.org/maven2/org/postgresql/postgresql/%{version}/postgresql-%{version}-src.tar.gz
|
||||
Patch0: postgresql-jdbc-CVE-2022-41946.patch
|
||||
Patch1: postgresql-jdbc-CVE-2024-1597.patch
|
||||
Patch2: CVE-2026-42198.patch
|
||||
Patch3: CVE-2026-42198-tests.patch
|
||||
Provides: pgjdbc = %version-%release
|
||||
|
||||
%{!?runselftest:%global runselftest 1}
|
||||
BuildArch: noarch
|
||||
|
||||
%global section devel
|
||||
%global source_path pgjdbc/src/main/java/org/postgresql
|
||||
BuildRequires: maven-local
|
||||
# BuildRequires: java-comment-preprocessor
|
||||
# BuildRequires: properties-maven-plugin
|
||||
BuildRequires: maven-enforcer-plugin
|
||||
BuildRequires: maven-plugin-bundle
|
||||
BuildRequires: maven-plugin-build-helper
|
||||
BuildRequires: mvn(com.ongres.scram:client)
|
||||
|
||||
Summary: JDBC driver for PostgreSQL
|
||||
Name: postgresql-jdbc
|
||||
Version: 42.7.2
|
||||
Release: 2%{?dist}
|
||||
License: BSD-2-Clause
|
||||
URL: https://jdbc.postgresql.org/
|
||||
BuildArch: noarch
|
||||
ExclusiveArch: %{java_arches} noarch
|
||||
|
||||
Source0: https://repo1.maven.org/maven2/org/postgresql/postgresql/%{version}/postgresql-%{version}-jdbc-src.tar.gz
|
||||
|
||||
# https://github.com/pgjdbc/pgjdbc/commit/c9d41d1332a7426fcef19ff89f2e6b1116429143
|
||||
Patch0: CVE-2026-42198.patch
|
||||
Patch1: CVE-2026-42198-tests.patch
|
||||
|
||||
Provides: pgjdbc = %version-%release
|
||||
|
||||
BuildRequires: maven-local
|
||||
BuildRequires: mvn(com.ongres.scram:client)
|
||||
BuildRequires: mvn(junit:junit)
|
||||
BuildRequires: mvn(org.apache.maven.plugins:maven-dependency-plugin)
|
||||
BuildRequires: mvn(org.apache.maven.plugins:maven-shade-plugin)
|
||||
BuildRequires: mvn(org.junit.jupiter:junit-jupiter-api)
|
||||
BuildRequires: mvn(se.jiderhamn:classloader-leak-test-framework)
|
||||
|
||||
%if %runselftest
|
||||
BuildRequires: postgresql-contrib
|
||||
BuildRequires: postgresql-test-rpm-macros
|
||||
%endif
|
||||
|
||||
# gettext is only needed if we try to update translations
|
||||
#BuildRequires: gettext
|
||||
|
||||
Obsoletes: %{name}-parent-poms < 42.2.2-2
|
||||
|
||||
Provides: bundled(mvn(com.ongres.stringprep:saslprep)) = 1.1
|
||||
Provides: bundled(mvn(com.ongres.stringprep:stringprep)) = 1.1
|
||||
Provides: bundled(mvn(com.ongres.scram:common)) = 2.1
|
||||
Provides: bundled(mvn(com.ongres.scram:client)) = 2.1
|
||||
Obsoletes: %{name}-parent-poms < 42.2.2-2
|
||||
|
||||
%description
|
||||
PostgreSQL is an advanced Object-Relational database management
|
||||
system. The postgresql-jdbc package includes the .jar files needed for
|
||||
Java programs to access a PostgreSQL database.
|
||||
|
||||
|
||||
%package javadoc
|
||||
Summary: API docs for %{name}
|
||||
Summary: API docs for %{name}
|
||||
|
||||
%description javadoc
|
||||
This package contains the API Documentation for %{name}.
|
||||
|
||||
|
||||
%prep
|
||||
%setup -c -q
|
||||
|
||||
mv postgresql-%{version}-jdbc-src/* .
|
||||
|
||||
%patch -P0 -p1
|
||||
%patch -P1 -p1
|
||||
%patch -P 0 -p1
|
||||
%patch -P 1 -p2
|
||||
%patch -P 2 -p1
|
||||
%patch -P 3 -p1
|
||||
|
||||
# remove any binary libs
|
||||
find -type f \( -name "*.jar" -or -name "*.class" \) | xargs rm -f
|
||||
|
||||
%pom_xpath_remove "pom:plugin[pom:artifactId = 'maven-javadoc-plugin']"
|
||||
|
||||
# compat symlink: requested by dtardon (libreoffice), reverts part of
|
||||
# 0af97ce32de877 commit.
|
||||
%mvn_file org.postgresql:postgresql %{name}/postgresql %{name} postgresql
|
||||
@ -115,18 +86,6 @@ find -type f \( -name "*.jar" -or -name "*.class" \) | xargs rm -f
|
||||
# For compat reasons, make Maven artifact available under older coordinates.
|
||||
%mvn_alias org.postgresql:postgresql postgresql:postgresql
|
||||
|
||||
# remove unmet dependency
|
||||
%pom_remove_dep uk.org.webcompere:system-stubs-jupiter
|
||||
|
||||
# remove tests that depend on the system-stubs-jupiter
|
||||
rm src/test/java/org/postgresql/test/jdbc2/DriverTest.java \
|
||||
src/test/java/org/postgresql/util/OSUtilTest.java \
|
||||
src/test/java/org/postgresql/jdbcurlresolver/PgServiceConfParserTest.java \
|
||||
src/test/java/org/postgresql/jdbcurlresolver/PgPassParserTest.java \
|
||||
src/test/java/org/postgresql/util/StubEnvironmentAndProperties.java
|
||||
|
||||
# failing test due to infra
|
||||
rm src/test/java/org/postgresql/test/jdbc2/ConnectTimeoutTest.java
|
||||
|
||||
%build
|
||||
# Ideally we would run "sh update-translations.sh" here, but that results
|
||||
@ -135,238 +94,60 @@ rm src/test/java/org/postgresql/test/jdbc2/ConnectTimeoutTest.java
|
||||
# different platforms don't build in the same minute. For now, rely on
|
||||
# upstream to have updated the translations files before packaging.
|
||||
|
||||
# Include PostgreSQL testing methods and variables.
|
||||
%if %runselftest
|
||||
%postgresql_tests_init
|
||||
%mvn_build -f
|
||||
|
||||
PGTESTS_LOCALE=C.UTF-8
|
||||
|
||||
cat <<EOF > build.local.properties
|
||||
server=localhost
|
||||
port=$PGTESTS_PORT
|
||||
database=test
|
||||
username=test
|
||||
password=test
|
||||
privilegedUser=$PGTESTS_ADMIN
|
||||
privilegedPassword=$PGTESTS_ADMINPASS
|
||||
preparethreshold=5
|
||||
loglevel=0
|
||||
protocolVersion=0
|
||||
EOF
|
||||
|
||||
# Start the local PG cluster.
|
||||
%postgresql_tests_start
|
||||
%else
|
||||
# -f is equal to -Dmaven.test.skip=true
|
||||
opts="-f"
|
||||
%endif
|
||||
|
||||
%mvn_build $opts --xmvn-javadoc
|
||||
|
||||
%install
|
||||
%mvn_install
|
||||
|
||||
|
||||
%files -f .mfiles
|
||||
%license LICENSE
|
||||
%doc README.md
|
||||
|
||||
|
||||
%files javadoc -f .mfiles-javadoc
|
||||
%license LICENSE
|
||||
|
||||
|
||||
%changelog
|
||||
* Thu Jun 04 2026 Marian Koncek <mkoncek@redhat.com> - 42.7.2-2
|
||||
* Mon Jun 08 2026 Marian Koncek <mkoncek@redhat.com> - 42.2.14-4
|
||||
- Limit SCRAM PBKDF2 iterations to prevent DoS via malicious server
|
||||
- Resolves: CVE-2026-42198
|
||||
|
||||
* Tue Apr 07 2026 Marian Koncek <mkoncek@redhat.com> - 42.7.2-1
|
||||
- Rebase to 42.7.2
|
||||
- Resolves: CVE-2024-1597
|
||||
* Wed Feb 28 2024 Zuzana Miklankova <zmiklank@redhat.com> - 42.2.14-3
|
||||
- Fix CVE-2024-1597
|
||||
|
||||
* Fri Jan 09 2026 Marian Koncek <mkoncek@redhat.com> - 42.7.1-9
|
||||
- Bundle shaded ongres-* dependencies
|
||||
* Mon Jan 09 2023 Zuzana Miklankova <zmiklank@redhat.com> - 42.2.14-2
|
||||
- Fix CVE-2022-41946
|
||||
|
||||
* Tue Apr 01 2025 Marián Konček <mkoncek@redhat.com> - 42.7.1-8
|
||||
- Fix BuildRequires
|
||||
* Tue Dec 14 2021 Zuzana Miklankova <zmiklank@redhat.com> - 42.2.14-1
|
||||
- Rebase on 42.2.14
|
||||
|
||||
* Tue Oct 29 2024 Troy Dawson <tdawson@redhat.com> - 42.7.1-7
|
||||
- Bump release for October 2024 mass rebuild:
|
||||
Resolves: RHEL-64018
|
||||
* Wed Jul 22 2020 Ondrej Dubaj <odubaj@redhat.com> - 42.2.3-3
|
||||
- fixed XXE vulnerability unit test
|
||||
|
||||
* Tue Aug 13 2024 Marián Konček <mkoncek@redhat.com> - 42.7.1-6
|
||||
- Rebuild
|
||||
|
||||
* Fri Aug 09 2024 Marián Konček <mkoncek@redhat.com> - 42.7.1-5
|
||||
- Rebuild without generated Requires
|
||||
|
||||
* Mon Jun 24 2024 Troy Dawson <tdawson@redhat.com> - 42.7.1-4
|
||||
- Bump release for June 2024 mass rebuild
|
||||
|
||||
* Thu Jan 25 2024 Fedora Release Engineering <releng@fedoraproject.org> - 42.7.1-3
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild
|
||||
|
||||
* Sun Jan 21 2024 Fedora Release Engineering <releng@fedoraproject.org> - 42.7.1-2
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild
|
||||
|
||||
* Fri Dec 08 2023 Zuzana Miklankova <zmiklank@redhat.com> - 42.7.1-1
|
||||
- rebase to version 42.7.1 (bz#2253589)
|
||||
|
||||
* Wed Nov 22 2023 Fedora Release Engineering <releng@fedoraproject.org> - 42.7.0-1
|
||||
- rebase to version 42.7.0 (bz#2250965)
|
||||
|
||||
* Fri Jul 21 2023 Fedora Release Engineering <releng@fedoraproject.org> - 42.6.0-3
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild
|
||||
|
||||
* Tue May 16 2023 Yaakov Selkowitz <yselkowi@redhat.com> - 42.6.0-2
|
||||
- Remove unused BR: maven-clean-plugin
|
||||
|
||||
* Mon Mar 20 2023 Zuzana Miklankova <zmiklank@redhat.com> - 42.6.0-1
|
||||
- rebase to version 42.6.0 (bz#2167110)
|
||||
|
||||
* Thu Feb 02 2023 Zuzana Miklankova <zmiklank@redhat.com> - 42.5.2-1
|
||||
- rebase to version 42.5.2 (bz#2160979)
|
||||
|
||||
* Fri Jan 20 2023 Fedora Release Engineering <releng@fedoraproject.org> - 42.5.1-2
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild
|
||||
|
||||
* Mon Dec 05 2022 Zuzana Miklankova <zmiklank@redhat.com> - 42.5.1-1
|
||||
- rebase to version 42.5.1 (bz#2147486)
|
||||
|
||||
* Mon Aug 29 2022 Zuzana Miklankova <zmiklank@redhat.com> - 42.5.0-1
|
||||
- rebase to version 42.5.0 (bz#2119382)
|
||||
|
||||
* Thu Aug 04 2022 Zuzana Miklankova <zmiklank@redhat.com> - 42.4.1-1
|
||||
- rebase to version 42.4.1
|
||||
|
||||
* Fri Jul 22 2022 Fedora Release Engineering <releng@fedoraproject.org> - 42.4.0-3
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild
|
||||
|
||||
* Fri Jul 08 2022 Jiri Vanek <jvanek@redhat.com> - 42.4.0-2
|
||||
- Rebuilt for Drop i686 JDKs
|
||||
|
||||
* Tue Jun 14 2022 Zuzana Miklankova <zmiklank@redhat.com> - 42.4.0-1
|
||||
- rebase to version 42.4.0
|
||||
|
||||
* Wed May 25 2022 Zuzana Miklankova <zmiklank@redhat.com> - 42.3.6-1
|
||||
- rebase to version 42.3.6
|
||||
|
||||
* Thu May 05 2022 Zuzana Miklankova <zmiklank@redhat.com> - 42.3.5-1
|
||||
- rebase to version 42.3.5
|
||||
|
||||
* Tue Apr 19 2022 Zuzana Miklankova <zmiklank@redhat.com> - 42.3.4-1
|
||||
- rebase to version 42.3.4
|
||||
|
||||
* Thu Feb 17 2022 Zuzana Miklankova <zmiklank@redhat.com> - 42.3.3-1
|
||||
- rebase to version 42.3.3
|
||||
|
||||
* Fri Feb 11 2022 Zuzana Miklankova <zmiklank@redhat.com> - 42.3.2-1
|
||||
- rebase to version 42.3.2
|
||||
|
||||
* Sat Feb 05 2022 Jiri Vanek <jvanek@redhat.com> - 42.3.1-3
|
||||
- Rebuilt for java-17-openjdk as system jdk
|
||||
|
||||
* Fri Jan 21 2022 Fedora Release Engineering <releng@fedoraproject.org> - 42.3.1-2
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild
|
||||
|
||||
* Wed Nov 03 2021 Zuzana Miklankova <zmiklank@redhat.com> - 42.3.1-1
|
||||
- rebase to version 42.3.1
|
||||
|
||||
* Wed Oct 20 2021 Zuzana Miklankova <zmiklank@redhat.com> - 42.3.0-1
|
||||
- rebase to version 42.3.0
|
||||
|
||||
* Mon Oct 04 2021 Zuzana Miklankova <zmiklank@redhat.com> - 42.2.24-1
|
||||
- rebase to version 42.2.24
|
||||
|
||||
* Fri Jul 23 2021 Fedora Release Engineering <releng@fedoraproject.org> - 42.2.23-2
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild
|
||||
|
||||
* Wed Jul 21 2021 Ondrej Dubaj <odubaj@redhat.com> - 42.2.23-1
|
||||
- rebase to version 42.2.23
|
||||
|
||||
* Wed May 12 2021 Ondrej Dubaj <odubaj@redhat.com> - 42.2.19-2
|
||||
- remove maven-javadoc-plugin dependency
|
||||
|
||||
* Sat Feb 20 2021 Ondrej Dubaj <odubaj@redhat.com> - 42.2.19-1
|
||||
- rebase to version 42.2.19
|
||||
|
||||
* Wed Jan 27 2021 Fedora Release Engineering <releng@fedoraproject.org> - 42.2.18-2
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
|
||||
|
||||
* Tue Oct 20 2020 Ondrej Dubaj <odubaj@redhat.com> - 42.2.18-1
|
||||
- rebase to version 42.2.18
|
||||
|
||||
* Wed Aug 26 2020 Ondrej Dubaj <odubaj@redhat.com> - 42.2.16-1
|
||||
- rebased to version 42.2.16
|
||||
|
||||
* Fri Jul 24 2020 Ondrej Dubaj <odubaj@redhat.com> - 42.2.15-1
|
||||
- rebased to version 42.2.15
|
||||
|
||||
* Fri Jul 24 2020 Ondrej Dubaj <odubaj@redhat.com> - 42.2.12-3
|
||||
- fixed javadoc build problem + added missing dependencies
|
||||
- remove SSPIClient for windows API
|
||||
* Tue Jul 14 2020 Ondrej Dubaj <odubaj@redhat.com> - 42.2.3-2
|
||||
- fixed XXE vulnerability (CVE-2020-13692)
|
||||
|
||||
* Sat Jul 11 2020 Jiri Vanek <jvanek@redhat.com> - 42.2.12-2
|
||||
- Rebuilt for JDK-11, see https://fedoraproject.org/wiki/Changes/Java11
|
||||
|
||||
* Wed May 13 2020 Ondrej Dubaj <odubaj@redhat.com> - 42.2.12-1
|
||||
- new upstream release + skip javadoc due to jdk-11
|
||||
|
||||
* Mon Mar 16 2020 Ondrej Dubaj <odubaj@redhat.com> - 42.2.11-1
|
||||
- new upstream release
|
||||
|
||||
* Mon Mar 02 2020 Ondrej Dubaj <odubaj@redhat.com> - 42.3.0-1
|
||||
- new upstream release (rhbz#1800440)
|
||||
|
||||
* Thu Jan 30 2020 Fedora Release Engineering <releng@fedoraproject.org> - 42.2.9-2
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
|
||||
|
||||
* Fri Dec 13 2019 Ondrej Dubaj <odubaj@redhat.com> - 42.2.9-1
|
||||
- new upstream release (rhbz#1782277)
|
||||
|
||||
* Fri Sep 20 2019 Pavel Raiskup <praiskup@redhat.com> - 42.2.8-1
|
||||
- new upstream release (rhbz#1750766)
|
||||
|
||||
* Fri Jul 26 2019 Fedora Release Engineering <releng@fedoraproject.org> - 42.2.6-2
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
|
||||
|
||||
* Tue Jun 25 2019 Jakub Janco <jjanco@redhat.com> - 42.2.6-1
|
||||
- new version
|
||||
|
||||
* Sat Feb 02 2019 Fedora Release Engineering <releng@fedoraproject.org> - 42.2.5-2
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
|
||||
|
||||
* Wed Nov 21 2018 Pavel Raiskup <praiskup@redhat.com> - 42.2.5-1
|
||||
- new upstream release
|
||||
|
||||
* Fri Aug 03 2018 Pavel Raiskup <praiskup@redhat.com> - 42.2.4-1
|
||||
- new upstream release (rhbz#1601193)
|
||||
|
||||
* Fri Jul 13 2018 Pavel Raiskup <praiskup@redhat.com> - 42.2.3-1
|
||||
- new upstream release (rhbz#1600759)
|
||||
|
||||
* Wed May 30 2018 Mikolaj Izdebski <mizdebsk@redhat.com> - 42.2.2-4
|
||||
* Wed May 30 2018 Mikolaj Izdebski <mizdebsk@redhat.com> - 42.2.2-2
|
||||
- Remove and obsolete parent-poms subpackage
|
||||
|
||||
* Fri Apr 20 2018 Pavel Raiskup <praiskup@redhat.com> - 42.2.2-3
|
||||
* Fri Apr 20 2018 Pavel Raiskup <praiskup@redhat.com> - 42.2.2-2
|
||||
- provide postgresql.jar, as that's the upstream's artifactId
|
||||
|
||||
* Fri Apr 13 2018 Pavel Raiskup <praiskup@redhat.com> - 42.2.2-2
|
||||
- BR postgresql-test-rpm-macros
|
||||
* Fri Apr 13 2018 Pavel Raiskup <praiskup@redhat.com> - 42.2.2-1
|
||||
- rebase to latest upstream release
|
||||
|
||||
* Fri Mar 16 2018 Pavel Raiskup <praiskup@redhat.com> - 42.2.2-1
|
||||
- new upstream release
|
||||
|
||||
* Fri Feb 09 2018 Fedora Release Engineering <releng@fedoraproject.org> - 42.2.1-2
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
|
||||
|
||||
* Fri Jan 26 2018 Pavel Raiskup <praiskup@redhat.com> - 42.2.1-1
|
||||
- new upstream release
|
||||
|
||||
* Fri Jan 19 2018 Pavel Raiskup <praiskup@redhat.com> - 42.2.0-1
|
||||
* Fri Apr 13 2018 Pavel Raiskup <praiskup@redhat.com> - 42.2.0-1
|
||||
- rebase to the latest upstream release
|
||||
- nicer github source urls
|
||||
- sync with upstream spec
|
||||
- use new postgresql testing macros (rawhide only)
|
||||
- depend on postgresql-test-rpm-macros
|
||||
|
||||
* Wed Aug 23 2017 Pavel Raiskup <praiskup@redhat.com> - 42.1.4-1
|
||||
- rebase to latest upstream release
|
||||
@ -1,9 +0,0 @@
|
||||
--- !Policy
|
||||
product_versions:
|
||||
- rhel-10
|
||||
decision_contexts:
|
||||
- osci_compose_gate
|
||||
rules:
|
||||
- !PassingTestCaseRule {test_case_name: osci.brew-build./plans/javapackages.functional}
|
||||
- !PassingTestCaseRule {test_case_name: osci.brew-build./plans/matrix/postgresql-16.functional}
|
||||
- !PassingTestCaseRule {test_case_name: osci.brew-build./plans/matrix/postgresql-18.functional}
|
||||
@ -1,9 +0,0 @@
|
||||
summary: Run javapackages-specific tests
|
||||
discover:
|
||||
how: fmf
|
||||
url: https://gitlab.com/redhat/centos-stream/tests/javapackages.git
|
||||
ref: c10s
|
||||
execute:
|
||||
how: tmt
|
||||
context:
|
||||
jpv_flavor: generic
|
||||
@ -1,28 +0,0 @@
|
||||
summary: Basic smoke test
|
||||
discover:
|
||||
how: fmf
|
||||
url: https://gitlab.com/redhat/centos-stream/tests/postgresql-jdbc.git
|
||||
execute:
|
||||
how: tmt
|
||||
|
||||
prepare:
|
||||
- how: install
|
||||
package: java-21-openjdk-headless
|
||||
|
||||
/postgresql-16:
|
||||
prepare+:
|
||||
- how: install
|
||||
package:
|
||||
- postgresql16-server
|
||||
- postgresql16-contrib
|
||||
- postgresql-test-rpm-macros
|
||||
|
||||
# There is no version 17
|
||||
|
||||
/postgresql-18:
|
||||
prepare+:
|
||||
- how: install
|
||||
package:
|
||||
- postgresql18-server
|
||||
- postgresql18-contrib
|
||||
- postgresql18-test-rpm-macros
|
||||
Loading…
Reference in New Issue
Block a user