Skip to content

0.21.0 - 2026-11-29

Latest

Choose a tag to compare

@ddon ddon released this 29 Nov 09:24
· 6 commits to main since this release

PRs #67 and #70. Requires phoenix_kit 3.5.0 or later (unchanged floor), and adds V4 of the module's migration chain: run mix phoenix_kit.update. Protected posts' files are guarded only with phoenix_kit 3.10 or later, which ships the file access guard.

Added

  • Per-post access control (#70). A post can be limited to signed-in readers, chosen roles, chosen users, a password, or secret links (one per recipient, each with a note, an end date and a Revoke button). By default any one rule is enough; "Every kind of rule must pass" asks for all of them. Every rule can end on a date. Editors always get in, and "Preview as anonymous" shows the public page as a stranger sees it. Rules are set in the editor's Access panel and saved on their own, outside the post's versions. They live in phoenix_kit_publishing_access_rules (module chain V4; a rollback leaves the table). From code: PostAccess.add_rule/3, set_password/4, create_link/3, authorize_view/2.
  • What a reader without access sees: a secret-link post gives exactly the missing-post answer; a password post shows a plain password form with nothing of the post on it; a role, user or sign-in post sends the reader to the sign-in page. A signed-in reader without the right gets the missing-post answer, or a 403 page with publishing_access_forbidden_status set to "403". Protected responses are sent Cache-Control: private, no-store, X-Robots-Tag: noindex, nofollow and Referrer-Policy: no-referrer. Typed passwords and redeemed links are kept in one encrypted cookie for publishing_access_grant_days (30 by default). Password attempts are rate-limited.
  • A protected post is left out of every public surface: listings and their pages, search and counts, feeds, tag and category archives, prev/next and related posts, the sitemap, list_published/2, category_counts/2 and [[post:…]] links. A group can instead list protected posts to the readers who may open them.
  • Group defaults. A group's edit page holds the rules every new post of the group starts with. "Apply to existing posts…" pushes them onto existing posts, after showing how many it would change; it needs at least one default rule. Group defaults need publishing.manage.
  • Files of protected posts are served only to readers who may open one of those posts, and to editors and media managers, through core's file access guard (Publishing.file_access_guard/2, phoenix_kit 3.10 or later). Protected posts render signed kit URLs. A public bucket's own URLs stay public, so use private bucket storage for confidential files.
  • The admin listing marks protected posts with a lock and can show only protected posts.

Changed

  • Public pages work under a nonce Content-Security-Policy (#67; core's guides/content-security-policy.md). The inline scripts of the public templates (reading progress, heading rail, timeline rail, the helix scroll fallback, the comment form's fetch) and their styles (plus the scrollbar and note-panel styles) carry the host's nonce, read through PhoenixKit.Modules.Publishing.Web.CSP, which feature-detects core's PhoenixKitWeb.CSP: on a core without it the pages render as before. The stylesheets inside a rendered post body (galleries, showcase, notes, dark images) carry no nonce on purpose: the body is cached and the same for every reader. They are styles only, so a strict script-src is not affected; under a strict style-src they, and inline style="…" attributes, still need 'unsafe-inline'.

Fixed

  • In a group converted to readable URLs, an old date URL no longer 301s to a protected post for a reader who could never open it.
  • A draft or scheduled post with an access rule answers as a missing post instead of showing a password form or a sign-in redirect.
  • A secret link shared before a slug rename still opens the post at its new URL.
  • file_access_guard/2 compiles without a warning on phoenix_kit 3.5 and 3.10 alike.