Procházet zdrojové kódy

Document the trusted-authoring contract for stm-* attribute expressions

SA-18 follow-up: expressions compile via new Function in statum.js, so they are trusted template authoring; never bind user data into expression source. No shipped component does.
saddle-Clanker-Saddle před 4 týdny
rodič
revize
3d1c1f7f48
1 změnil soubory, kde provedl 12 přidání a 0 odebrání
  1. 12 0
      getting-started.md

+ 12 - 0
getting-started.md

@@ -170,6 +170,18 @@ statum-genkeys --out web-config.json
 
 which writes the full config at mode 0600 and prints only the public halves.
 
+### Attribute expressions are trusted authoring (SA-18)
+
+`stm-*` attribute values are compiled with `new Function('scope',
+'with (scope) { … }')` in `statum.js`. That makes them **trusted template
+authoring**, on exactly the same footing as server-side page markup: never
+build an expression string from user-supplied data (request bodies, slot
+values, URL parameters) — interpolate user data only as *values* the
+expression reads (`stm-text` → `textContent`, `stm-html` → the escaped HTML
+path, `stm-markdown` → the CommonMark renderer). Today no shipped component
+binds user data into expression *source*; keeping it that way is a page
+author's contract, not a runtime guarantee.
+
 ---
 
 ## HTML Templates