Skip to content

sec: many security issues fix - #90

Merged
papac merged 2 commits into
3.xfrom
fix-package
Oct 3, 2026
Merged

papac merged 2 commits into
3.xfrom
fix-package

Conversation

@papac

@papac papac commented Oct 3, 2026

Copy link
Copy Markdown
Member

No description provided.

papac added 2 commits October 3, 2026 22:17
endStack() recompiled the already-rendered block buffer and getStack()
ran it back through renderString(), so any {{ }} reaching a block through
data was executed (e() escapes < > & " ' but not braces). The block body
is already compiled and executed with the page, so return the captured
output verbatim instead of compiling and rendering it a second time.

Add regression tests at the StackManager unit level and end-to-end through
a layout, asserting injected template syntax comes back as literal text.
- render()/executePlainRendering(): extract user data with EXTR_SKIP and pin
  the engine's own variables ($__tintin, the compiled path) before it, so a
  data key such as __tintin or __template can no longer overwrite the engine
  handle (DoS) or redirect which view file is required (view-selection hijack).
- createTmpFile(): use tempnam() (atomic, unique, mode 0600) in a 0700 dir
  instead of a predictable md5(microtime()) name in a shared, world-readable
  directory, closing a local symlink/TOCTOU and disclosure window.
- %json() without explicit options now defaults to
  JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_QUOT | JSON_HEX_AMP so values cannot
  break out of a <script> context (XSS).
- Filesystem::getFileResolvedPath() enforces that a resolved view path stays
  inside the configured directory (defense-in-depth against path traversal).

Add regression tests for each.
@papac
papac merged commit d8cafa2 into 3.x Oct 3, 2026
8 checks passed
@papac
papac deleted the fix-package branch October 3, 2026 22:19
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