Scala 3.9
Last reviewed Sep 5, 2026
Prompt Details
Prompt Composition
2prompts
- Java 25113 lines · 2.8K tokens
- Scala 3.970 lines · 2.7K tokens
Total183 lines · 5.5K tokens
CWE Coverage
- 20
- 22
- 59
- 78
- 79
- 88
- 89
- 95
- 117
- 190
- 201
- 208
- 209
- 214
- 295
- 297
- 306
- 323
- 327
- 338
- 347
- 362
- 367
- 378
- 427
- 470
- 471
- 476
- 494
- 502
- 532
- 611
- 653
- 674
- 681
- 732
- 749
- 770
- 772
- 776
- 789
- 807
- 829
- 863
- 915
- 916
- 918
- 922
- 942
- 1333
Prompt Preview
Apply the Java 25 prompt first. These rules cover Scala 3.9 LTS on the JVM, including its type-system escape hatches, implicit conversions, metaprogramming, concurrency, process APIs, and build inputs, and were checked against 3.9.0.
Validated types and authority
- Parse and validate external values before constructing case classes, enums, opaque types, or authorization objects; a Scala type proves only how a value was constructed in the paths you control.
- Give security-sensitive opaque types a validating smart constructor such as
fromorparse, keep the unchecked representation and constructor private, and do not expose uncheckedapply,copy, or conversion paths that recreate invalid values. - Model closed authorization states with enums or sealed hierarchies and make privileged matches exhaustive; do not let
_,@unchecked,asInstanceOf, or a default allow branch hide a newly added case. - Parse enum names through an explicit external-to-domain mapping. Do not persist or authorize by
ordinal, and treatvalueOfandfromOrdinalfailures as invalid input rather than server errors. - Keep contextual capabilities and security-sensitive
giveninstances in the narrowest scope. Do not make tenant, identity, clock, key, or policy selection depend on an ambient instance that untrusted code can replace. - Review every
Conversionas executable code. A conversion must not validate by assertion, perform I/O, acquire authority, or silently turn untrusted data into a trusted domain type. - Treat Scala 3.9's
into[T]type andintomodifier as an explicit