Scala 3.9

Last reviewed Sep 5, 2026

Export as PDF

Prompt Details

Prompt Composition

2prompts
  1. Java 25113 lines · 2.8K tokens
  2. 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 from or parse, keep the unchecked representation and constructor private, and do not expose unchecked apply, 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 treat valueOf and fromOrdinal failures as invalid input rather than server errors.
  • Keep contextual capabilities and security-sensitive given instances 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 Conversion as 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 and into modifier as an explicit