PostgreSQL JDBC 42.3.2/42.2.25 安全更新

发布于 2022-02-02,JDBC Project
安全相关 相关开源软件

已为 PostgreSQL JDBC 驱动程序创建了一项安全公告 (https://github.com/advisories/GHSA-v7wg-cpwc-24m4)。该驱动程序提供了根据通过 authenticationPluginClassName、sslhostnameverifier、socketFactory、sslfactory、sslpasswordcallback 连接属性提供的类名来实例化插件实例的功能。

然而,驱动程序在实例化类之前并未验证该类是否实现了预期的接口。

修复方案是确保类实现了预期的接口。此问题已在 42.2.25 和 42.3.2 版本中修复。此外,以下是 42.3.2 中的一些变更,完整变更日志可在此处查看 (https://jdbc.postgresql.org/documentation/changelog.html#version_42.3.2)。

变更

  • 性能优化:在连接时读取 in_hot_standby GUC PR #2334 (https://github.com/pgjdbc/pgjdbc/pull/2334)

  • 修复:如果 gssEncryption 为 prefer 或 require,将询问服务器是否支持 GSS 加密 PR #2396 (https://github.com/pgjdbc/pgjdbc/pull/2396),无需在询问服务器是否支持 GSS 加密之前在缓存中持有票据

  • 修复:对 BIT(>1) 调用 #getBoolean 时抛出 SQLException PR #2386 (https://github.com/pgjdbc/pgjdbc/pull/2386),当对 BIT(>1) 调用 CallableStatement#getBoolean(int) 时抛出 SQLException 而非 ClassCastException

  • 性能优化:在连接时读取 in_hot_standby GUC PR #2334 (https://github.com/pgjdbc/pgjdbc/pull/2334)

  • 在 chooseClientAlias 中添加证书密钥类型检查 PR #2417 (https://github.com/pgjdbc/pgjdbc/pull/2417)

新增

  • 功能:添加 authenticationPluginClassName 选项以在运行时提供密码。新增 authenticationPluginClassName 连接属性,允许终端用户指定一个在运行时提供连接密码的类。实现该接口的用户必须确保每次调用方法时提供一个新的 char[] 数组,因为驱动程序使用后会将内容填充为零。驱动程序内的调用点已尽可能更新为直接使用 char[]。这包括在 GSS 认证代码路径中的直接使用,这些代码内部之前已经在将 String 密码转换为 char[] 以供内部使用。这允许配置必须动态生成或定期更改密码的连接。PR #2369 (https://github.com/pgjdbc/pgjdbc/pull/2369) 原始问题 Issue #2102 (https://github.com/pgjdbc/pgjdbc/issues/2102)

  • 功能:添加 tcpNoDelay 选项 PR #2341 (https://github.com/pgjdbc/pgjdbc/pull/2341) 修复 Issue #2324 (https://github.com/pgjdbc/pgjdbc/issues/2324)

  • 功能:支持 pg_service.conf 和 .pgpass(jdbc:postgresql://?service=my-service)PR #2260 (https://github.com/pgjdbc/pgjdbc/pull/2260) 修复 Issue #2278 (https://github.com/pgjdbc/pgjdbc/issues/2278)

修复

  • 在 PgStatement 和 PgResultset 中使用本地 TimestampUtil 以保证线程安全 PR #2291 (https://github.com/pgjdbc/pgjdbc/pull/2291) 修复 Issue #921 (https://github.com/pgjdbc/pgjdbc/issues/921),同步共享日历的修改

  • 修复:PgObject isNull() 返回相反的结果 修复 Issue #2411 (https://github.com/pgjdbc/pgjdbc/issues/2411) PR #2414 (https://github.com/pgjdbc/pgjdbc/pull/2414)

  • 修复:Windows 上默认文件名为 ".pg_service.conf"(而非 "pg_service.conf")PR #2398 (https://github.com/pgjdbc/pgjdbc/pull/2398) 修复 Issue #2278 (https://github.com/pgjdbc/pgjdbc/issues/2278)

  • 修复:如果设置了 fetchsize,读取后不关闭 refcursor 修复 Issue #2227 (https://github.com/pgjdbc/pgjdbc/issues/2227) PR #2371 (https://github.com/pgjdbc/pgjdbc/pull/2371)

  • 修复:重构 GSS 认证以使用主体名称获取凭据 修复 Issue #2235 (https://github.com/pgjdbc/pgjdbc/issues/2235) PR #2352 (https://github.com/pgjdbc/pgjdbc/pull/2352)

  • 修复:以大写形式返回 getIndexInfo 元数据列 PR #2368 (https://github.com/pgjdbc/pgjdbc/pull/2368)

  • 修复:ConnectionFactoryImpl#tryConnect 中的连接泄漏 PR #2350 (https://github.com/pgjdbc/pgjdbc/pull/2350) Issue #2351 (https://github.com/pgjdbc/pgjdbc/issues/2351)

  • 修复:修复 IS_AUTOGENERATED 标志 PR #2348 (https://github.com/pgjdbc/pgjdbc/pull/2348)

  • 修复:Windows 上的服务文件解析测试 PR #2347 (https://github.com/pgjdbc/pgjdbc/pull/2347)

  • 修复:规范说明对已关闭的连接调用 close() 应为空操作 PR #2345 (https://github.com/pgjdbc/pgjdbc/pull/2345) 修复 Issue #2300 (https://github.com/pgjdbc/pgjdbc/issues/2300)

  • 修复:为对 SQL TIME(6) 调用的 getTimestamp() 添加微秒精度。目前"通过 resultSet.getTimestamp() 获取 TIME(6) 类型的值时,仅保留毫秒精度,微秒小数位会丢失。"此更改将在对 TIME(6) 调用 .getTimestamp() 时保留微秒精度。PR #2181 (https://github.com/pgjdbc/pgjdbc/pull/2181) 关闭 Issue #1537 (https://github.com/pgjdbc/pgjdbc/issues/1537)

  • 测试:物化视图权限 PR #2209 (https://github.com/pgjdbc/pgjdbc/pull/2209),添加和删除物化视图,在 TestUtil 以及 DatabaseMetaData 的 setup 和 teardown 中添加 修复 Issue #2060 (https://github.com/pgjdbc/pgjdbc/issues/2060)

  • 修复:connect.md 中的拼写错误 PR #2338 (https://github.com/pgjdbc/pgjdbc/pull/2238) OutOfMemoryException => OutOfMemoryError

  • 修复:在 PgStatement 和 PgResultset 中使用本地 TimestampUtil 以保证线程安全。TimestampUtil 不是线程安全的,当多个线程使用同一连接的 ResultSet 时会引发异常。PR #2291 (https://github.com/pgjdbc/pgjdbc/pull/2291) 修复 Issue #921 (https://github.com/pgjdbc/pgjdbc/issues/921)。如果 PgStatement 和 PgResultSet 使用各自的 TimestampUtil,则无需同步。

  • 修复:CONTRIBUTING.md 中的拼写错误 PR #2332 (https://github.com/pgjdbc/pgjdbc/pull/2332) seccion => section

PostgreSQL JDBC 团队感谢所有参与本次发布的贡献者!

JDBC 团队