T12

Error

Types

T12 — A secret where it would escape

A Secret shown by an element, spliced into text, logged or kept with persist.

What the compiler said

error[T12]: `token` is a `Secret`, and `Text` would show it --> src/App.wf:4:10 | 4 | Text(token) | ^^^^^ = help: A secret must not reach the page; send it as a value, or show one field of what it unlocks = docs: https://webfluent.monzeromer.dev/errors/T12

The fix

Broken

wf

page P(path: "/", title: "T", description: "D") { state token: Secret = "" Heading("Token").h1 Text(token) }

Fixed

wf

type Session { token: Secret } api Auth(base: "/api") { post signIn(body: Session) at "session" -> ! } page P(path: "/", title: "T", description: "D") { state token: Secret = "" Heading("Token").h1 Button("Sign in") { on click { Auth.signIn(body: Session(token: token)) } } }

Do not show, splice, log or persist a Secret. Send it in a request — or keep it on the server.

Each example is a whole program: it is all of src/App.wf in a project with no other .wf file (trying an example).

lints cannot lower it: it would ship a broken page.