Skip to content

Replace regex CodeValidator with Scala 3 compiler plugin allowlist - #48

Merged
noti0na1 merged 1 commit into
mainfrom
compiler-sandbox-policy
Dec 6, 2026
Merged

noti0na1 merged 1 commit into
mainfrom
compiler-sandbox-policy

Conversation

@noti0na1

@noti0na1 noti0na1 commented Dec 6, 2026

Copy link
Copy Markdown
Member

Replace the lexical CodeValidator and CatchArms with an in-process Scala 3 compiler plugin (SandboxPlugin + SandboxPolicy) and AST pre-check (SandboxPreCheck) running before posttyper:

  • Default-deny stdlib allowlist over resolved symbols, types, expression result types, imports/exports, classOf literals, and user-written annotations in both safeMode=true and safeMode=false.
  • Keep language.experimental.safe active in safeMode=true for strictMutability and SafeRefs defense-in-depth, close untracked mutable stdlib leaks (StringBuilder, collection builders, LazyList/Stream, Java streams, Matcher, RNGs, Throwable mutators), and @assumeSafe curated pure JDK/stdlib helpers (System time/lineSeparator, Base64, StandardCharsets, read-only Charset, NonFatal).
  • Enforce type-aware try/catch safety through compiler dealiasing, opaque/match/refinement/CapSet resolution, and JVM TypeErasure.erasure.
  • Update prompts, tool-output hints, docs, and replace CodeValidatorSuite with SandboxPolicySuite.

Replace the lexical CodeValidator and CatchArms with an in-process Scala 3 compiler plugin (SandboxPlugin + SandboxPolicy) and AST pre-check (SandboxPreCheck) running before posttyper:

- Default-deny stdlib allowlist over resolved symbols, types, expression result types, imports/exports, classOf literals, and user-written annotations in both safeMode=true and safeMode=false.
- Keep language.experimental.safe active in safeMode=true for strictMutability and SafeRefs defense-in-depth, close untracked mutable stdlib leaks (StringBuilder, collection builders, LazyList/Stream, Java streams, Matcher, RNGs, Throwable mutators), and @assumeSafe curated pure JDK/stdlib helpers (System time/lineSeparator, Base64, StandardCharsets, read-only Charset, NonFatal).
- Enforce type-aware try/catch safety through compiler dealiasing, opaque/match/refinement/CapSet resolution, and JVM TypeErasure.erasure.
- Update prompts, tool-output hints, docs, and replace CodeValidatorSuite with SandboxPolicySuite.
@noti0na1
noti0na1 merged commit 133e587 into main Dec 6, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant