Forma

Forma 0.6.0: the audit release

Scheduled posts, safer redirects, an Agent API that does not leak SQL — and, in 0.6.4, writes that get past a host firewall without turning it off.

Forma 0.6.0 is out. It's the result of reading every line of the codebase in one sitting and fixing what that turned up — thirty-six files, no new tables, and one feature that fell out almost for free. Existing sites update from Settings → Forma core; nothing in database/, uploads/, or your .htaccess is touched. We verified that by seeding a real 0.5.2 install, running the old updater against the new zip, and checking that every page, post, redirect, token, edited snippet, and the admin session survived — then rolling back and doing it again.

Scheduled posts, finally

Give a post a date in the future and it used to just… sit there as a 404 until someone re-saved it. Forma has no cron and we weren't going to add one. Instead the publish check now rides on two requests that already happen: the /up heartbeat and any hit on /blog. When one of those arrives after the scheduled time, the post is rendered to the HTML cache, added to the archive, indexed for search, and pushed into the feeds — all in that request. Point an uptime monitor at /up (you should anyway) and scheduled posts land within a few minutes of their time.

Things that were quietly wrong

  • /podcast/ with a trailing slash didn't route. /podcast did.
  • The internal template pages — blog-single, search-page, _404 and friends — answered as real URLs. They're editable like any page, but they're not pages. Now they 404 by filename and never get indexed or published as standalone HTML. Error pages also send their real status code instead of a 200 that looked like a 404.
  • Search excerpts were pulling from the wrong FTS column, so the highlighted snippet was often the title repeated.
  • An SEO-only PUT /api/v1/pages/{file} — just {"seo": {...}} — blanked the page content. If an agent did that to you, this is why.
  • A redirect could point at its own source. Apache would then loop until the browser gave up. Rejected on save now, for relative paths and for absolute URLs on your own host.
  • Redirects created through the API defaulted to disabled unless you remembered enabled: true. The admin form always sent the flag; API callers mostly didn't. Omitting it now means on.
  • <!--META--> values weren't sanitized, so a title containing --> could end the block early.
  • RSS put author names in <author>, which per spec must be an email address, so validators complained. It's <dc:creator> with the proper namespace now, and excerpts no longer split a multibyte character.

Security tightening

  • settings/security was reachable through the Agent API with settings:write. It isn't any more, in either direction — that section is Settings → Access only.
  • API and MCP errors used to pass exception messages straight through, which meant a SQL error could land in a 400 body. Now: validation problems come back as plain-English 400s; database and unexpected errors are a generic 500 with the detail in the server log.
  • Logout needs a CSRF token. A <img src="/admin/logout.php"> on a random page can't sign you out.
  • isLocalRequest() only trusts loopback, not any RFC-1918 address.
  • The updater aborts an oversized download mid-stream instead of checking after the disk is full, and Undo last update now resets OPcache the same way the update does (found during the upgrade test — a host with a long revalidate window could serve a mixed tree for a while after rollback).
  • Importing a site package takes a VACUUM INTO backup first and swaps tables in one transaction, the same strategy the agent rollback uses. The hardcoded license-secret path is gone; use FORMA_LICENSE_SECRET_FILE if you keep the secret outside the web root.

Smaller, faster

  • initSchema() ran its full CREATE/ALTER/seed pass on every single request. It now runs once, when the PRAGMA user_version stamp doesn't match.
  • The red admin nag bar (default password, world-writable dirs) bcrypt-verified every user on every admin page load. Cached per session for five minutes; changing your password or fixing permissions refreshes it immediately.
  • A daily housekeeping pass, also riding on /up, prunes API audit rows older than 90 days, stale login attempts, and expired OAuth access tokens. Those tables grew forever before.
  • faq-ui joined the stock snippets that can't be deleted; search-ui now loads the same htmx 2.0.4 the admin uses (new installs — your edited copy is left alone).

For people who read the code

Three new documents in the repo: ARCHITECTURE.md (request lifecycle, class map, data model, what a save triggers), TESTING.md (lint, disposable install, and the upgrade simulation we ran before shipping this), and a CHANGELOG.md going back to 0.1. AGENTS.md — the file connected AI tools read first — picked up the new behaviours too.

What followed the same night

0.6.0 was not the last tag that evening.

  • 0.6.1 – 0.6.3. Sites updating from before 0.6.0 still had old HTML files for template pages (/blog-single, /404, and the rest). Apache served those as 200. Rebuild HTML cache now deletes them, and a template row answers 404 even if an older save had given it a public slug.
  • 0.6.4. Host firewalls were rejecting chatbot and API writes that contained HTML or JavaScript, before PHP ever saw the request (HTTP 418). Forma now keeps that markup off the raw body: the admin and Cursor send a base64 envelope, and connected chatbots send the document as content_b64. You do not have to turn the firewall off.

The full list is the changelog. If something looks off after you update, Undo last update is on the same screen.