Make WordPress Core

Opened 12 years ago

Closed 11 years ago

#28251 closed defect (bug) (fixed)

Twenty Fourteen: Full size image link attribute escaping missing in image template

Reported by: philiparthurmoore's profile philiparthurmoore Owned by: lancewillett's profile lancewillett
Milestone: 4.0 Priority: normal
Severity: normal Version: 4.0
Component: Bundled Theme Keywords: has-patch
Focuses: Cc:

Description

The full size image link in the image template file is missing escaping. The attached patch wraps wp_get_attachment_url with esc_url.

Attachments (4)

28251.diff (1.1 KB) - added by philiparthurmoore 12 years ago.
28251.2.diff (1.3 KB) - added by philiparthurmoore 11 years ago.
This new patch for Twenty Fourteen adds in proper escaping for the parent post link and attachment link in the image template.
28251.3.diff (1.7 KB) - added by philiparthurmoore 11 years ago.
Add in proper attribute escaping in Twenty Ten's image attachment template part.
28251.4.diff (2.5 KB) - added by philiparthurmoore 11 years ago.
More thorough attribute escaping in Twenty Ten's image attachment template part.

Download all attachments as: .zip

Change History (20)

#1 follow-up: @lancewillett
12 years ago

  • Keywords has-patch reporter-feedback added
  • Milestone changed from Awaiting Review to 4.0

Thanks Philip. (Fanks!)

Two quick thoughts:

  1. Can you take a look at all the default themes? My guess is it's not escaped everywhere.
  2. Should we submit "upstream" to the core function to be escaped by default? I think it's a better experience for theme developers not to need to escape core functions.

#2 in reply to: ↑ description @obenland
12 years ago

The get_permalink() call a few lines later needs escaping too.

#3 in reply to: ↑ 1 ; follow-up: @philiparthurmoore
12 years ago

Replying to lancewillett:

Thanks Philip. (Fanks!)

Two quick thoughts:

  1. Can you take a look at all the default themes? My guess is it's not escaped everywhere.
  2. Should we submit "upstream" to the core function to be escaped by default? I think it's a better experience for theme developers not to need to escape core functions.

Fanks, Lance!

  1. Sure thing, I can take a look first thing tomorrow.
  2. This is a really good point, and it's something that I had to make sure of before I submitted this patch (searching to see if wp_get_attachment_url was already escaped by core). In general I think that if the escaping happens within the core functions then all the better.

Would it still make sense to proceed with escaping all-the-things until core has taken care of them (plus 2 versions for back compat)?

#4 in reply to: ↑ 3 @lancewillett
12 years ago

Replying to philiparthurmoore:

Would it still make sense to proceed with escaping all-the-things until core has taken care of them (plus 2 versions for back compat)?

Yes, totes.

@philiparthurmoore
11 years ago

This new patch for Twenty Fourteen adds in proper escaping for the parent post link and attachment link in the image template.

@philiparthurmoore
11 years ago

Add in proper attribute escaping in Twenty Ten's image attachment template part.

@philiparthurmoore
11 years ago

More thorough attribute escaping in Twenty Ten's image attachment template part.

#5 @philiparthurmoore
11 years ago

It looks like only Twenty Fourteen and Twenty Ten had issues with this. Twenty Thirteen, Twenty Twelve, and Twenty Eleven all look to have proper escaping present.

#6 @SergeyBiryukov
11 years ago

  • Keywords reporter-feedback removed

#7 @lancewillett
11 years ago

In 28462:

Twenty Fourteen: correct escaping for parent post link and attachment link in image template. Props philiparthurmoore, see #28251.

#8 @lancewillett
11 years ago

In 28463:

Twenty Ten: correct attribute escaping in the attachment template. Props philiparthurmoore, see #28251.

#9 follow-up: @lancewillett
11 years ago

Should we submit "upstream" to the core function to be escaped by default? I think it's a better experience for theme developers not to need to escape core functions.

Leaving this open until we patch the core file to escape by default.

#10 in reply to: ↑ 9 ; follow-up: @obenland
11 years ago

Replying to lancewillett:

Leaving this open until we patch the core file to escape by default.

We should probably open a new ticket for that.

#11 in reply to: ↑ 10 @lancewillett
11 years ago

Replying to obenland:

Replying to lancewillett:

Leaving this open until we patch the core file to escape by default.

We should probably open a new ticket for that.

:)

This ticket was mentioned in IRC in #wordpress-themes by obenland. View the logs.


11 years ago

#13 @obenland
11 years ago

  • Resolution set to fixed
  • Status changed from new to closed

lancewillett and I agreed that adding escaping to wp_get_attachment_url() might not be the best idea. It is used a lot internally and not only in the context of a template tag. See conversation in IRC.

#14 @obenland
11 years ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

#15 @obenland
11 years ago

  • Owner set to lancewillett
  • Status changed from reopened to assigned

#16 @obenland
11 years ago

  • Resolution set to fixed
  • Status changed from assigned to closed
Note: See TracTickets for help on using tickets.