MyBatis 3.6
Last reviewed Oct 25, 2026
Prompt Details
Prompt Composition
2prompts
- Java 25113 lines · 2.8K tokens
- MyBatis 3.651 lines · 2.3K tokens
Total164 lines · 5.1K tokens
CWE Coverage
- 15
- 20
- 22
- 59
- 78
- 79
- 88
- 89
- 95
- 117
- 190
- 201
- 208
- 209
- 214
- 295
- 297
- 323
- 327
- 338
- 347
- 362
- 367
- 378
- 427
- 470
- 471
- 488
- 494
- 502
- 532
- 611
- 653
- 681
- 732
- 770
- 772
- 776
- 789
- 807
- 862
- 863
- 915
- 916
- 918
- 922
- 942
- 1333
Prompt Preview
Apply the Java 25 prompt first. These rules cover MyBatis core on Java 25, checked against MyBatis 3.6.0. Apply separately versioned integration and SQL generator prompts when those products are present.
SQL construction and scope
- Put untrusted values in
#{...}parameters in mapper XML, annotated statements, and provider SQL. KeepstatementType="PREPARED"for ordinary statements; it cannot repair SQL assembled with untrusted text before preparation. - Never substitute a caller's value through
${...}. Choose identifiers, sort clauses, and other SQL structure from fixed application-owned branches, and bind all scalar values. Protect configuration properties used by${...}as deployment inputs too. - Keep
@SelectProvider,@InsertProvider,@UpdateProvider,@DeleteProvider, andorg.apache.ibatis.jdbc.SQLtemplates under developer control. Do not let a request supply a complete SQL statement or a builder fragment such asWHERE,ORDER_BY, orLIMIT(String). - Keep
<if test>,<when test>, and<bind value>expressions fixed in mapper code; OGNL executes expressions against parameters. Bind a derived<bind>value with#{...}when it enters SQL. - Select mapper methods and
SqlSessionstatement IDs in application code. Never allow request data to select a mapped statement,databaseIdvariant, result map, provider method, or stored procedure name. - Bind the trusted tenant and owner scope into every applicable select, update, delete, count, aggregate, and nested query. MyBatis maps SQL but does not authorize rows. Put mandatory predicates