-
Notifications
You must be signed in to change notification settings - Fork 5k
Chore(JDBC): fix jdbc demo vulnerabilities #34514
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Summary of ChangesHello @sheyanjie-qq, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request modernizes and secures the existing JDBC examples by upgrading their Java versions and associated library dependencies. It also introduces a new AI guidance document for code assistants and enhances the MyBatis-Plus example with a performance-optimized batch writer. These changes aim to improve the overall reliability, security, and developer experience for users working with TDengine's JDBC connectors. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request primarily focuses on upgrading Java-based JDBC examples to support JDK 17 and Spring Boot 3, involving extensive dependency updates across multiple pom.xml files. Key changes include updating java.version, maven.compiler.source, and maven.compiler.target to 17, along with upgrading various Spring, MyBatis-Plus, connection pool (Druid, HikariCP, DBCP), logging (Log4j, Logback), and other utility library versions. The CLAUDE.md file was added to provide comprehensive guidance for Claude Code on the repository's build system, architecture, and development workflow, though it includes a personal JDK note that should be removed. A new CachedBatchWriter component was introduced in the mybatisplus-demo for high-performance batch writes, but its PreparedStatement caching strategy is flagged as potentially problematic for dynamic SQL and connection management. Additionally, a generated runtime-deps.txt file was added, which should be removed from version control. Review comments highlight issues such as invalid Spring Boot parent versions, incorrect Jakarta EE imports, version mismatches in Spring dependencies, an unexplained downgrade of mybatis-plus-bom, and silent exception handling in the CachedBatchWriter's cleanup logic.
.../mybatisplus-demo/src/main/java/com/taosdata/example/mybatisplusdemo/config/DruidConfig.java
Outdated
Show resolved
Hide resolved
...plus-demo/src/main/java/com/taosdata/example/mybatisplusdemo/provider/CachedBatchWriter.java
Show resolved
Hide resolved
...plus-demo/src/main/java/com/taosdata/example/mybatisplusdemo/provider/CachedBatchWriter.java
Outdated
Show resolved
Hide resolved
...plus-demo/src/main/java/com/taosdata/example/mybatisplusdemo/provider/CachedBatchWriter.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR addresses security vulnerabilities in JDBC demo applications by upgrading to modern, secure dependency versions and migrating from Java 8 to Java 17. The changes include upgrading Spring Boot from 2.7.x to 3.5.5, replacing vulnerable fastjson with fastjson2, updating connection pools, logging frameworks, and other dependencies to their latest secure versions. New comprehensive test coverage has been added for springbootdemo and mybatisplus-demo modules, and a new CachedBatchWriter utility class has been introduced for high-performance batch operations.
Changes:
- Upgraded all JDBC example projects from Java 8 to Java 17
- Updated Spring Boot to 3.5.5 and Spring Framework to 6.x across all examples
- Replaced fastjson (vulnerable) with fastjson2 for security
- Updated critical dependencies: HikariCP (5.1.0), log4j (2.25.3), Druid (1.2.23), junit (4.13.2), and others
- Added comprehensive test suites for springbootdemo and mybatisplus-demo
- Introduced CachedBatchWriter for optimized batch insertions
Reviewed changes
Copilot reviewed 31 out of 31 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| docs/zh/14-reference/05-connector/14-java.mdx | Updated documentation to reference JDK17 and JDK8 examples separately |
| docs/en/14-reference/05-connector/14-java.md | Updated English documentation with example references |
| docs/examples/java/pom.xml | Updated taos-jdbcdriver to 3.8.1 |
| docs/examples/JDBC/taosdemo/pom.xml | Upgraded to Spring 6.2.11, HikariCP 5.1.0, fastjson2 2.0.54, log4j 2.25.3, and Java 17 |
| docs/examples/JDBC/taosdemo/src/main/java/com/taosdata/taosdemo/components/JsonConfig.java | Migrated from fastjson to fastjson2 |
| docs/examples/JDBC/springbootdemo/pom.xml | Upgraded to Spring Boot 3.5.5, mybatis-spring-boot-starter 3.0.4, Druid 1.2.23, and Java 17 |
| docs/examples/JDBC/springbootdemo/src/main/java/com/taosdata/example/springbootdemo/service/WeatherService.java | Fixed missing timestamp in save() method |
| docs/examples/JDBC/springbootdemo/src/main/java/com/taosdata/example/springbootdemo/dao/WeatherMapper.xml | Added createTable method for proper table creation |
| docs/examples/JDBC/springbootdemo/src/main/resources/application.properties | Fixed mybatis mapper location configuration |
| docs/examples/JDBC/springbootdemo/src/test/* | Added comprehensive test coverage for WeatherService and WeatherMapper |
| docs/examples/JDBC/mybatisplus-demo/pom.xml | Upgraded to Spring Boot 3.5.5, mybatis-plus 3.5.7, Druid 1.2.23, and Java 17 |
| docs/examples/JDBC/mybatisplus-demo/src/main/java/com/taosdata/example/mybatisplusdemo/provider/CachedBatchWriter.java | New utility class for high-performance cached batch writes |
| docs/examples/JDBC/mybatisplus-demo/src/main/java/com/taosdata/example/mybatisplusdemo/config/DruidConfig.java | Added explicit Druid DataSource configuration |
| docs/examples/JDBC/mybatisplus-demo/src/main/java/com/taosdata/example/mybatisplusdemo/config/MybatisPlusConfig.java | Removed redundant @MapperScan annotation |
| docs/examples/JDBC/mybatisplus-demo/src/main/resources/application.yml | Updated Druid pool configuration and added mapper locations |
| docs/examples/JDBC/mybatisplus-demo/src/main/resources/mapper/MetersMapper.xml | Added mapper XML file with documentation |
| docs/examples/JDBC/mybatisplus-demo/src/test/* | Added test coverage for CachedBatchWriter and MetersMapper |
| docs/examples/JDBC/highvolume/pom.xml | Upgraded to Java 17, replaced lz4-java dependency, updated commons-cli and logback |
| docs/examples/JDBC/consumer-demo/pom.xml | Upgraded to Java 17 |
| docs/examples/JDBC/connectionPools/pom.xml | Upgraded to Java 17, commons-dbcp2 2.12.0, HikariCP 5.1.0, Druid 1.2.23, c3p0 0.10.1, log4j 2.25.3 |
| docs/examples/JDBC/connectionPools/src/main/java/com/taosdata/example/pool/DbcpBuilder.java | Updated to use commons-dbcp2 API (setMaxTotal instead of setMaxActive) |
| docs/examples/JDBC/SpringJdbcTemplate/pom.xml | Upgraded to Java 17, Spring 6.x, and junit 4.13.2 |
| docs/examples/JDBC/JDBCDemo/pom.xml | Upgraded to Java 17 and jts-core 1.20.0 |
| docs/examples/JDBC/JDBCDemo/src/main/java/com/taosdata/example/JdbcDemo.java | Removed unused import |
| CLAUDE.md | Added project documentation for AI assistance |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
...plus-demo/src/main/java/com/taosdata/example/mybatisplusdemo/provider/CachedBatchWriter.java
Outdated
Show resolved
Hide resolved
...plus-demo/src/main/java/com/taosdata/example/mybatisplusdemo/provider/CachedBatchWriter.java
Show resolved
Hide resolved
.../mybatisplus-demo/src/main/java/com/taosdata/example/mybatisplusdemo/config/DruidConfig.java
Outdated
Show resolved
Hide resolved
78c28eb to
d013165
Compare
d013165 to
fcf1b68
Compare
Description
fix jdbc demo vulnerabilities
Issue(s)
Checklist
Please check the items in the checklist if applicable.