Scala 3.3
Last reviewed Sep 5, 2026
Prompt Details
Prompt Composition
2prompts
- Java 21124 lines · 3.9K tokens
- Scala 3.349 lines · 1.3K tokens
Total173 lines · 5.1K tokens
CWE Coverage
- 20
- 22
- 59
- 78
- 79
- 88
- 89
- 95
- 117
- 190
- 197
- 201
- 208
- 209
- 295
- 297
- 306
- 323
- 327
- 338
- 347
- 362
- 367
- 378
- 427
- 470
- 471
- 476
- 488
- 489
- 494
- 502
- 532
- 611
- 653
- 674
- 681
- 732
- 749
- 759
- 770
- 772
- 776
- 807
- 862
- 863
- 915
- 916
- 918
- 922
- 1333
Prompt Preview
Apply the Java 21 prompt first. These rules cover Scala 3.3 LTS types, metaprogramming, Java interop, concurrency, parsing, and artifacts, and were checked against 3.3.7.
Types and domain state
- Model trusted identities, validated input, money, paths, and authorization decisions as distinct opaque or value types.
- Use enums and sealed hierarchies for closed states and handle every case explicitly.
- Avoid
null, unsafe casts, structural reflection, and unchecked match assumptions at trust boundaries. - Do not expose constructors or
copypaths that let callers create an invalid security-sensitive value.
Parsing and dynamic behavior
- Parse external data with schema-aware decoders and reject unknown fields, duplicates, excessive nesting, and invalid variants.
- Never compile, interpret, reflectively load, or interpolate attacker-controlled Scala source or expressions.
- Treat standard
s,f, andrawinterpolation as formatting, not escaping, and use context-specific parameter APIs for SQL, HTML, shell, and logs. - Bound collection builders, lazy views, streams, regex work, recursion, and numeric conversions driven by external data.
Metaprogramming and serialization
- Treat macros, inline code, compiler plugins, quoted expressions, TASTy files, and annotation processors as trusted build inputs.
- Pin and isolate tools that inspect TASTy or Scaladoc input, enforcing CPU, memory, and wall-clock limits; never compile or inspect attacker-supplied artifacts in a privileged build or runtime process.
- Treat Scaladoc output from untrusted comments as active