Skip to content

Publishing 0.14.0: Machine API for the Phoenix CMS and sanitised post HTML

Publishing 0.14.0 lets scripts and AI agents manage posts through PhoenixKit’s machine API, and cleans every rendered post with an allow-list, so a post body can no longer carry scripts onto your pages.

Post HTML is sanitised

Markdown in a post still accepts inline HTML. What comes out of the renderer now goes through an allow-list cleaner, for each Markdown part and again for the whole page, before it is cached or served. Scripts, on* and phx-* attributes, javascript: and data: links, srcdoc, forms, iframes and style values that could run or fetch something are removed, also inside component bodies. The module’s own components, such as <Embed>, keep the iframe and form elements they produce.

The render cache moves to a new version, so every post is rendered again after the deploy and nothing from before the cleaner is served.

Machine API tools

Twenty publishing.* admin tools are served by core’s API layer, as REST under /api/admin/v1/<tool> and over MCP at /mcp/admin, with core’s keys, scopes and rate limits. They work while Publishing is enabled and the key’s owner has the publishing permission. They cover:

  • reading groups, the group settings schema, posts and categories;
  • creating and updating posts, versions and translations, and AI translation of a post;
  • publishing, unpublishing and scheduling;
  • trashing and restoring posts and groups;
  • batch updates of categories and groups, and deleting categories.

Anything that changes what a visitor sees needs core’s confirmation step: a dry run first, then a confirmed call. The confirmed write is checked again against the current rows before it applies, including language and URL slug changes made in the meantime. On a core that cannot enforce confirmations, only the read tools and create_version are offered. Writes through the API go into the activity log with their key and request details.

Smaller fixes

  • The group edit form keeps the dependent display settings when you untick and tick their switch again, and the breadcrumb follows a rename.
  • Blank AI translations of a group name are trimmed.
  • Hashtag linking stays fast on very long posts.
  • A post-link token inside nested code or link blocks stays literal.
  • A group-name override for one dialect no longer shows for another dialect.

Upgrading

Publishing 0.14 needs PhoenixKit 2.63.0 or later; an older core does not build the package. There is no migration. If your posts rely on raw <iframe>, <form> or <script> tags in their body, those are removed from the published page now. Use the module’s components, such as <Embed>, instead.

Full release notes: Publishing 0.14.0

0.14.0 · 24 October 2026

Changed

  • Core requirement is now >= 2.63.0 and < 3.0.0 (was >= 2.38.0). 2.63.0 is the first core release with the machine API (PhoenixKit.API and its Tool, Executor, Keys, Flow and ToolLint), which the new publishing.* tools are compiled against; an older core does not build the package. No migrations.
  • Rendered post HTML is sanitised with an allow-list. Markdown still renders with inline HTML allowed, but the output now goes through Renderer.Sanitizer (MDEx.safe_html/2, ammonia) per Markdown segment and again over the assembled page, before it is cached or served. Scripts, on* / phx-* attributes, javascript: / data: URLs, srcdoc, forms, iframes and hostile style values are removed, including inside component bodies. The render cache moves to v9, so nothing rendered before the sanitiser is served. Hosts that relied on raw <iframe>, <form> or <script> in post bodies lose them. Thanks to Tymofii Shapovalov (#61, closes #60).
  • The Gettext backend is split by locale and domain, so its catalogues compile in parallel instead of in one long serial compile (#58). Lookups are unchanged.
  • ActivityLog.log_manual/6 and log_failed_mutation/6 take :activity_mode and :log_metadata options; the context functions pass them through, so API writes are logged with mode "auto" and their key and request metadata.
  • Hashtag linking is linear on large bodies: link texts and destinations are masked up to 1,000 / 2,000 characters, and each tag’s archive URL is built once per render instead of once per occurrence.
  • Dependencies refreshed to PhoenixKit 2.64.1 and phoenix_kit_ai 0.26.1.

Added

  • Machine API: 20 publishing.* admin tools served by core’s API layer (REST at /api/admin/v1/<tool>, MCP at /mcp/admin) behind its keys, scopes and rate limits, available while Publishing is enabled and the key’s owner has the publishing permission. Reads of groups, group settings schema, posts and categories; post create / update / version / translation edits; AI translate_post; publish, unpublish and schedule; trash and restore of posts and groups; batch upserts of categories and groups and category deletes. Anything that changes what a visitor sees needs core’s confirmation round trip, and a confirmed write is rechecked against the fresh rows under the post lock; on a core that cannot enforce confirmations only the reads and create_version are offered. Guide: dev_docs/guides/machine-api.md. Thanks to Tymofii Shapovalov (#59).
  • Posts.update_post/4 and the translation add path take a :locked_check hook that runs inside the transaction after the post row lock; DBStorage.list_posts_page/3 pages posts by keyset.

Fixed

  • API revisions and confirmation fingerprints include language metadata and URL slugs, so a concurrent change to them is caught before a confirmed write applies.
  • Literal post-link tokens inside nested pre / code / link regions are kept through the outer region’s closing tag instead of being resolved.
  • A sibling dialect’s group-name override no longer answers for another dialect.
  • The Edit Group form keeps dependent display settings when their toggle is unticked and ticked again, and refreshes the breadcrumb after a rename.
  • Blank AI translations of a group name are trimmed in the form binding.
  • Listing sorts break ties on uuid, and a cache_changed broadcast erases only the local listing cache instead of regenerating and broadcasting again.

Publishing 0.14.0. Install or update: {:phoenix_kit_publishing, "~> 0.14"}, then mix deps.get && mix phoenix_kit.update. Full history: CHANGELOG.