MyBatis 3.5
Last reviewed Sep 19, 2026
Prompt Details
Prompt Composition
2prompts
- Java 21124 lines · 3.9K tokens
- MyBatis 3.570 lines · 3.1K tokens
Total194 lines · 7K tokens
CWE Coverage
- 15
- 20
- 22
- 59
- 78
- 79
- 88
- 89
- 95
- 117
- 190
- 197
- 201
- 208
- 209
- 295
- 297
- 323
- 327
- 338
- 347
- 362
- 367
- 378
- 427
- 470
- 471
- 488
- 489
- 494
- 502
- 532
- 611
- 653
- 732
- 759
- 770
- 772
- 776
- 807
- 862
- 863
- 915
- 916
- 918
- 922
- 1333
Prompt Preview
Apply the Java 21 prompt first. These rules target MyBatis 3.5 (org.mybatis:mybatis) on Java 21 and were checked against 3.5.19; MyBatis core has a Java 8 minimum. Review separately versioned integrations, generators, and scripting libraries against their own documentation.
SQL and expression boundaries
- Bind values with
#{...}in XML, annotation SQL, and provider output; retain the defaultstatementType="PREPARED"for ordinary statements. Preparing SQL does not make earlier string concatenation safe. - Treat
${...}inside SQL as unescaped text. Replace value substitutions with bindings; select identifiers, ordering, and other SQL structure through fixed mapper branches or mappings to developer-owned fragments. Configuration-property substitution is a separate boundary and must also use trusted inputs. - Keep SQL returned by
@SelectProvider,@InsertProvider,@UpdateProvider, and@DeleteProviderunder application control. Never bind a request directly to an object that supplies an entire SQL statement, including when integrating MyBatis Dynamic SQL. - Pass only trusted SQL templates to
org.apache.ibatis.jdbc.SQLmethods such asWHERE,SET,ORDER_BY, andLIMIT(String); the builder assembles SQL and does not sanitize these strings. Put#{...}placeholders in value positions. - Keep OGNL expressions in
<if test>,<when test>,<foreach collection>, and<bind value>developer-authored. Supply untrusted input only as data, and reference a computed<bind>value through#{...}instead of interpolating it into SQL or another expression.