Repository navigation
Conversation
|
Please fix conflicts. Also: we're expecting you're reviewing, testing, and editing before opening the PR. Including a statement of "never ran CI tests" doesn't make me super confident. You can run them locally with |
That's why I announced this in Discord first. I let the agents do their thing and I'm also reviewing these now and running tests. I supposed I could've marked them Drafts. |
|
@NicoPiel You can't have any merge commits in your PR with the project's linear history requirement. If you hard reset your branch to the myBatis commit before the merge (7f8f597), you can do an interactive rebase and drop the dbcp2 commit. After that you can do a clean rebase on main with only 3 commits in the PR. I wouldn't worry about the removals missing from |
439d496 to
83622e2
Compare
|
Done, thanks |
tonygermano
left a comment
There was a problem hiding this comment.
Thanks for the rebase. The code changes look good to me. My comments are mostly about the commit messages, plus one compatibility point that should go in the release notes.
Commit messages
- Bump commons-pool2 to 2.13.1: "commons-dbcp2 releases from 2.10 on need a recent pool2" no longer applies. main dropped dbcp2 in a178dfb, and this PR no longer has the dbcp2 commit. I'd remove that sentence; the age of 2.3 is reason enough.
- Bump mybatis to 3.5.19: the metadata entry for mybatis-parent 15 isn't just dropped, it's replaced by mybatis-parent 48, which is 3.5.19's parent.
- Bump mybatis to 3.5.19: "The other String and Integer parameterTypes match what their callers pass" isn't quite true.
DebugUsage.deleteDebugUsageStatisticsdeclaresjava.lang.String, butDefaultDebugUsageControllerpasses aDebugUsagebean. It still works on 3.5, because the parameter handler finds no type handler forDebugUsage, reads#{serverId}from the bean, and gets a String. So it's only an inaccurate declaration, not a bug. You could either change it tocom.mirth.connect.model.DebugUsagein the five*-debugusage.xmlmappers or reword the sentence. Either is fine with me.
Plugin SQL maps (release notes)
SqlConfig.addPluginSqlMaps loads SQL maps from installed plugins into the same MyBatis configuration. A third-party plugin whose mapper has the same mismatch as selectPreferencesForUser (a simple parameterType that differs from what the caller passes) will now get a ClassCastException at runtime instead of working. Nothing in this repo needs a change for that, but it should be called out for plugin authors in the release notes for whichever release includes this, together with the HikariCP default changes listed in the Hikari commit message.
It would also be worth mentioning in the PR description that this resolves CVE-2020-26945 / GHSA-qq48-m4jx-xqh8 (MyBatis < 3.5.6, second-level cache deserialization). cacheEnabled is true in SqlMapConfig.xml.
What Claude checked
- The sha256 of every new jar and POM in
verification-metadata.xmlmatches the artifact downloaded from Maven Central. HikariCP 7.1.0 and mybatis-parent 48 have no parent POM, and commons-parent 93 (the parent of pool2 2.13.1) already has an entry. - HikariCP 7.1.0 is Java 11 bytecode, and its only non-optional runtime dependency is slf4j-api. It's compiled against slf4j 2.0.17 but uses none of the 2.x-only API (no
org.slf4j.spi/ fluentatXxx()calls), so the slf4j 1.7.30 we ship works. commons-pool2 2.13.1 has only optional and test dependencies. - The mybatis 3.5.19 jar shades OGNL 3.4.4 and javassist 3.30.2-GA, which matches the THIRD-PARTY-README changes. The jar's own NOTICE still carries the same OGNL BSD notice the README reproduces.
- Every simple
parameterType(String/Integer) inserver/dbconfmatches its caller's argument type, except theDebugUsagecase above. The<if test='value != null'>statements (getAlert,getChannel,getCodeTemplate, and so on) still work on 3.5 with both a String and anullargument, becauseDynamicContextfalls back to the parameter object for simple types. HikariConnectionPoolcalls only setters that still exist in 7.x. InFileConnector,setTimeBetweenEvictionRunsMillis(0)still disables the evictor in pool2 2.13, which treats a non-positive duration as "no evictor".- OSV reports no known vulnerabilities for HikariCP 7.1.0, commons-pool2 2.13.1 or mybatis 3.5.19.
Drafted with Claude Code
|
@tonygermano Anything you would like me to do? I can't read any further asks out of that message. Approved? |
83622e2 to
2dae1e5
Compare
2dae1e5 to
1af9250
Compare
|
@NicoPiel Sorry for the slow answer. It's not approved yet. Thanks for the commit-message updates and the rebase. I've pushed the remaining changes to your branch as two
Please also drop the commons-pool2 commit. In 2.13, To apply it yourself: Claude also tested the squashed result at runtime, and everything passed:
Drafted with Claude Code |
8fbe423 to
60cf02f
Compare
|
Merging this also closes #381 |
jonbartels
left a comment
There was a problem hiding this comment.
I left one non-blocking comment.
jonbartels
left a comment
There was a problem hiding this comment.
The core mappers look right after this change. I checked every statement in server/dbconf/*/*.xml against its Java caller, and none still declare the wrong parameterType. What's left are upgrade-compatibility issues that need fixing or documenting before merge: plugin mappers, the HikariCP keepalive default, existing java.sql logging configs, and the OGNL license notice. Details are inline.
These checked out: HikariCP 7.1.0 works with the pinned slf4j 1.7.30 (it only calls 1.7-compatible methods), its Java 11 bytecode is fine on the Java 17 toolchain, setConnectionTimeout(0) still means wait indefinitely, and the custom TypeHandlers, BridgeDataSourceFactory, getMappedStatement's IllegalArgumentException and logPrefix all still behave the same on 3.5.19.
2.5.1 is from 2016. 7.1.0 is the current release and runs on Java 11+; it needs only slf4j-api at runtime, which the build already ships (the metrics and javassist dependencies are optional and unused here). The calls in HikariConnectionPool are unchanged in 7.x: a connectionTimeout of 0 still means wait indefinitely, and ProxyConnection.unwrap(Connection.class) still returns the driver's connection. Behavior that does change comes from upstream defaults, such as idle connections now being pinged every two minutes (keepaliveTime). Signed-off-by: Nico Piel <nicopiel@mailbox.org>
3.1.1 is from 2012. 3.5.19 is the last Java 8 release of the 3.5 line. 3.6.0 is only days old, so this stays on 3.5. OGNL and javassist are still shaded inside the mybatis jar, and nothing else is needed at runtime. The 3.5 line binds a simple parameterType's type handler from the declared type. User.selectPreferencesForUser declared java.lang.String but is called with the Integer user id, so it now declares java.lang.Integer in every database's mapper. Upstream Mirth made the same change when it moved to 3.5.15. DebugUsage.getDebugUsageStatistics and deleteDebugUsageStatistics declared java.lang.String but are called with a DebugUsage, so they now declare that class; they worked either way, because the serverId property they read is a String. The other String and Integer parameterTypes match what their callers pass. MyBatis stopped logging SQL under the java.sql loggers in 3.2 and logs each statement under its own ID instead, so the java.sql entry in log4j2.properties had no effect any more. logPrefix is now set, so every statement logs under mybatis.<namespace>.<id>, and that entry now names mybatis, so one logger still controls all SQL logging. The comments there now explain how to log a single namespace and warn that DEBUG and TRACE can write sensitive data to the logs. THIRD-PARTY-README lists the OGNL 3.4.4 and Javassist 3.30.2-GA copies bundled inside the jar. OGNL 3.4.4 is Apache 2.0, and the 2004 BSD notice stays because the MyBatis NOTICE file reproduces it. mybatis-parent 15 was only the parent of 3.1.1, so its checksum entry is replaced by mybatis-parent 48, the parent of 3.5.19. Signed-off-by: Nico Piel <nicopiel@mailbox.org> Assisted-by: Claude:claude-opus-5-5 Signed-off-by: Tony Germano <tony@germano.name>
60cf02f to
adab6dc
Compare
f7a5cc7
pacmano1
left a comment
There was a problem hiding this comment.
I know others reviewed this, but I didn't see testing with plugins or under load, which worried me a bit given how much goes through HikariCP and MyBatis. So I ran these against main on PostgreSQL 18, MySQL 8.4, and SQL Server 2025 with both jTDS and the Microsoft driver (CI's mysql job is MariaDB and its SQL Server job uses jTDS only):
- Statements per message on PostgreSQL are the same as main, 46.9 per message.
- 16 senders on a 5-connection pool: no errors beyond the deliberate ones, and all connections idle afterwards.
- Database stopped for 20 s mid-load, on all four setups: in-flight requests waited and finished, the few that were mid-transaction got a 500 on both builds, full recovery, and the same kinds of log errors as main.
- 45-minute soak at 2 messages a second on PostgreSQL and on SQL Server with jTDS: no failed messages or reads on either build while the pool retired and replaced its connections.
- A used 4.7.0 Derby database upgrades in place, and 4.7.0 still opens it afterwards.
- rbac 1.3.0, simple-channel-history 2.9.0 and oie-cache-manager 1.3.0 (which uses HikariCP directly) work unchanged.
MyBatis 3.6.0 is out, but per its release notes it has a type handler regression due to be fixed in 3.6.1, so 3.5.19 is the right pick for now.
Co-authored with Claude Code.
tonygermano
left a comment
There was a problem hiding this comment.
I won't argue over the comment that was removed from the log4j2.properties, but those core namespaces that were listed are specific to our environment, and the place where I am changing the properties as a user is exactly where I want to see what my options are and how to turn them on and off. It's quite common for linux config files to have large blocks of comment text describing each property.
I'd be happy if you dropped the 3rd commit and went back to how it was, but if not, please squash the 3rd commit into the 2nd before merging.
adab6dc
f7a5cc7 to
adab6dc
Compare
What
Bumps two stale database-layer libraries, one commit each:
This PR originally also bumped commons-dbcp2 and commons-pool2. Main has since removed the custom DBCP pooling and the dbcp2 dependency, so that commit was dropped. The pool2 commit was dropped after review: in 2.13,
GenericObjectPool.invalidateObject()always creates a replacement object, which would open an extra connection per message in File Writers with "Keep connection open" off. It can come back in its own PR together with a File connector fix.Why
MyBatis 3.1.1 dates from 2012, and HikariCP 2.5.1 from 2016. The MyBatis bump also resolves CVE-2020-26945 / GHSA-qq48-m4jx-xqh8 (MyBatis < 3.5.6, deserialization through the second-level cache), which applies here because
cacheEnabledistrueinSqlMapConfig.xml. It supersedes Renovate's MyBatis 3.5.6 security update in #381, which can be closed once this merges.Reviewer notes
parameterType.User.selectPreferencesForUserdeclaredjava.lang.Stringbut receives an Integer, so it's nowjava.lang.Integerin all 5 database mappers. This is the same fix upstream Mirth made.DebugUsage.getDebugUsageStatisticsanddeleteDebugUsageStatisticsnow declarecom.mirth.connect.model.DebugUsage, which is whatDefaultDebugUsageControllerpasses (they worked either way). Every other String and IntegerparameterTypematches its caller.java.sqlloggers, so thejava.sqlentry inlog4j2.propertieshad stopped doing anything.SqlMapConfig.xmlnow setslogPrefixtomybatis., and that entry namesmybatis, so one logger still controls all SQL logging. Its comments explain how to log one namespace and warn that DEBUG and TRACE can log PHI, stored passwords and credential hashes.#{name}bind parameters from main's event-search SQL injection fix also work under 3.5.connectionTimeout(0)still means wait forever. HikariCP 7 needs only slf4j-api, which already ships.Release Note
Library updates: MyBatis 3.5.19 and HikariCP 7.1.0
These replace MyBatis 3.1.1 and HikariCP 2.5.1. The changes below are the ones that remain in the new versions and apply to the engine.
Security
<cache>was. MyBatis 3.5.6 and later also log a one-time warning the first time a cache entry is deserialized without ajdk.serialFilterset.SQL logging
java.sqlloggers. Each statement now logs undermybatis.<namespace>.<statement ID>, for examplemybatis.Message.getMessages: SQL and parameters at DEBUG, result rows at TRACE. The defaultlog4j2.propertiesnow setslogger.sql.name = mybatis, sologger.sql.levelstill controls all SQL logging. If an upgraded installation keeps its existinglog4j2.properties, changelogger.sql.name = java.sqltologger.sql.name = mybatisthere. Raising a more specific logger, such asmybatis.Message, logs only those statements. At the default ERROR level nothing is logged, before or after. When SQL logging is enabled, the logger names in the log lines change accordingly, so update any log filters, parsers or alerts that matchjava.sql.Connection,java.sql.PreparedStatementorjava.sql.ResultSet.Database connection pool (HikariCP)
maxLifetimewith up to 25% random variation), instead of 29.25 to 30 minutes, so connections are replaced somewhat more often.0A000, and error code 1105 from any database. An error while closing a statement left open when its connection is returned now also removes the connection, with a warning in the log.PersistenceException("Error getting a new connection") caused by the driver'sSQLException, instead of aHikariPool$PoolInitializationException("Failed to initialize pool"). The server still retries as before.HikariPool-1:housekeeper. Update any log alerts or thread-dump tooling that matches the old text.For plugin authors
Plugin SQL maps and type handlers now run on MyBatis 3.5. Check for the following:
<if>,${}, and so on), a simpleparameterTypesuch asjava.lang.Stringnow fixes the type handler. Calling it with a different type, such as anInteger, fails with aPersistenceExceptioncaused by aClassCastException. MakeparameterTypematch what the plugin passes, or remove it.mybatis-3-mapper.dtd(as inhttp://mybatis.org/dtd/mybatis-3-mapper.dtd, orconf/dtd/mybatis-3-mapper.dtdas the engine's own SQL maps use; the path doesn't need to exist), not by the public ID. With any other system ID, the parser tries to load the DTD from that location, and the mapper fails to load if it can't.ResultSet.wasNull()aftergetNullableResult, so a handler that returns0orfalsefor SQL NULL now returns that value instead ofnull.Executor,ParameterHandler,ResultSetHandlerorStatementHandler.PersistenceExceptionis still the exception to catch, but its message and cause chain now contain more wrapping, such asTypeExceptionandResultMapException.Testing
buildandverifyVendoredParityon these two commits, and earlier a staged server on a fresh Derby DB driven through about 30 REST calls.GET /events/countwithout a level filter returns 500, with MyBatis 3.1.1 too.🤖 Generated with Claude Code