Proposing complete, published pages

Agents can now propose a new page with its description, tags, project and section, published on approval. What changed, and the security questions that come with it.

Until now, an agent proposing a new page through the MCP could only give a path, a title and a body. The page always arrived as a bare draft, so every new page needed a second proposal to fill in its description, tags, project and section, and a third to publish it. A second proposal can't go in the same batch, because a change can't refer to a page that doesn't exist yet.

Now a new page arrives complete in one proposal.

What changed

  • create takes the full metadata. Both create_page and the create change in propose_changes accept description, intro, tags, project, section and publish.
  • publish decides the status on approval. With publish: true the page is published the moment the proposal is approved. Without it, it's a draft as before.
  • Agents are told to prefer publishing. The tool's description asks for description, tags, project and section wherever they're known, and publish: true unless the owner wants a draft.
  • A page can be put in a notes section when it's created. createContent in src/db/ops.ts now takes a section slug and resolves it the same way an update does, including creating a project's default sections on first use. A section without a project is refused.
  • The review shows the project by name. A new page's project used to show as an id.

Tests in tests/sections.test.ts cover creating a page in a section, refusing a section without a project, and a published page with a section going through a proposal.

Security considerations

The short version: approval was already the only real gate, and it still is. What this change removes is a second, informal gate (the draft), and it makes the normal path one where approving a proposal puts something on the public site immediately. That raises the stakes of each review, not the reach of the agent token.

What hasn't changed

  • Agents still can't write. The agent token can read and propose. Approving needs the admin token or the owner's session, and tests check that an agent can't approve its own proposal, a single op, or write content directly.
  • The agent token could already ask for a published page. The proposals API validates each op against the full CreateContentInput, which has always accepted status: "published". The MCP server only limited what a well-behaved agent sends. So the MCP's options are a convenience, not a security boundary: anything the token can send to POST /api/proposals is what matters.
  • Raw HTML is dropped. The site renders markdown with raw HTML skipped, and react-markdown's default URL filter strips javascript: links, so a proposed body can't run script on the site.

What is new or sharper

  1. The draft was a free preview. A draft renders only on the local site, so you could read the page in place before it went public. With publish: true, the first time a page is rendered for real is when it's already live. Reading a markdown body in the review isn't the same as seeing the page.
  2. A new page is approved whole. An update is split into one op per field, so you can approve the title and reject the description. A createContent op isn't split: approving it accepts the body, every field and the published status together. There's no way to say "create this, but as a draft" except rejecting it.
  3. Prompt injection has a shorter path to the public site. An agent that reads a web page, an issue or a file can be steered by text in it. Before, an injected page would land as a draft and need another step. Now one careless approval publishes it. Things to look for: links whose text says one thing and whose URL says another, external images (they load on every visit and can be swapped for something else after you approve), and wording that impersonates you.
  4. Fields the MCP hides can still be proposed. Through the API directly, a proposal can set publishedAt (backdate a post so it sits deep in the feed), authors and authorship (put words in someone's name), sortOrder, or a parentId anywhere in the tree. The review shows every field of a create, so these are visible, but they're easy to skim past.
  5. The proposal's author is self-reported. author is a string the caller sends, so a review can't rely on it to know which agent or machine made a proposal. The token is the real identity, and today there's one agent token.
  6. Publishing is hard to take back fully. The feed, search engines and anyone who saw it may keep a copy after you unpublish.
  7. Batches hide things. A single proposal can hold up to 100 changes. A published page tucked into a long batch of tag fixes is easy to approve with "Approve all".

Ways to tighten it, if wanted

None of these are built. In rough order of value for effort:

  • Make publishing loud in the review. Show a clear "publishes on approval" badge on a create with status: "published", and a count of them beside "Approve all".
  • Let a create be approved as a draft. An "Approve as draft" button that applies the op with the status changed, so a page can be accepted and previewed before it goes live.
  • Preview the body with the site's renderer in the review, so what you approve is what readers will see.
  • Narrow what the agent token may set. Refuse publishedAt, authors, authorship and similar fields on agent proposals in parseOps, leaving them to the owner.
  • Flag external links and images in a proposed body, listing each host.
  • One token per agent, with the author taken from the token instead of the request, if more than one agent ever proposes.