tina4-nodejs 3.13.142 → 3.13.144

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/CLAUDE.md +28 -2
  2. package/package.json +1 -1
  3. package/packages/cli/dist/bin.js +379 -85
  4. package/packages/cli/src/commands/generate.ts +7 -2
  5. package/packages/cli/src/commands/init.ts +18 -8
  6. package/packages/core/dist/index.js +377 -78
  7. package/packages/core/gallery/auth/src/routes/gallery/auth/get.ts +27 -11
  8. package/packages/core/gallery/queue/src/routes/gallery/queue/get.ts +20 -7
  9. package/packages/core/gallery/templates/src/templates/gallery_page.twig +34 -15
  10. package/packages/core/src/csp.ts +138 -0
  11. package/packages/core/src/errorOverlay.ts +80 -37
  12. package/packages/core/src/index.ts +10 -0
  13. package/packages/core/src/middleware.ts +20 -6
  14. package/packages/core/src/response.ts +14 -3
  15. package/packages/core/src/server.ts +52 -15
  16. package/packages/core/src/session.ts +154 -7
  17. package/packages/core/src/sso.ts +1 -1
  18. package/packages/core/src/types.ts +8 -0
  19. package/packages/core/templates/errors/302.twig +1 -1
  20. package/packages/core/templates/errors/401.twig +2 -2
  21. package/packages/core/templates/errors/403.twig +1 -1
  22. package/packages/core/templates/errors/404.twig +1 -1
  23. package/packages/core/templates/errors/500.twig +1 -1
  24. package/packages/core/templates/errors/502.twig +2 -2
  25. package/packages/core/templates/errors/503.twig +2 -2
  26. package/packages/core/templates/errors/base.twig +4 -1
  27. package/packages/frond/dist/index.js +2 -0
  28. package/packages/frond/src/engine.ts +23 -0
  29. package/packages/orm/dist/index.js +378 -87
  30. package/packages/swagger/dist/index.js +4 -4
  31. package/packages/swagger/src/ui.ts +7 -4
  32. package/types/core/src/csp.d.ts +42 -0
  33. package/types/core/src/index.d.ts +1 -0
  34. package/types/core/src/middleware.d.ts +6 -0
  35. package/types/core/src/session.d.ts +62 -2
  36. package/types/core/src/types.d.ts +8 -0
  37. package/types/frond/src/engine.d.ts +7 -0
package/CLAUDE.md CHANGED
@@ -13,13 +13,13 @@ Even if the skill text is not currently loaded, these are non-negotiable:
13
13
 
14
14
  The full discipline lives in `.claude/skills/tina4-maintainer/SKILL.md`; this block is the always-on floor.
15
15
 
16
- # CLAUDE.md - AI Developer Guide for tina4-nodejs (v3.13.142)
16
+ # CLAUDE.md - AI Developer Guide for tina4-nodejs (v3.13.144)
17
17
 
18
18
  > This file helps AI assistants (Claude, Copilot, Cursor, etc.) understand and work on this codebase effectively.
19
19
 
20
20
  ## What This Project Is
21
21
 
22
- Tina4 for Node.js/TypeScript v3.13.142 - The Intelligent Native Application 4ramework. A convention-over-configuration structural paradigm. The developer writes TypeScript; Tina4 is invisible infrastructure.
22
+ Tina4 for Node.js/TypeScript v3.13.144 - The Intelligent Native Application 4ramework. A convention-over-configuration structural paradigm. The developer writes TypeScript; Tina4 is invisible infrastructure.
23
23
 
24
24
  The philosophy: zero ceremony, batteries included, file system as source of truth.
25
25
 
@@ -948,6 +948,32 @@ frond.unsandbox();
948
948
  - **Raw blocks** — `{% raw %}...{% endraw %}` outputs literal template syntax.
949
949
  - **Pre-compiled regexes** + token caching (cleared on file mtime change in dev mode) for ~2.8x render improvement over the naive path.
950
950
 
951
+ ### Inline `<style>` / `<script>` under the default CSP — use `csp_nonce()` (ADR-0088)
952
+
953
+ Tina4 serves a strict default Content-Security-Policy (`default-src 'self'`). A
954
+ browser refuses any inline `<style>` or `<script>` under that policy unless the
955
+ element carries a nonce the CSP header also names. The framework mints one nonce
956
+ per response, injects `'nonce-<X>'` into `style-src` and `script-src`, and exposes
957
+ the value as the Frond global `csp_nonce()` (and as `res.cspNonce` in a route). So
958
+ a template that needs an inline block stamps the nonce on it:
959
+
960
+ ```twig
961
+ <style nonce="{{ csp_nonce() }}">.badge{color:var(--primary)}</style>
962
+ <script nonce="{{ csp_nonce() }}">console.log("ready");</script>
963
+ ```
964
+
965
+ Two rules the nonce does NOT cover, so prefer classes and `addEventListener`:
966
+ - **No `style="..."` attributes** — a nonce covers a `<style>` ELEMENT, never a
967
+ style attribute. Move inline styles into a nonce'd `<style>` block or an external
968
+ stylesheet (same-origin `'self'` is already allowed).
969
+ - **No inline `onclick=` / `on*=` handlers** — bind them in a nonce'd `<script>`
970
+ with `addEventListener` instead.
971
+
972
+ An external `<script src="...">` or `<link rel="stylesheet">` needs no nonce
973
+ (same-origin `'self'` already allows it). A **static** HTML file cannot carry a
974
+ per-response nonce, so keep static pages free of inline blocks (use an external
975
+ stylesheet); render a page that needs an inline block through a Frond template.
976
+
951
977
  ## Module: Api (`packages/core/src/api.ts`)
952
978
 
953
979
  Zero-dep HTTP client over `node:http` / `node:https`. Used by integrations, queue producers, health checks, and tests.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tina4-nodejs",
3
- "version": "3.13.142",
3
+ "version": "3.13.144",
4
4
  "type": "module",
5
5
  "description": "Tina4 for Node.js/TypeScript - native TypeScript conventions and shared Tina4 contracts",
6
6
  "keywords": [