Skip to content

fix(plugins): keep content attribution under host control - #3052

Open
logelog wants to merge 7 commits into
emdash-cms:mainfrom
logelog:fix/plugin-content-attribution
Open

fix(plugins): keep content attribution under host control#3052
logelog wants to merge 7 commits into
emdash-cms:mainfrom
logelog:fix/plugin-content-attribution

Conversation

@logelog

@logelog logelog commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

Cloudflare and Workerd plugin content creation accepted an existing author_id supplied in plugin data. Both bridges also treated primary_byline_id as a custom field, allowing plugin data to assign a byline and exposing that host column through content reads.

This PR reserves primary_byline_id alongside the other system columns and leaves author_id unset 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:write retain their existing content editing authority; this does not introduce per-author permissions or change capability checks.

Type of change

  • Bug fix
  • Feature (requires maintainer-approved Discussion)
  • Refactor (no behavior change)
  • Translation
  • Documentation
  • Performance improvement
  • Tests
  • Chore (dependencies, CI, tooling)

Checklist

  • I have read CONTRIBUTING.md.
  • pnpm typecheck passes.
  • pnpm lint passes.
  • Targeted tests pass.
  • Changed files have been formatted.
  • I have added and updated tests.
  • Admin strings are translated: not applicable; no UI changes.
  • I have added and reviewed the changeset.
  • Approved Discussion: not applicable; bug fix.
  • UI screenshots are included: not applicable.

AI-generated code disclosure

  • This PR includes AI-generated code. GPT-5.6.

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.

@changeset-bot

changeset-bot Bot commented Sep 10, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: e496bbf

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 17 packages
Name Type
@emdash-cms/cloudflare Patch
@emdash-cms/sandbox-workerd Patch
@emdash-cms/fixture-perf-site Patch
@emdash-cms/perf-demo-site Patch
@emdash-cms/cache-demo-site Patch
@emdash-cms/do-demo-site Patch
@emdash-cms/do-solo-demo-site Patch
@emdash-cms/admin Patch
@emdash-cms/auth Patch
@emdash-cms/blocks Patch
emdash Patch
create-emdash Patch
@emdash-cms/gutenberg-to-portable-text Patch
@emdash-cms/x402 Patch
@emdash-cms/auth-atproto Patch
@emdash-cms/release-service Patch
@emdash-cms/plugin-embeds Patch

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

@emdashbot emdashbot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_id to null for plugin content creation.
  • Confirmed primary_byline_id was added to each bridge's SYSTEM_COLUMNS, so it is excluded from plugin data on read and denied as a write-through field for single and batch creation.
  • Traced the calls into ContentRepository.updateDraftAware and confirmed core already filters primary_byline_id from 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/cloudflare and @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.

@github-actions github-actions Bot added the review/approved Approved; no new commits since label Sep 10, 2026
@pkg-pr-new

pkg-pr-new Bot commented Sep 10, 2026

Copy link
Copy Markdown

Open in StackBlitz

@emdash-cms/admin

npm i https://pkg.pr.new/@emdash-cms/admin@3052

@emdash-cms/auth

npm i https://pkg.pr.new/@emdash-cms/auth@3052

@emdash-cms/auth-atproto

npm i https://pkg.pr.new/@emdash-cms/auth-atproto@3052

@emdash-cms/blocks

npm i https://pkg.pr.new/@emdash-cms/blocks@3052

@emdash-cms/cloudflare

npm i https://pkg.pr.new/@emdash-cms/cloudflare@3052

@emdash-cms/contentful-to-portable-text

npm i https://pkg.pr.new/@emdash-cms/contentful-to-portable-text@3052

emdash

npm i https://pkg.pr.new/emdash@3052

create-emdash

npm i https://pkg.pr.new/create-emdash@3052

@emdash-cms/gutenberg-to-portable-text

npm i https://pkg.pr.new/@emdash-cms/gutenberg-to-portable-text@3052

@emdash-cms/plugin-cli

npm i https://pkg.pr.new/@emdash-cms/plugin-cli@3052

@emdash-cms/plugin-types

npm i https://pkg.pr.new/@emdash-cms/plugin-types@3052

@emdash-cms/registry-client

npm i https://pkg.pr.new/@emdash-cms/registry-client@3052

@emdash-cms/registry-lexicons

npm i https://pkg.pr.new/@emdash-cms/registry-lexicons@3052

@emdash-cms/registry-moderation

npm i https://pkg.pr.new/@emdash-cms/registry-moderation@3052

@emdash-cms/registry-verification

npm i https://pkg.pr.new/@emdash-cms/registry-verification@3052

@emdash-cms/sandbox-workerd

npm i https://pkg.pr.new/@emdash-cms/sandbox-workerd@3052

@emdash-cms/x402

npm i https://pkg.pr.new/@emdash-cms/x402@3052

@emdash-cms/plugin-ai-moderation

npm i https://pkg.pr.new/@emdash-cms/plugin-ai-moderation@3052

@emdash-cms/plugin-atproto

npm i https://pkg.pr.new/@emdash-cms/plugin-atproto@3052

@emdash-cms/plugin-audit-log

npm i https://pkg.pr.new/@emdash-cms/plugin-audit-log@3052

@emdash-cms/plugin-color

npm i https://pkg.pr.new/@emdash-cms/plugin-color@3052

@emdash-cms/plugin-embeds

npm i https://pkg.pr.new/@emdash-cms/plugin-embeds@3052

@emdash-cms/plugin-field-kit

npm i https://pkg.pr.new/@emdash-cms/plugin-field-kit@3052

@emdash-cms/plugin-forms

npm i https://pkg.pr.new/@emdash-cms/plugin-forms@3052

@emdash-cms/plugin-webhook-notifier

npm i https://pkg.pr.new/@emdash-cms/plugin-webhook-notifier@3052

commit: e496bbf

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant