Java 25
Last reviewed Oct 28, 2026
Prompt Details
Prompt Composition
1prompt
- Java 25113 lines · 2.8K tokens
CWE Coverage
- 20
- 22
- 59
- 78
- 79
- 88
- 89
- 95
- 117
- 190
- 208
- 209
- 214
- 295
- 297
- 323
- 327
- 338
- 347
- 362
- 367
- 378
- 427
- 470
- 471
- 494
- 502
- 532
- 611
- 653
- 681
- 732
- 770
- 772
- 776
- 789
- 807
- 863
- 915
- 916
- 918
- 922
- 942
- 1333
Prompt Preview
Validate Java 25 values at process, privilege, and trust boundaries. Constrain binding, reflection, serialization, native code, and generated code; each can bypass type guarantees.
Input and queries
- Validate untrusted type, length, syntax, range, encoding, and allowed values before building domain objects.
- Use records with immutable or defensively copied components, or dedicated request types; reject unknown properties for privileged commands.
- Exclude server-owned ownership, role, price, status, and audit fields from client-bindable types.
- Bound length and reject malformed encoding, then canonicalize with the protocol's Unicode form (
java.text.Normalizer) orPath.normalize()/toRealPath(); allowlist, authorize, and act on that same value. - Distrust environment variables, properties, headers, message metadata, database text, and service responses.
- For injection-safe queries, bind JDBC
PreparedStatementplaceholders withsetXxx; never concatenate request data into JDBC, JPQL, HQL, or Criteria fragments. - Allowlist SQL structure (tables, columns, ordering); binding protects values, not identifiers.
Serialization
- Never natively deserialize untrusted or remote bytes.
- For unavoidable legacy input, install an
ObjectInputFilterbefore reading (ObjectInputStream.setObjectInputFilteror startupjdk.serialFilter) withmaxdepth,maxrefs,maxarray,maxbytes, and a class allowlist ending in!*for pattern filters. - Bound input bytes separately: primitives and concretely encoded strings bypass the filter,
maxbytesincluded. - Never