Skip to content

feat(cli): the api group checks a key by a field's value, as WordPress publishes by status - #3113

Merged
leemour merged 2 commits into
mainfrom
feat/permission-values
Nov 18, 2026
Merged

leemour merged 2 commits into
mainfrom
feat/permission-values

Conversation

@leemour

@leemour leemour commented Nov 18, 2026

Copy link
Copy Markdown
Member

Task

C3 of the content category, cli-core half: the raw api group checks a permission key by a field's value, so a WordPress CLI cannot publish past a profile that denies posts.publish.

Why

Until now a manifest key applied always, or when a flag was true. A WordPress post is published by status: "publish", which no flag expresses. cli-base 0.118.0 (#647) writes such keys as values. This makes the api group honour them. An older cli-core would ask for the key on every call, drafts included.

What

  • applies in src/cli/service-api.ts also matches when the JSON body or the query holds one of a key's values. Both count, because WordPress reads a parameter from either.
    • An HTTP call takes no body field as a flag (api-http.ts:84). GraphQL flags are merged into the body before the check. So the body and the query are every way an api call carries the field.
    • Only declared parameters become options, so WordPress's _method override can't be sent.
  • --dry-run and discovery show the key with status publish or future.
  • cli-base 0.118.0, peer range raised to it.

Testing

  • New test: the key is refused for status publish and future in the body, and for publish in the query. A draft is sent unchanged. alsoChecks shows the condition.
    • Checked that the test fails on the old applies, which asked for the key on the draft too.
  • src/cli (2,789 tests) passed on a packed build of this cli-base. service-api, profile-site, manifest and crm/manifest passed again on 0.118.0 from npm. Typecheck, lint and docs check pass.
  • A fresh review found no bug in this code. It names two WordPress behaviours for the pilot to handle in its manifest: a scheduled post whose date is moved into the past gets published, and /batch/v1 nests calls that this top-level check doesn't see. Both are noted in the plan's journal.

🤖 Generated with Claude Code

leemour and others added 2 commits November 18, 2026 11:47
…s publishes by status

A manifest permission with values (cli-base's permissions.valueKeys) applies when the JSON body or the query holds
one of them: posts.publish before a post whose status is publish or future, and none for a draft. Both places count,
as WordPress reads a parameter from either; an HTTP call takes no body field as a flag, so these two are every way to
send it. --dry-run and discovery show the key "with status publish or future".

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@leemour
leemour merged commit bdcffe8 into main Nov 18, 2026
46 of 49 checks passed
@leemour
leemour deleted the feat/permission-values branch November 18, 2026 11:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant