Skip to content

Interpolation safety check: bypassed by one explicit t(), no else on the mode switch, mode name mismatch #392

Description

@zantvoort

The runtime backstop for templates built without the compiler plugin has three gaps (storm-kotlin/src/main/kotlin/st/orm/template/TemplateString.kt):

  1. The check at :142 fires only when !autoInterpolation && !interpolateCalled. One explicit t() call sets interpolateCalled, after which every other raw interpolation in the same template passes silently: { "SELECT ${t(User::class)} FROM user WHERE name = '$name'" } concatenates $name into the SQL with no warning at any log level. Counting interpolations against t() calls would close this.
  2. The when over the mode at :152-156 has no else, so a typo'd property value silently disables the check entirely. Unknown values should fail fast.
  3. The code names the disabled mode off; docs/configuration.md names it none. Align them.

Also worth deciding: the default mode is warn, which means a missing compiler plugin turns injection into a log line. A throw default is the safer contract; if that is too breaking for this milestone, the docs should at least tell production users to set throw.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions