fix(plugins): keep content attribution under host control - #3052
Conversation
🦋 Changeset detectedLatest commit: e496bbf The changes in this PR will be included in the next version bump. This PR includes changesets to release 17 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
There was a problem hiding this comment.
This is the right fix for the described problem. Plugin-created content should not be able to override attribution columns (author_id, primary_byline_id), and plugin reads should not leak those host columns through the data envelope. The implementation is consistent across both Cloudflare and Workerd sandboxes.
What I checked:
- Reviewed the diff and the full changed source files.
- Verified that both bridges now hard-code
author_idtonullfor plugin content creation. - Confirmed
primary_byline_idwas added to each bridge'sSYSTEM_COLUMNS, so it is excluded from plugindataon read and denied as a write-through field for single and batch creation. - Traced the calls into
ContentRepository.updateDraftAwareand confirmed core already filtersprimary_byline_idfrom writable data. - Checked the test helper for dual SQLite/PostgreSQL coverage and the D1-specific test for the Cloudflare bridge.
- Verified the changeset targets the correct published packages (
@emdash-cms/cloudflareand@emdash-cms/sandbox-workerd) and describes the user-visible behavior clearly.
No logic bugs, regressions, or AGENTS.md convention violations were found. The tests exercise the vulnerable paths (single create, batch create, read, list, draft update, and host publication), and the code is clean.
@emdash-cms/admin
@emdash-cms/auth
@emdash-cms/auth-atproto
@emdash-cms/blocks
@emdash-cms/cloudflare
@emdash-cms/contentful-to-portable-text
emdash
create-emdash
@emdash-cms/gutenberg-to-portable-text
@emdash-cms/plugin-cli
@emdash-cms/plugin-types
@emdash-cms/registry-client
@emdash-cms/registry-lexicons
@emdash-cms/registry-moderation
@emdash-cms/registry-verification
@emdash-cms/sandbox-workerd
@emdash-cms/x402
@emdash-cms/plugin-ai-moderation
@emdash-cms/plugin-atproto
@emdash-cms/plugin-audit-log
@emdash-cms/plugin-color
@emdash-cms/plugin-embeds
@emdash-cms/plugin-field-kit
@emdash-cms/plugin-forms
@emdash-cms/plugin-webhook-notifier
commit: |
What does this PR do?
Cloudflare and Workerd plugin content creation accepted an existing
author_idsupplied in plugin data. Both bridges also treatedprimary_byline_idas a custom field, allowing plugin data to assign a byline and exposing that host column through content reads.This PR reserves
primary_byline_idalongside the other system columns and leavesauthor_idunset for plugin-created content. Creation ignores those attribution inputs, including Workerd batch creation, and reads keep the byline column out of custom data. Existing host attribution remains intact through draft updates and publication.The change protects attribution integrity within the existing content API. Plugins with
content:writeretain their existing content editing authority; this does not introduce per-author permissions or change capability checks.Type of change
Checklist
pnpm typecheckpasses.pnpm lintpasses.AI-generated code disclosure
Screenshots / test output
Not applicable; no UI changes. Coverage uses migrated SQLite, PostgreSQL and D1 schemas with existing user/byline records and persisted create, read and update results.