Skip to content

feat: add support for MybatisPlus#102

Open
CyanM0un wants to merge 1 commit intoantgroup:mainfrom
CyanM0un:feat/mybatisplus
Open

feat: add support for MybatisPlus#102
CyanM0un wants to merge 1 commit intoantgroup:mainfrom
CyanM0un:feat/mybatisplus

Conversation

@CyanM0un
Copy link
Collaborator

No description provided.

@cursor
Copy link

cursor bot commented Jan 11, 2026

You have run out of free Bugbot PR reviews for this billing cycle. This will reset on January 27.

To receive reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @CyanM0un, 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 introduces comprehensive security rule definitions for the MybatisPlus framework. It aims to enhance the detection of SQL injection vulnerabilities by explicitly listing various MybatisPlus methods that can act as sensitive data sinks and defining a corresponding sanitizer function to prevent such attacks. This addition improves the overall security analysis capabilities for applications leveraging MybatisPlus.

Highlights

  • New MybatisPlus Rule Configuration: A new rule configuration file, rule_config_mybatis_plus.json, has been added to introduce security analysis rules specifically for the MybatisPlus framework.
  • SQL Injection Sinks Identified: Numerous methods across QueryWrapper, LambdaQueryWrapper, UpdateWrapper, LambdaUpdateWrapper, and Page classes within MybatisPlus have been identified as potential SQL injection sinks.
  • SQL Injection Sanitizer Defined: A sanitizer (SANITIZER_1) has been configured, pointing to the checkSqlInjection method in com.baomidou.mybatisplus.core.conditions.query.QueryWrapper, which is intended to mitigate SQL injection risks for most identified sinks.

🧠 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.

Using Gemini Code Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a 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 introduces a new rule configuration file to support taint analysis for the MybatisPlus framework, aiming to detect SQL injection vulnerabilities. The configuration is comprehensive, covering many potentially vulnerable methods in MybatisPlus wrappers.

My review has identified a few critical issues with the sanitizer definition that would render it ineffective for most of the defined sinks. I've also found a sink definition that is missing a link to the sanitizer. Addressing these points will significantly improve the effectiveness of this new rule set.

Comment on lines +7 to +13
{
"id": "SANITIZER_1",
"sanitizerType": "FunctionCallSanitizer",
"sanitizerScenario": "SANITIZER.CONFIG_BY_FUNCTIONCALL",
"calleeType": "com.baomidou.mybatisplus.core.conditions.query.QueryWrapper",
"fsig": "checkSqlInjection"
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

The sanitizer definition has two critical issues that make it ineffective for most sinks:

  1. Incorrect sanitizerScenario: It's set to SANITIZER.CONFIG_BY_FUNCTIONCALL, which applies to the return value of a function. The checkSqlInjection method returns void, so this sanitizer will have no effect. It should be SANITIZER.VALIDATE_BY_FUNCTIONCALL to correctly mark the arguments passed to the validation function as sanitized.

  2. Too specific calleeType: It's set to com.baomidou.mybatisplus.core.conditions.query.QueryWrapper. This prevents the sanitizer from being applied to sinks on LambdaQueryWrapper, UpdateWrapper, and LambdaUpdateWrapper. The checkSqlInjection method is defined in the superclass com.baomidou.mybatisplus.core.conditions.AbstractWrapper. Using this more general type will allow the sanitizer to apply to all relevant wrapper classes.

Suggested change
{
"id": "SANITIZER_1",
"sanitizerType": "FunctionCallSanitizer",
"sanitizerScenario": "SANITIZER.CONFIG_BY_FUNCTIONCALL",
"calleeType": "com.baomidou.mybatisplus.core.conditions.query.QueryWrapper",
"fsig": "checkSqlInjection"
}
{
"id": "SANITIZER_1",
"sanitizerType": "FunctionCallSanitizer",
"sanitizerScenario": "SANITIZER.VALIDATE_BY_FUNCTIONCALL",
"calleeType": "com.baomidou.mybatisplus.core.conditions.AbstractWrapper",
"fsig": "checkSqlInjection"
}

Comment on lines +524 to +531
{
"args": [
"0"
],
"attribute": "JavaSQLi",
"calleeType": "com.baomidou.mybatisplus.extension.plugins.pagination.Page",
"fsig": "addOrder"
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The sink definition for com.baomidou.mybatisplus.extension.plugins.pagination.Page.addOrder is missing the sanitizerIds property. This method can be a vector for SQL injection if it receives tainted input for ordering columns (e.g., via OrderItem). It should be associated with the defined sanitizer to ensure that tainted inputs are detected.

        {
          "args": [
            "0"
          ],
          "attribute": "JavaSQLi",
          "calleeType": "com.baomidou.mybatisplus.extension.plugins.pagination.Page",
          "fsig": "addOrder",
          "sanitizerIds": [
            "SANITIZER_1"
          ]
        }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant