Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oIYZ1-0002jl-VM for pgsql-jdbc@arkaria.postgresql.org; Mon, 01 Aug 2022 16:46:44 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1oIYZ0-0005e1-Sj for pgsql-jdbc@arkaria.postgresql.org; Mon, 01 Aug 2022 16:46:42 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oIYZ0-0005df-J2 for pgsql-jdbc@lists.postgresql.org; Mon, 01 Aug 2022 16:46:42 +0000 Received: from out-28.smtp.github.com ([192.30.252.211]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oIYYy-00008W-7N for pgsql-jdbc@lists.postgresql.org; Mon, 01 Aug 2022 16:46:41 +0000 Received: from github.com (hubbernetes-node-b32e060.ash1-iad.github.net [10.56.206.47]) by smtp.github.com (Postfix) with ESMTPA id 585A6900365 for ; Mon, 1 Aug 2022 09:46:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=github.com; s=pf2014; t=1659372399; bh=NF9uux0yts50sycY4tVUipJHepGeZDwUcS0LdZg/JOw=; h=Date:From:To:Subject:From; b=XCsaSj6sKFRsCpMgVXF19ynEpBrrNkfuakiJqnu4+rj/QRakBWh49PWbUSOZTbTKM JxzbLkk1tawKQrkqoC5sBNimGXTj3vOUVpC/WdMSn0nQK6AFYa+Wqph89A8+9qNaZ1 bshwwMa6DFMj6YJjQldU4Xug0kvVAF5BcIAcicEI= Date: Mon, 01 Aug 2022 09:46:39 -0700 From: Sehrope Sarkuni To: pgsql-jdbc@lists.postgresql.org Message-ID: Subject: [pgjdbc/pgjdbc] 739e59: Merge pull request from GHSA-r38f-c4h4-hqq2 Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Approved: 58GruLoMopuc X-GitHub-Recipient-Address: pgsql-jdbc@lists.postgresql.org X-Auto-Response-Suppress: All List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Branch: refs/heads/master Home: https://github.com/pgjdbc/pgjdbc Commit: 739e599d52ad80f8dcd6efedc6157859b1a9d637 https://github.com/pgjdbc/pgjdbc/commit/739e599d52ad80f8dcd6efedc6157859b1a9d637 Author: Sehrope Sarkuni Date: 2022-08-01 (Mon, 01 Aug 2022) Changed paths: M pgjdbc/src/main/java/org/postgresql/jdbc/PgResultSet.java M pgjdbc/src/test/java/org/postgresql/test/jdbc2/Jdbc2TestSuite.java A pgjdbc/src/test/java/org/postgresql/test/jdbc2/ResultSetRefreshTest.java Log Message: ----------- Merge pull request from GHSA-r38f-c4h4-hqq2 Fixes SQL generated in PgResultSet.refresh() to escape column identifiers so as to prevent SQL injection. Previously, the column names for both key and data columns in the table were copied as-is into the generated SQL. This allowed a malicious table with column names that include statement terminator to be parsed and executed as multiple separate commands. Also adds a new test class ResultSetRefreshTest to verify this change.