-
Notifications
You must be signed in to change notification settings - Fork 17
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
Bug: User-Specific Cache Expiration w/ _wpnonce
#601
Comments
A similar issue may also exist in comment forms for users who are logged in (or NOT logged in), whenever you also run the Akismet plugin.
|
This bug was reported by @clavaque at s2member.net. |
Next Actions (Step 1 of 2)
On Deck (Step 2 of 2)Take a closer look at the impact that this new auto-exclusion will have on comment forms whenever Akismet is running. While caching nonce values is definitely problematic, so is excluding every post that contains a comment form! We need to take a closer look and determine what Step 2 should look like here. |
Assigning this to @kristineds :-) |
@raamdev Thoughts on Step 2 of 2, and on this issue in general? |
@jaswsinc Hmm, my first reaction after reviewing the details of this issue is that we should treat this the same way we treat issues caching dynamic content generated by any other WordPress plugins: If the plugin doesn't set However, I hesitate to say that's my recommendation as we're talking about certain portions of WP core, Akismet, and bbPress, all of which deserve more consideration IMO. How do other WordPress caching plugins handle this issue (if they do at all)? Initially, it sounded like this issue was specific to logged-in users (which would explain how other caching plugins, which don't do logged-in user caching, are able to avoid this issue), but you mentioned this would be a problem for non-logged in users replying to a comment form on a site running Akismet. I imagine WP Super Cache (maintained by the same company that makes Aksimet) must have a way around this? |
A quick search of the codebase turns up nothing for "akismet", and very little for "nonce". So nothing jumping out at me right away that would deal with this issue in WP Super Cache. Referencing: |
I'm wondering why this hasn't been reported as an issue with ZenCache yet. Do you suppose that's because this only affects Logged-In User Caching and that option is disabled by default? Or maybe when Logged-In User Caching is enabled, we're still disable caching for users who post a comment (i.e., the comment cookies are still disabling ZenCache)? I seem to recall working on something related to Logged-In User Caching + Comment Cookies in the recent past... |
I had the same thought. It does seem like an edge case though. It may not impact a site owner, only commenters, and only if the cache expiration time is lower than the I keep looking at this issue hoping that I'm missing something, and that maybe this is actually a non-issue, but each time I think about it, I keep coming back to cached In the case of logged-in users, we can simply disable caching on pages that contain a |
Is there any way to figure out when an Or would really fixing this require solving #222? |
There isn't at the moment, but that seems possible to do if we wanted to. However, I don't see that being bulletproof either, because an nonce can also be associated with a specific context or action; e.g., a specific IP address or a specific type of action that is being performed. While that might work OK in the case of Akismet (I suspect it will), it may not cover all use cases in other plugins that use nonce values. See: https://codex.wordpress.org/Function_Reference/wp_create_nonce I like where you're going with this though. Maybe a short-term solution would be to force an overall cache expiration time that is lower than the nonce timeout. We should research if that's even safe to do though. It seems like a potential security issue to me.
That would help us, but I think the discussion in that issue is not going anywhere at the moment. Others have tried that in the past and failed, and each time I look at that I cringe. I can't see us actually implementing something like that. It's just asking for security problems and other headaches IMO. |
Then maybe the best way to handle this would be to detect when certain well-known plugins that use nonce's are active on a site and then make specific recommendations about how the Cache Expiration Time should be adjusted (e.g., if Akismet is installed, suggest a Cache Expiration Time of 24 hours)? It's not a bulletproof solution, as you said, but it seems to me like the default Cache Expiration Time of 7 days might be the thing that causes the most trouble with this issue. |
Taken from this post...
So it's not a show-stopper, but it could be adding to the overall spam score whenever it is a cached value that is being submitted. That explains why we haven't seen this become a major issue. There was also a conversation about how this might impact caching plugins. See: https://make.wordpress.org/core/2010/12/06/as-was-discussed-in-the-last-dev-chat-i/#comment-4077 I'm also seeing that there is a filter for this in the Akismet plugin. We might consider resolving this problem by disabling this particular spam check whenever the page will be cached. Referencing: https://github.com/git-mirror/wordpress-akismet/blob/7e392b11d991be602020dc6c92f98934bb2f172e/akismet.php#L333 Removing that check would remove the |
Interesting. Great find with those links! Yep, I'd say disabling that particular spam check might be the best route to go here. I'd couple a new configurable option with a Dashboard message when Akismet is active, and a link to a KB Article that explains things in detail. |
Next Pro Release Changelog:
|
ZenCache Pro v151220 has been released and includes changes worked on as part of this GitHub Issue. See the release announcement for further details. This issue will now be locked to further updates. If you have something to add related to this GitHub Issue, please open a new GitHub Issue and reference this one (#601). |
Overview
There are some links generated in markup—by WP core, or by plugins like bbPress, and the markup may contain
<a>
links that have_wpnonce
query string variables in them. It is possible for the_wpnonce
value to expire before the cache does, and before a user performs an action on the site that would force the cache to clear automatically.In short, there are certain portions of WP core (and in plugins like bbPress) that output dynamic content without also setting
define('DONOTCACHEPAGE', true)
, because the assumption is that the user is logged-in, and that cache plugins will not cache logged-in users anyway. However, ZenCache does! (Edit: Note that this can also be a problem when users are NOT logged in; see next comment below.)Steps to Reproduce
?_wpnonce
in it; e.g., a [stick] or [unstick] topic link._wpnonce
expire while still in the cache.Expected Behavior
That sticking or unsticking a topic (or performing some other action) that requires
_wpnonce
would be performed as expected.Observed Behavior
There are times whenever the
_wpnonce
expires before the cache does, and the action fails.The text was updated successfully, but these errors were encountered: