Make WordPress Core

Opened 3 years ago

Closed 3 years ago

#59141 closed defect (bug) (fixed)

Escaping function is missing in $post_edit_link

Reported by: nidhidhandhukiya Owned by: audrasjb
Priority: normal Milestone: 6.4
Component: Revisions Version: 6.3
Severity: normal Keywords: has-patch commit
Cc: Focuses:

Description

Escaping function missing which is use $post_edit_link function.

Attachments (3)

59141.patch (854 bytes ) - added by nidhidhandhukiya 3 years ago.
59141.diff (1.2 KB ) - added by rajinsharwar 3 years ago.
Maybe we can escape the _draft_or_post_title() as well.
59141.2.diff (811 bytes ) - added by viralsampat 3 years ago.
I have checked above mentioned issue and I have added my updated patch.

Download all attachments as: .zip

Change History (12)

#1 @Presskopp
3 years ago

Hello @nidhidhandhukiya, it would be helpful if you could elaborate more what issue you are describing, what is missing and why and how it can be resolved. Thank you.

#2 @Presskopp
3 years ago

Ah, I was writing while you were posting so you have (partly) answered my question now. Sorry.

#3 @mukesh27
3 years ago

  • Component AdministrationRevisions
  • Keywords has-patch added
  • Milestone Awaiting Review6.4

Thanks @nidhidhandhukiya for ticket and patch.

@Presskopp It's better to escape the output of get_edit_post_link.

Patch works fine in my test. @costdev you could commit you first one 😉

@rajinsharwar
3 years ago

Maybe we can escape the _draft_or_post_title() as well.

#4 @Presskopp
3 years ago

I think escaping is not needed here because get_edit_post_link() already returns safe links.

#5 @Presskopp
3 years ago

Also _draft_or_post_title is already escaping the return value: return esc_html( $title );

#6 @mukesh27
3 years ago

Agree with @Presskopp.

Version 0, edited 3 years ago by mukesh27 (next)

#7 @costdev
3 years ago

  • Keywords commit added

Thanks for the ping @mukesh27!

As noted above, _draft_or_post_title() is already escaped.

However, get_edit_post_link() is not escaped, and also returns the result of the get_edit_post_link filter. There may have been some confusion with edit_post_link(), which does escape the link before output.

59141.patch looks good to me, thanks @nidhidhandhukiya! 🙂


I'm not fully onboarded as a committer yet, sorry Mukesh! 😅 Adding for final review and commit by another committer.

@viralsampat
3 years ago

I have checked above mentioned issue and I have added my updated patch.

#8 @audrasjb
3 years ago

  • Owner set to audrasjb
  • Status newaccepted

#9 @audrasjb
3 years ago

  • Resolutionfixed
  • Status acceptedclosed

In 56437:

Revisions: Add missing escaping function for $post_edit_link in wp-admin/revision.php.

Props nidhidhandhukiya, Presskopp, mukesh27, rajinsharwar, costdev.
Fixes #59141.

Note: See TracTickets for help on using tickets.