Skip to content

Fix: Require publishing capability for Bluesky comment replies#198

Merged
pfefferle merged 4 commits into
trunkfrom
fix/comment-crosspost-consent
Jul 15, 2026
Merged

Fix: Require publishing capability for Bluesky comment replies#198
pfefferle merged 4 commits into
trunkfrom
fix/comment-crosspost-consent

Conversation

@pfefferle

Copy link
Copy Markdown
Member

Fixes #196

Proposed changes:

  • WordPress account registration currently lets Subscriber comments be republished through the site-connected Bluesky account, even though Subscribers cannot publish site content.
  • Require the comment author to have the current publish_posts capability before scheduling or executing an outbound reply. This uses the stored author ID so the check remains valid in WP-Cron.
  • Preserve the existing filter override and all other comment eligibility checks.
  • Update public and developer documentation so it no longer says every logged-in reader comment is cross-posted.

Other information:

  • Have you written new tests for your changes, if applicable?
  • No visual changes; screenshots are not applicable.

Testing instructions:

  • Run composer lint.
  • Run npm run env-test.
  • For the focused regression coverage, run npm run env-test -- --filter="test_(eligible_author|subscriber_comment|publish_comment_cron_rechecks_author_capability)".
  • Confirm the focused tests show that Author comments remain eligible, Subscriber comments do not schedule an outbound publish, and a queued comment is not written after its author is downgraded to Subscriber.

Changelog entry

  • Automatically create a changelog entry from the details below.
Changelog Entry Details

Significance

  • Patch
  • Minor
  • Major

Type

  • Added - for new features
  • Changed - for changes in existing functionality
  • Deprecated - for soon-to-be removed features
  • Removed - for now removed features
  • Fixed - for any bug fixes
  • Security - in case of vulnerabilities

Message

A manual changelog entry is included in .github/changelog/fix-comment-publishing-capability.

Registered Subscribers and comment-only accounts are no longer treated as authorized to publish through the site-connected Bluesky account. Eligibility now follows the comment author's current publish_posts capability, including at cron execution time.

Fixes #196.
Copilot AI review requested due to automatic review settings July 14, 2026 21:01
@pfefferle pfefferle self-assigned this Jul 14, 2026
@pfefferle
pfefferle requested a review from a team July 14, 2026 21:01
@github-actions github-actions Bot added [Feature] Transformer AT Protocol record transformers [Tests] Includes Tests PR includes test changes Docs labels Jul 14, 2026

Copilot AI 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.

Pull request overview

This PR fixes a privilege escalation path where comments from Subscriber accounts (or other comment-only users) could be cross-posted as Bluesky replies via the site-connected account. It tightens outbound comment eligibility by requiring the comment author to have the publish_posts capability at both scheduling time and WP-Cron execution time, while keeping the existing atmosphere_should_publish_comment filter override.

Changes:

  • Gate outbound comment publishing on \user_can( $comment->user_id, 'publish_posts' ) (in addition to requiring a registered user ID).
  • Add regression tests covering Subscriber exclusion and cron-time capability rechecks after a role downgrade.
  • Update user-facing and developer documentation to reflect the new “publishing-capable users only” behavior.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
includes/class-atmosphere.php Adds an author capability check (publish_posts) to the core outbound comment eligibility gate.
tests/phpunit/tests/class-test-atmosphere.php Updates comment-fixture user creation to use an Author role; adds tests for Subscriber exclusion and cron-time recheck after role downgrade.
includes/transformer/class-comment.php Updates transformer docblock to match the new eligibility rule.
readme.txt Updates public readme language to clarify only publishing-capable users’ comments are mirrored to Bluesky.
docs/developer-docs.md Clarifies the atmosphere_should_publish_comment filter applies to comments from users allowed to publish posts.
.github/changelog/fix-comment-publishing-capability Adds a changelog entry describing the behavior change.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread tests/phpunit/tests/class-test-atmosphere.php

@jeherve jeherve left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This looks good to me, let's merge!

@pfefferle
pfefferle merged commit 7fe54b9 into trunk Jul 15, 2026
8 checks passed
@pfefferle
pfefferle deleted the fix/comment-crosspost-consent branch July 15, 2026 16:45
jeherve added a commit that referenced this pull request Jul 15, 2026
Brings in #199 (controls for publishing WordPress comments to Bluesky)
and #198 (require publishing capability for comment replies).

Resolve the docs/developer-docs.md hooks-table conflict (keep the
connection-only/settings-page rows, take trunk's updated
atmosphere_should_publish_comment wording) and extend connection-only
mode to the newly merged outgoing lane: is_comment_publishing_enabled()
is now forced off in connection-only mode, with its
atmosphere_should_publish_comments filter still the final say. Because
#199 already re-checks that helper at every layer (direct Publisher
calls, the publish-comment cron, on_before_delete cleanup, chunked
delete_post_by_tids), the single force-off closes the outgoing-comment
gap everywhere. Adds regression tests and updates the docs.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Docs [Feature] Transformer AT Protocol record transformers [Tests] Includes Tests PR includes test changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Do not cross-post comments from users without publishing capabilities

3 participants