-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix author information leakage by author blocks for Custom Post Types without author support & display notice to user #67136
Conversation
…pported Custom Post Types & show notice to user
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
Thanks for contributing, @sarthaknagoshe2002! I'm unsure if we need to modify the block's edit components. People with access to the editors can also access details about post type author. If it's decided to display a notice in edit components, it should probably be a part of rendered content and not an editor notice. cc @WordPress/gutenberg-design |
@Mamaduka Can you elaborate more on this? |
@Mamaduka I have implemented your suggestion now. Screenshot |
I believe that the warning definitely makes sense in the editor context since displaying warnings/errors on the frontend doesn't seem appropriate. Also, as you suggested static warning makes sense too. |
@Mamaduka Any updates on how we should proceed with this PR? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sarthaknagoshe2002, I left a couple of suggestions. Still looking for design feedback before final approval.
P.S. There's also a proposal to deprecate Post Author block - #53427, but the information leaking issue also applies to deprecated blocks.
Thanks, @jameskoster! Yes, the block editor warning component can work in this case.
Generally, a template-aware inserter would be cool, but hiding blocks without context as to why they're hidden can be confusing. |
@fabiankaegy @Mamaduka I’ve addressed the feedback. @jameskoster I’ve updated the message to |
I'm not actually sure myself, sorry. Maybe @Mamaduka knows 🤞 |
@sarthaknagoshe2002 you can remove a block like so: const BlockEdit = (props) => {
const { clientId } = props;
const { removeBlock } = useDispatch( blockEditorStore );
return (
<Button onClick={() => removeBlock(clientId)} isDestructive>Remove</Button>
);
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think there's no need to use the warning component and separate the removal action. Why?
- The severity of missing
author
support is negligible. It won't break or affect anything on the front end. You don't need the Waning component to grab the user's attention. - Users can use toolbar options to remove the block.
@sarthaknagoshe2002 left minor suggestions regarding translation comments and string. After that, I think we're good to merge.
Screenshot
@fabiankaegy, the block editor component will receive the
|
🤯 very good to know thank you :) |
@Mamaduka I’ve addressed the changes, and I believe this is now ready to be merged. |
fixes: #65816
What?
This PR updates the behavior of author blocks to ensure they do not render when the post belongs to a Custom Post Type (CPT) that does not explicitly declare support for the author feature.
Why?
Author blocks displaying on CPTs without declared author support is inconsistent with WordPress behavior.
This can lead to unintentional data exposure, as WordPress still saves author information to the database even when it is not intended to be visible.
Ensures better security, consistency, and adherence to user expectations for CPTs.
How?
Testing Instructions
Reproduction:-
Expected Outcome:-
In the Editor:
On the Frontend:
Screenshots or screencast
author.blocks.mov
The suggestion given by @dhruvang21 is also used in this PR from the comment