Skip to content

JETPACK-1446: Fix issue in newsletter email sent status endpoint#47778

Merged
kraftbj merged 6 commits intotrunkfrom
copilot/find-07-fix-email-status-access-control
Mar 25, 2026
Merged

JETPACK-1446: Fix issue in newsletter email sent status endpoint#47778
kraftbj merged 6 commits intotrunkfrom
copilot/find-07-fix-email-status-access-control

Conversation

Copy link
Contributor

Copilot AI commented Mar 25, 2026

Fixes JETPACK-1446

Proposed changes

  • Harden access control on the newsletter email sent status REST endpoint by adding per-post permission checks.
  • Add tests for the new permission logic.

Other information

  • Generate changelog entries for this PR (using AI).

Related product discussion/links

Does this pull request change what data or activity we track or use?

No.

Testing instructions

  • Create two editor users and a published post owned by editor A.
  • As editor B, request GET /wpcom/v2/newsletter-email-sent-status?post_id=<post_id>. Verify a 403 response.
  • As editor A (the post author), make the same request. Verify a 200 response.
  • As an admin, request the status for editor A's post. Verify a 200 response.
  • As a subscriber, request any post. Verify a 403 response.

…post access control

Co-authored-by: kraftbj <88897+kraftbj@users.noreply.github.com>
Agent-Logs-Url: https://github.com/Automattic/jetpack/sessions/b7739a75-869f-4352-9818-0bcab253ce19
Copilot AI changed the title [WIP] Fix newsletter email status endpoint access control JETPACK-1446: Fix IDOR in newsletter email sent status endpoint Mar 25, 2026
Copilot AI requested a review from kraftbj March 25, 2026 16:52
Copilot AI and others added 2 commits March 25, 2026 17:05
Add tests verifying editors cannot access other authors' posts, admins
can access any post, and post authors can access their own. Add
defensive comment on the post_id > 0 guard.
…hub.com:Automattic/jetpack into copilot/find-07-fix-email-status-access-control
@github-actions
Copy link
Contributor

github-actions bot commented Mar 25, 2026

Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.

  • To test on WoA, go to the Plugins menu on a WoA dev site. Click on the "Upload" button and follow the upgrade flow to be able to upload, install, and activate the Jetpack Beta plugin. Once the plugin is active, go to Jetpack > Jetpack Beta, select your plugin (Jetpack), and enable the copilot/find-07-fix-email-status-access-control branch.
  • To test on Simple, run the following command on your sandbox:
bin/jetpack-downloader test jetpack copilot/find-07-fix-email-status-access-control

Interested in more tips and information?

  • In your local development environment, use the jetpack rsync command to sync your changes to a WoA dev blog.
  • Read more about our development workflow here: PCYsg-eg0-p2
  • Figure out when your changes will be shipped to customers here: PCYsg-eg5-p2

@github-actions github-actions bot added [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ [Status] In Progress [Tests] Includes Tests labels Mar 25, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Mar 25, 2026

Thank you for your PR!

When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:

  • ✅ Include a description of your PR changes.
  • ✅ Add a "[Status]" label (In Progress, Needs Review, ...).
  • ✅ Add testing instructions.
  • ✅ Specify whether this PR includes any changes to data or privacy.
  • ✅ Add changelog entries to affected projects

This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖


Follow this PR Review Process:

  1. Ensure all required checks appearing at the bottom of this PR are passing.
  2. Make sure to test your changes on all platforms that it applies to. You're responsible for the quality of the code you ship.
  3. You can use GitHub's Reviewers functionality to request a review.
  4. When it's reviewed and merged, you will be pinged in Slack to deploy the changes to WordPress.com simple once the build is done.

If you have questions about anything, reach out in #jetpack-developers for guidance!


Jetpack plugin:

The Jetpack plugin has different release cadences depending on the platform:

  • WordPress.com Simple releases happen as soon as you deploy your changes after merging this PR (PCYsg-Jjm-p2).
  • WoA releases happen weekly.
  • Releases to self-hosted sites happen monthly:
    • Scheduled release: March 31, 2026
    • Code freeze: March 31, 2026

If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack.

@github-actions github-actions bot added the [Status] Needs Author Reply We need more details from you. This label will be auto-added until the PR meets all requirements. label Mar 25, 2026
@kraftbj kraftbj changed the title JETPACK-1446: Fix IDOR in newsletter email sent status endpoint JETPACK-1446: Fix issue in newsletter email sent status endpoint Mar 25, 2026
@jp-launch-control
Copy link

jp-launch-control bot commented Mar 25, 2026

Code Coverage Summary

Coverage changed in 1 file.

File Coverage Δ% Δ Uncovered
projects/plugins/jetpack/_inc/lib/core-api/wpcom-endpoints/class-wpcom-rest-api-v2-endpoint-newsletter-email-sent-status.php 75/86 (87.21%) 1.13% 0 💚

Full summary · PHP report · JS report

Authors lack edit_others_posts (unlike editors), making them the correct
role for testing per-post access denial. Non-existent posts now return
403 for non-admins due to the per-post check, so run the 404 test as
admin.
@kraftbj kraftbj added [Type] Janitorial [Pri] High and removed [Status] Needs Author Reply We need more details from you. This label will be auto-added until the PR meets all requirements. labels Mar 25, 2026
@kraftbj kraftbj marked this pull request as ready for review March 25, 2026 17:24
@kraftbj kraftbj merged commit fe26ccd into trunk Mar 25, 2026
75 of 76 checks passed
@kraftbj kraftbj deleted the copilot/find-07-fix-email-status-access-control branch March 25, 2026 17:33
@github-actions github-actions bot added this to the jetpack/15.7 milestone Mar 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ [Pri] High [Status] In Progress [Tests] Includes Tests [Type] Janitorial

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants