Make WordPress Core

Opened 13 years ago

Last modified 5 years ago

#16612 new enhancement

WordPress should return nocache headers for requests with comment cookies

Reported by: barry's profile barry Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Comments Keywords: has-patch needs-testing 2nd-opinion
Focuses: Cc:

Description (last modified by barry)

Most themes, when displaying the comment form, change the HTML to pre-fill username, email address, and website when comment cookies are received in the HTTP request. Since the response does not have explicit nocache headers, per RFC2616 ( intermediate caches can use heuristics to determine the cache TTL for the response. Since there is 0 freshness data in the response, it is not really possible to perform good heuristics, but in practice, caches will assign a default TTL to this type of response. The result is that private information input by user A when submitting a comment can be returned to user B when making a request for the same URL.

To protect ourselves against this, we should call nocache_headers() when comment cookies are sent and the comment form is being displayed. Alternatively, we can send nocache headers for all requests with comment cookies regardless of the comment form being displayed or not (probably easier and maybe safer). is a story likely caused by an aggressive cache and the lack of nocache headers.

Attachments (3)

comment_cookies_nocache.diff (1.2 KB) - added by westi 13 years ago.
The fix :)
16612.diff (1.3 KB) - added by thomaswm 9 years ago.
Refreshed patch
16612.3.diff (1.3 KB) - added by rachelbaker 8 years ago.
Renames the function to wp_check_comment_cookies

Download all attachments as: .zip

Change History (16)

#1 @barry
13 years ago

  • Description modified (diff)

13 years ago

The fix :)

#2 @nacin
13 years ago

Or, per a discussion, "Vary: Cookie" could be sent.

#3 @sorich87
13 years ago

  • Type changed from defect (bug) to enhancement

#4 @nacin
10 years ago

  • Component changed from General to Bootstrap/Load

#5 @chriscct7
9 years ago

  • Keywords has-patch needs-refresh added

9 years ago

Refreshed patch

#6 @thomaswm
9 years ago

  • Keywords needs-testing added; needs-refresh removed

Added refreshed version of the patch as 16612.diff.

#7 @DrewAPicture
8 years ago

#35266 was marked as a duplicate.

#8 @DrewAPicture
8 years ago

  • Component changed from Bootstrap/Load to Comments

#9 @rachelbaker
8 years ago

  • Keywords 4.7-early added

This ticket was mentioned in Slack in #core by helen. View the logs.

8 years ago

#11 @helen
8 years ago

Was Vary: Cookie ever discussed? If going with the existing patch, it needs a different function name.

@rachelbaker: Still want to do this 4.7-early?

8 years ago

Renames the function to wp_check_comment_cookies

#12 @rachelbaker
8 years ago

  • Keywords 2nd-opinion added; 4.7-early removed
  • Milestone changed from Awaiting Review to Future Release

@helen I am not aware of any discussion or plans to implement Vary: Cookie headers. I defer to @wonderboymusic or @markjaquith for a more informed response.

#13 @rmccue
8 years ago

Related: #38060.

Note: See TracTickets for help on using tickets.