Skip to content

Block Library: Don't pass post_id to server-side renders for posts the user can't edit - #80604

Merged
jorgefilipecosta merged 9 commits into
trunkfrom
fix/79949-ssr-post-id-permission
Nov 20, 2026
Merged

jorgefilipecosta merged 9 commits into
trunkfrom
fix/79949-ssr-post-id-permission

Conversation

@jorgefilipecosta

@jorgefilipecosta jorgefilipecosta commented Jul 22, 2026 •

Copy link
Copy Markdown
Member

Fixes #79949

Fixes the Breadcrumbs block and auto-registered PHP-only blocks failing to preview in the editor when the postId block context references a post the current user can't edit.

The block-renderer REST endpoint requires edit_post permissions for the post referenced by post_id, and these blocks forwarded the context postId unchecked. Core alone never triggers this, the posts list used by the Query Loop preview excludes posts the user can't edit, but providing a postId context is exactly the pattern third-party query-like blocks (related posts, custom loops) are built on, and those don't go through that filter. Inside one of them, Breadcrumbs stays on its loading state forever (its post record request also fails) and PHP-only blocks show "Error loading block: …", while the front end renders fine.

To fix this we only forward post_id when canUser( 'update', … ) allows it: Breadcrumbs stops waiting for the inaccessible post record and falls back to its placeholder, and PHP-only blocks render without post context. Permissions usually resolve from the targetHints already sent with entity records, so no extra requests are made for editable posts. A minimal test/post-context-provider block is added to the SSR e2e test plugin to stand in for third-party providers, with an e2e test for the permission scenario.

Before

After

Testing Instructions

npm run test:e2e -- test/e2e/specs/editor/plugins/server-side-rendered-block.spec.js

Manual, on any site running this branch (no plugin needed):

  1. Create an Author user and log in with it. Create a new post.

  2. Paste this in the browser console; it registers a throwaway block that provides the postId context, standing in for a third-party query-like block:

    wp.blocks.registerBlockType( 'repro/post-context-provider', {
    	title: 'Post context provider (repro)',
    	category: 'text',
    	attributes: { postId: { type: 'number' } },
    	providesContext: { postId: 'postId' },
    	edit: ( { attributes, setAttributes } ) => {
    		const el = wp.element.createElement;
    		const blockProps = wp.blockEditor.useBlockProps( {
    			style: { border: '1px dashed currentColor', padding: '12px' },
    		} );
    		const innerBlocksProps = wp.blockEditor.useInnerBlocksProps();
    		return el(
    			'div',
    			blockProps,
    			el( wp.components.TextControl, {
    				label: 'Context post ID',
    				type: 'number',
    				value: attributes.postId ?? '',
    				onChange: ( value ) =>
    					setAttributes( { postId: Number( value ) || undefined } ),
    			} ),
    			el( 'div', innerBlocksProps )
    		);
    	},
    	save: () => wp.element.createElement( wp.blockEditor.InnerBlocks.Content ),
    } );
  3. Insert the "Post context provider (repro)" block and type 1 in its "Context post ID" input (the admin-owned "Hello world!" post — any post the Author can't edit works).

  4. Insert Breadcrumbs inside it. Without this branch it stays on its loading state forever and the network tab shows the block-renderer and post record requests failing with 403; with this branch it renders its placeholder and post_id is not sent.

  5. Change the ID to a post the Author owns and verify real breadcrumbs render (post_id is still sent). As admin, verify Breadcrumbs in a plain post and inside a Query Loop's Post Template are unchanged.

AI usage disclosure: fix and description drafted with AI assistance and reviewed by me.

Summary by CodeRabbit

  • Bug Fixes

    • Server-rendered blocks now render successfully when the current user cannot edit the contextual post.
    • Inaccessible post context is no longer sent to the rendering service, preventing authorization errors.
    • Breadcrumbs display the appropriate placeholder when the related post cannot be edited.
    • Valid post context continues to be preserved when permissions and post types match.
  • Tests

    • Added end-to-end coverage for restricted post permissions, contextual rendering, and mismatched post types.

@github-actions github-actions Bot added the [Package] Block library /packages/block-library label Jul 22, 2026
@github-actions

github-actions Bot commented Jul 22, 2026 •

Copy link
Copy Markdown

Size Change: +113 B (0%)

Total Size: 7.91 MB

📦 View Changed
Filename Size Change
build/scripts/block-library/index.min.js 371 kB +113 B (+0.03%)

compressed-size-action

@jorgefilipecosta
jorgefilipecosta force-pushed the fix/79949-ssr-post-id-permission branch from b12202a to 219f87f Compare July 23, 2026 09:59
@github-actions

github-actions Bot commented Jul 23, 2026 •

Copy link
Copy Markdown

Flaky tests detected in 1def218.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/32280733452
📝 Reported tests:

should insert block with the slash inserter when using multiple words in /test/e2e/specs/editor/various/inserting-blocks.spec.js, passed after 1 failed attempt.
Error: apiRequestContext.fetch: socket hang up
Call log:
  - → GET http://localhost:8889/wp-json/wp/v2/blocks?per_page=100&status=publish%2Cfuture%2Cdraft%2Cpending%2Cprivate%2Ctrash
    - user-agent: Playwright/1.62.1 (x64; ubuntu 24.04) node/20.20 CI/1
    - accept: */*
    - accept-encoding: gzip,deflate,br
    - X-WP-Nonce: 6eb18ce682
    - cookie: wordpress_test_cookie=WP%20Cookie%20check; wordpress_logged_in_23778236db82f19306f247e20a353a99=admin%7C1787333180%7C3784oU7aahSfX4ueGp8BzEdNBEfcUBsakdECiLMQg2y%7C2c88f082e561efb31dc76f492e7caaea00eff663c37cd0f20933369119163a3b; wp-settings-time-1=1787160380

    at RequestUtils.rest (/home/runner/work/gutenberg/gutenberg/packages/e2e-test-utils-playwright/src/request-utils/rest.ts:112:39)
    at RequestUtils.deleteAllBlocks (/home/runner/work/gutenberg/gutenberg/packages/e2e-test-utils-playwright/src/request-utils/blocks.ts:23:28)
    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/various/inserting-blocks.spec.js:11:22

@jorgefilipecosta
jorgefilipecosta marked this pull request as ready for review July 24, 2026 10:10
@jorgefilipecosta jorgefilipecosta added the [Type] Bug An existing feature does not function as intended label Jul 27, 2026
@jorgefilipecosta
jorgefilipecosta force-pushed the fix/79949-ssr-post-id-permission branch from 219f87f to 9af7df0 Compare July 27, 2026 17:53
} ),
isLoading:
( postId && ! _post ) ||
// When the user can't edit the post, its record may not be

@ntsekouras ntsekouras Jul 28, 2026 •

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.

Can you elaborate a bit more why we need these changes in Breadcrumbs. How could a user have an issue?

Can you share some manual reproduction steps?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Hi @ntsekouras, manual reproduction steps were shared in #80604 (comment). The issue only affects third party blocks that provide a post context of a different post. Regarding the Breadcrumbs changes: the record fetch uses context=edit, so for a post the user can read but not edit the record never arrives, and without checking the permission the block would stay in the loading state forever. The guard was also updated to follow the same conservative rule as the block-renderer change.

@ntsekouras

ntsekouras commented Jul 28, 2026 •

Copy link
Copy Markdown
Contributor

Thanks for the PR!

I mentioned that in my comment, but can you share some manual reproduction steps?

I don't know much of PHP only blocks, but I find it odd that we have testing instructions (and tests) that use a custom provider. Is this something that is needed for possible 3rd party devs only?

@jorgefilipecosta

Copy link
Copy Markdown
Member Author

Thanks for the PR!

I mentioned that in my comment, but can you share some manual reproduction steps?

I don't know much of PHP only blocks, but I find it odd that we have testing instructions (and tests) that use a custom provider. Is this something that is needed for possible 3rd party devs only?

Hi Nik I expanded the replication instructions this is an issue that just affects when used in third party blocks that set the post context of a different post.

Basically create an author user.
Create a post with author past this on the browser console that allows setting the context of an aribrary post:

wp.blocks.registerBlockType( 'repro/post-context-provider', {
	title: 'Post context provider (repro)',
	category: 'text',
	attributes: { postId: { type: 'number' } },
	providesContext: { postId: 'postId' },
	edit: ( { attributes, setAttributes } ) => {
		const el = wp.element.createElement;
		const blockProps = wp.blockEditor.useBlockProps( {
			style: { border: '1px dashed currentColor', padding: '12px' },
		} );
		const innerBlocksProps = wp.blockEditor.useInnerBlocksProps();
		return el(
			'div',
			blockProps,
			el( wp.components.TextControl, {
				label: 'Context post ID',
				type: 'number',
				value: attributes.postId ?? '',
				onChange: ( value ) =>
					setAttributes( { postId: Number( value ) || undefined } ),
			} ),
			el( 'div', innerBlocksProps )
		);
	},
	save: () => wp.element.createElement( wp.blockEditor.InnerBlocks.Content ),
} );

Set the post id to 1 (normally the hello world post created by admin), and add the breacrumbs block inside that test block.
On this branch the block loads with a placeholder for the post:

Screenshot 2026-07-28 at 23 28 20

On trunk the block stays loading for ever:
Screenshot 2026-07-28 at 23 30 37

This PR is just adding a defensive check on places where we retrieve post id from context to make sure the user has edit permissions.

@jorgefilipecosta
jorgefilipecosta force-pushed the fix/79949-ssr-post-id-permission branch from 9af7df0 to c669d34 Compare July 29, 2026 21:23
@ntsekouras
ntsekouras requested a review from priethor July 30, 2026 09:24

@priethor priethor 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.

Thanks for tackling this!

Comment thread packages/block-library/src/index.js Resolved
@jorgefilipecosta
jorgefilipecosta force-pushed the fix/79949-ssr-post-id-permission branch from c669d34 to 8b3db5b Compare August 12, 2026 14:46
@jorgefilipecosta
jorgefilipecosta force-pushed the fix/79949-ssr-post-id-permission branch from 8b3db5b to 1def218 Compare August 19, 2026 17:17
@jorgefilipecosta
jorgefilipecosta force-pushed the fix/79949-ssr-post-id-permission branch from c29244d to aac08f5 Compare August 31, 2026 13:45
@github-actions github-actions Bot added the [Package] E2E Tests /packages/e2e-tests label Aug 31, 2026
@jorgefilipecosta
jorgefilipecosta force-pushed the fix/79949-ssr-post-id-permission branch from aac08f5 to 9c04f67 Compare September 2, 2026 21:25
@coderabbitai

coderabbitai Bot commented Sep 2, 2026 •

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Team

Run ID: 3a2707fc-4b45-4d1a-8edc-33e1fc09b52d

📥 Commits

Reviewing files that changed from the base of the PR and between 3f26638 and 9c04f67.

📒 Files selected for processing (7)
  • packages/block-library/CHANGELOG.md
  • packages/block-library/src/breadcrumbs/edit.jsx
  • packages/block-library/src/index.jsx
  • packages/block-library/src/utils/hooks.js
  • packages/e2e-tests/plugins/server-side-rendered-block.php
  • packages/e2e-tests/plugins/server-side-rendered-block/editor.js
  • test/e2e/specs/editor/plugins/server-side-rendered-block.spec.js

Included review availability: Your plan provides up to 8 included reviews per hour; 6 remain after this review.


📝 Walkthrough

Walkthrough

The block library now checks contextual post permissions before server-side rendering. It omits post_id for confirmed non-editable posts, updates Breadcrumbs behavior, and adds end-to-end coverage for restricted and mismatched post contexts.

Changes

Post context permissions

Layer / File(s) Summary
Post context permission resolution
packages/block-library/src/utils/hooks.js
Added shared permission functions that validate post context, require read access, and resolve update permission.
Render request permission integration
packages/block-library/src/index.jsx, packages/block-library/src/breadcrumbs/edit.jsx
Server-rendered blocks and Breadcrumbs omit post_id when the contextual post is confirmed non-editable. Breadcrumbs also update loading and placeholder behavior.
Permission regression coverage
packages/e2e-tests/plugins/server-side-rendered-block.php, packages/e2e-tests/plugins/server-side-rendered-block/editor.js, test/e2e/specs/editor/plugins/server-side-rendered-block.spec.js, packages/block-library/CHANGELOG.md
Added a post-context provider block, end-to-end tests for restricted and mismatched contexts, and a changelog entry.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Merge Risk: ⚪ Minimal · up to 9c04f

The change prevents inaccessible post IDs from being sent to server-side block renders while preserving rendering for editable posts. No actionable merge-blocking risk remains beyond normal checks and review.

Sequence Diagram(s)

sequenceDiagram
  participant Editor
  participant useCanEditPostContext
  participant core-data
  participant block-renderer
  Editor->>useCanEditPostContext: Resolve contextual post editability
  useCanEditPostContext->>core-data: Check read and update permissions
  core-data-->>useCanEditPostContext: Return permission state
  Editor->>block-renderer: Send render request with or without post_id
  block-renderer-->>Editor: Return rendered block output
Loading

Suggested reviewers: ciampo, gutenbergplugin

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 75.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 4 functions across 6 files. (1 skipped: 1… Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the primary change: omitting post_id from server-side renders when the user cannot edit the referenced post.
Linked Issues check ✅ Passed The pull request addresses the requirements in [#79949]. It checks edit permissions for contextual posts, omits post_id when the post is confirmed non-editable, preserves context for editable posts, h…
Out of Scope Changes check ✅ Passed The changes are within scope for [#79949]. The helper logic, Breadcrumbs and block-library updates, changelog entry, test block, and end-to-end permission tests directly support the requested fix.
Full details: Linked Issues check

Explanation

The pull request addresses the requirements in [#79949]. It checks edit permissions for contextual posts, omits post_id when the post is confirmed non-editable, preserves context for editable posts, handles Breadcrumbs, and adds coverage for PHP-only server-side-rendered blocks.

Full details: Docstring Coverage

Explanation

Docstring coverage is 75.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 4 functions across 6 files. (1 skipped: 1 unsupported.)

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/79949-ssr-post-id-permission

Warning

Some tools did not complete. Review the errors below.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint install timed out. The project may have too many dependencies for the sandbox.


Comment @coderabbitai help to get the list of available commands.

@github-actions

github-actions Bot commented Sep 2, 2026 •

Copy link
Copy Markdown

🤖 PR meta 🤖

🎉 Props

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: jorgefilipecosta <jorgefilipecosta@git.wordpress.org>
Co-authored-by: priethor <priethor@git.wordpress.org>
Co-authored-by: ntsekouras <ntsekouras@git.wordpress.org>
Co-authored-by: deepakpra <deepakprajapati@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.


Props Bot commands

You can trigger Props Bot actions by commenting on this PR:

  • @propsbot add <username> to give props to a GitHub user. Requires write access.
  • @propsbot remove <username> to leave a user out of the props. Requires write access.
  • @propsbot refresh to refresh this list. Adding the props-bot label works too.

Updated as activity occurs, without notifying anyone named here. Add the props-bot label to refresh.

📦 Bundle size

Size Change: +203 B (0%)

Total Size: 8.69 MB

📦 View Changed
Filename Size Change
build/scripts/block-library/index.min.js 427 kB +203 B (+0.05%)

7a5e12a Run

⚡ Performance

Show the results

Client side metrics exclude the server response time.

front-end-block-theme

Metric a114cf5 trunk % Change
timeToFirstByte 43.95 ms +7.51% -4.32% 45.35 ms +3.86% -2.43% -3.09%
largestContentfulPaint 72 ms +2.78% -2.78% 70 ms +5.71% -2.86% 2.86%
lcpMinusTtfb 26.25 ms +14.48% -12.19% 24.25 ms +17.73% -5.98% 8.25%
wpBeforeTemplate 22.43 ms +14.04% -3.08% 23.11 ms +7.4% -2.08% -2.94%
wpTemplate 17.54 ms +1.94% -6.21% 18.51 ms +5.51% -8.27% -5.24%
wpTotal 39.72 ms +9.87% -2.72% 41.75 ms +4.26% -2.3% -4.86%
wpMemoryUsage 7.75 MB +0% -0% 7.72 MB +0% -0% 0.45%
wpDbQueries 16 +0% -0% 16 +0% -0% 0%

front-end-classic-theme

Metric a114cf5 trunk % Change
timeToFirstByte 35.2 ms +5.26% -1.85% 37.1 ms +6.6% -3.91% -5.12%
largestContentfulPaint 64 ms +15.63% -0% 68 ms +2.94% -5.88% -5.88%
lcpMinusTtfb 29.05 ms +28.23% -4.48% 28.8 ms +3.47% -3.47% 0.87%
wpBeforeTemplate 19.22 ms +3.69% -0.83% 19.56 ms +2.35% -2.2% -1.74%
wpTemplate 12.82 ms +6.16% -3.51% 13.81 ms +6.01% -3.4% -7.17%
wpTotal 32.27 ms +5.42% -1.74% 33.3 ms +9.46% -1.89% -3.09%
wpMemoryUsage 6.44 MB +0% -0% 6.40 MB +0% -0% 0.56%
wpDbQueries 13 +0% -0% 13 +0% -0% 0%

media-processing

Metric a114cf5 trunk % Change
mediaProcessingJpeg 326.71 ms +1.51% -0.58% 328.32 ms +2.59% -0.65% -0.49%
mediaProcessingAvif 4911.99 ms +0.47% -0.68% 4901.66 ms +0.23% -0.66% 0.21%
mediaProcessingJpegToAvif 3417.61 ms +0.16% -0.25% 3404.72 ms +0.53% -0.32% 0.38%

media-upload

Metric a114cf5 trunk % Change
jpegUploadProcessing 1476.43 ms +2.84% -1% 1473.8 ms +0.97% -0.89% 0.18%
pngUploadProcessing 254.52 ms +2.29% -5.01% 246.85 ms +2.37% -2.38% 3.11%
largeJpegUploadProcessing 1444.19 ms +1.24% -0.17% 1442.91 ms +1.19% -0.53% 0.09%
multipleImageUploadProcessing 1515.63 ms +0.94% -0.71% 1535.65 ms +0.62% -1.23% -1.3%

post-editor

Metric a114cf5 trunk % Change
serverResponse 488.4 ms +4.28% -9.13% 472.97 ms +6.14% -5.62% 3.26%
firstPaint 454.29 ms +2.29% -2.49% 422.81 ms +8.74% -5.09% 7.45%
domContentLoaded 843.11 ms +5.17% -2.49% 828.79 ms +2.08% -0.36% 1.73%
loaded 844.22 ms +5.17% -2.49% 830 ms +2.05% -0.37% 1.71%
firstContentfulPaint 479.14 ms +10.57% -4.35% 469.72 ms +1.75% -2.43% 2.01%
firstBlock 2263.15 ms +1.75% -0.87% 2228.76 ms +1.13% -1.87% 1.54%
type 17.7 ms +5.99% -6.55% 20.02 ms +8.14% -12.09% -11.59%
typeWithoutInspector 18.11 ms +5.19% -6.02% 18.57 ms +4.09% -11.85% -2.48%
typeWithTopToolbar 24.76 ms +2.5% -17.73% 25.32 ms +8.29% -9.48% -2.21%
typeContainer 8.26 ms +9.08% -3.39% 8.31 ms +5.9% -12.27% -0.6%
focus 131.82 ms +4.38% -10.61% 118.06 ms +9.64% -3.32% 11.66%
firstFocus 283.32 ms +0% -0% 272.95 ms +0% -0% 3.8%
selectAll 436.91 ms +0.99% -3.93% 430.84 ms +1.31% -6.64% 1.41%
undo 28.96 ms +6.84% -2.18% 30.01 ms +5.2% -6.96% -3.5%
listViewOpen 81.47 ms +6.3% -9.49% 77.6 ms +8.05% -11.26% 4.99%
inserterOpen 41.84 ms +7.53% -7.74% 40.46 ms +14.68% -5.88% 3.41%
inserterHover 11.78 ms +14.18% -5.69% 11.7 ms +10.09% -12.48% 0.68%
inserterSearch 8.35 ms +7.07% -3.23% 8.19 ms +18.93% -4.27% 1.95%
loadPatterns 658.32 ms +2.64% -5.08% 675.1 ms +1.7% -5.78% -2.49%
wpTotal 478.7 ms +4.34% -9.28% 463.15 ms +6.19% -5.68% 3.36%
wpMemoryUsage 14.81 MB +0% -0% 14.77 MB +0% -0% 0.25%
wpDbQueries 55 +0% -0% 55 +0% -0% 0%

site-editor

Metric a114cf5 trunk % Change
serverResponse 474.28 ms +0.82% -6.65% 440.22 ms +7.29% -1.53% 7.74%
firstPaint 477.43 ms +1.17% -2.98% 465.69 ms +1.49% -14.96% 2.52%
domContentLoaded 843.29 ms +0.77% -0.2% 855.15 ms +0.99% -1.43% -1.39%
loaded 844.27 ms +0.8% -0.15% 856.25 ms +1.01% -1.43% -1.4%
firstContentfulPaint 481.49 ms +2.07% -1.49% 485.3 ms +1.68% -2.94% -0.79%
firstBlock 2607.93 ms +3.58% -0.68% 2612.06 ms +0.65% -0.63% -0.16%
type 17.7 ms +13.84% -6.84% 18.93 ms +5.71% -8.77% -6.5%
navigate 120.63 ms +12.39% -3.71% 115.8 ms +9.66% -2.29% 4.17%
loadPatterns 1388.5 ms +10.17% -3.92% 1366.22 ms +14.96% -0.42% 1.63%
loadPages 958.31 ms +2.89% -1.58% 970.42 ms +1.52% -0.86% -1.25%
wpTotal 464.89 ms +0.74% -6.82% 430.5 ms +7.51% -1.54% 7.99%
wpMemoryUsage 12.83 MB +0% -0% 12.80 MB +0% -0% 0.25%
wpDbQueries 45 +0% -0% 45 +0% -0% 0%

7a5e12a Run

@jorgefilipecosta
jorgefilipecosta force-pushed the fix/79949-ssr-post-id-permission branch 3 times, most recently from f11fbaa to 7ebd451 Compare September 17, 2026 09:57
@jorgefilipecosta
jorgefilipecosta force-pushed the fix/79949-ssr-post-id-permission branch 3 times, most recently from 90ca3f6 to 76bd8be Compare September 23, 2026 15:08
@jorgefilipecosta
jorgefilipecosta force-pushed the fix/79949-ssr-post-id-permission branch from 16d4806 to fd33c6f Compare September 28, 2026 15:17
@jorgefilipecosta
jorgefilipecosta force-pushed the fix/79949-ssr-post-id-permission branch from fd33c6f to 9db9179 Compare October 27, 2026 21:43
@nerrad
nerrad removed their request for review November 6, 2026 14:17

@priethor priethor 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.

Thanks for addressing he feedback, @jorgefilipecosta ! I've updated the PR from trunk to resove the conflics, but CI is not passing because it's also broken in trunk for now.

@priethor

Copy link
Copy Markdown
Contributor

but CI is not passing because it's also broken in trunk for now.

I opened a patch to fix it in #87165

jorgefilipecosta and others added 9 commits November 20, 2026 16:32
…e user can't edit

The block-renderer REST endpoint requires edit_post permissions for the
post referenced by post_id, so server-side rendered previews failed with
a 403 error when the postId block context referenced a post the current
user can't edit.

Only forward the context postId when canUser( 'update' ) allows it, in
the Breadcrumbs block and in auto-registered PHP-only blocks. Breadcrumbs
falls back to its placeholder in that case instead of waiting for a post
record the user can't access.
Co-authored-by: priethor <27339341+priethor@users.noreply.github.com>
@jorgefilipecosta
jorgefilipecosta force-pushed the fix/79949-ssr-post-id-permission branch from ec75623 to 142f845 Compare November 20, 2026 16:35
@jorgefilipecosta
jorgefilipecosta merged commit e8fdab7 into trunk Nov 20, 2026
88 of 89 checks passed
@jorgefilipecosta
jorgefilipecosta deleted the fix/79949-ssr-post-id-permission branch November 20, 2026 17:14
@jorgefilipecosta

Copy link
Copy Markdown
Member Author

Thank you for fixing the CI and thank you for reviewing this PR @priethor!

@github-actions github-actions Bot added this to the Gutenberg 24.6 milestone Nov 20, 2026
Vedant-Gandhi pushed a commit to Vedant-Gandhi/gutenberg that referenced this pull request Nov 30, 2026
…e user can't edit (WordPress#80604)

Co-authored-by: priethor <27339341+priethor@users.noreply.github.com>
Co-authored-by: jorgefilipecosta <jorgefilipecosta@git.wordpress.org>
Co-authored-by: priethor <priethor@git.wordpress.org>
Co-authored-by: ntsekouras <ntsekouras@git.wordpress.org>
Co-authored-by: deepakpra <deepakprajapati@git.wordpress.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Package] Block library /packages/block-library [Package] E2E Tests /packages/e2e-tests [Type] Bug An existing feature does not function as intended

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Server-side rendered blocks error in the editor when post_id refers to a post the user can't edit

3 participants