-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
Graceful recovery for issue: You are not permitted to use that link to directly access ... #10753
Conversation
…s that page Add some fault-tolerance to the system and (re-) calculate edit permission (also checking out the record) CASE 1: The initial "edit-task", failed to update session properly, due to race-conditions CASE 2: The initial "edit-task", was never called because the HTTP request was cached by the browser for any reason See issue here for a detailed discussion: joomla#8757 NOTE: 3rd party extensions that extend JControllerLegacy need to re-implement this, - if they need to pass to allowEdit more than just: "id"=>NNN Maybe best solution would be instatiate the view inside the controller add / edit task, - but this means that all tasks would need to re-direct to the edit task instead of the view ... e.g. the 'apply' task, etc which is a major B/C break, so i did not make such a PR ! If you don't like the way i include the controller, just tell me how to improve / correct it even if you do not like this PR, it is good to be here as a reference ...
@wojsmol next time i will use try to use About testing this PR
and add a
at the start of the function, thus the id will never be added into the session as editable, |
I can confirm having tested this on 3 3.5.1 installations that this worked for me with following modules issue: |
that is one way, every one that needs a fix copying the suggested code into their web-sites
https://issues.joomla.org/tracker/joomla-cms/10753 by clicking on the button "Test this" button, and selecting "Test succesfully", if you and other just copy the code but don't mark test as successful then it will not be accepted |
I have tested this item ✅ successfully on 80a5498 This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/10753. |
@PhilETaylor can you test this please |
if ( $optionName == reset($context_arr) && $viewName == end($context_arr) ) | ||
{ | ||
$controller_name = ucfirst($this->getName()) . 'Controller' . ucfirst($viewName); | ||
$controller_path = JPATH::clean(JPATH_COMPONENT . '/controllers/' . $viewName . '.php'); |
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.
This makes a massive assumption that this will ALWAYS be a "subtask" (for lack of better terms). Say a component doesn't have a article.edit
task like com_content and ContentControllerArticle
and just has a single controller.php file that its edit task routes through; this case won't be handled.
Also, is it really necessary to instantiate another controller to get the data you need with this implementation? You aren't inflecting anything anywhere so it seems like you're deriving the class name for the current controller and instantiating a second instance of it to find the model and re-run the allowEdit()
method. Seems like major overkill here, especially because it introduces a bunch of extra logic that really should just call for JControllerLegacy::getInstance()
to be re-used but alas that is terribly hardcoded to a global singleton instance...
This comment was marked as abuse.
This comment was marked as abuse.
... the code is inside checkEditId() and it is for classes inheriting from JControllerLegacy Please provide an example (steps) that this code will do something worse than what is currently happening
Yes it is because the controller that made the check is in generally different than the current controller (as far as i remember when making this PR)
but to answer your question Yes and you can create such an environment yourself please read my other messages about forcing the "easily reproduced" thing by instructing browser to cache the 1st request
The term is "fault-tolerant" sound better ?
|
the solution i have in my extension is to make the checks in the same step that instatiates the view without a redirection
it was working for core components, but it was really breaking B/C (really bad break) |
Right, I get this method is in the base controller, but your logic for As for the second controller thing, can you point out how that's On Monday, August 1, 2016, Georgios Papadakis [email protected]
|
Wait, I just realized this is the second check after the redirect. So ya, On Monday, August 1, 2016, Georgios Papadakis [email protected]
|
The solution should work in 99% of cases, i say this percentage, since the code is inside checkEditId(), and inside JControllerLegacy,
|
This comment was marked as abuse.
This comment was marked as abuse.
This comment was marked as abuse.
This comment was marked as abuse.
This comment was marked as abuse.
This comment was marked as abuse.
To reproduce this problem all you need to do is have Apache server configured to add Cache and Expires headers on the HTTP responses. Then in Joomla just open a module and then close it, and try to open it again. I tested this PR and it solves the problem, even with Cache and Expires headers. A couple comments:
I hope this is useful. |
This comment was marked as abuse.
This comment was marked as abuse.
This comment was marked as abuse.
This comment was marked as abuse.
not possible, please correct me, but you can not override all caching cases, that happen due to configuration in .htaccess, (maybe it is possible in some server configurations ? i am not sure, someone please comment if it is possible and provide documentation link) About if this fix is correct approach ...
Thus i argue it is not bad approach in what it does The thing i do not like about this PR and any PR that will depend on the 2nd call, was not mentioned by anyone, and is this That it will encourage BAD .htaccess configurations that do this kind of caching, which may create similar problems to other cases too that will need similar patching.
Please decide something,
You are not permitted to use that link to directly access this page It is totally wrong for the user, it means nothing to the user, it does not inform the user of the real reasons. It is a message for programmers that have studied Joomla code Proper: Edit request has failed temporarily. Please try again. If this is repeated for the same record multiple times, then it means that your server has been misconfigured and tells browser to cache edit requests. Please contact your administrator to disable caching via HTTP headers (e.g. in .htaccess) ok, not exactly the above, but something like it |
This comment was marked as abuse.
This comment was marked as abuse.
Any error message should be written in non technical language and be the
minimum information needed. A technical essay is not appropriate for an
error message
|
@durian808 I cannot reproduce the issue as well as already expressed in the referred thread #10757 . I believe you when you tell the world that you are experiencing this issue but again posting access details to your Siteground or joomla.com account won't help you resolve this issue which has not been identified as a bug or whatever you wish to call it by the JBS nor the CMS Release Team so only if we can replicate this by following steps to reproduce as Thomas mentions we can start working on a solution |
Steps to reproduce the error: Environment apache2.conf settings (different from fresh installation)
Steps
You can view the sequence of HTTP requests and responses here:
So, the first question is why request The second question is why requests with 200 responses include the heading It seems to me that the browser caching issue comes after these initial problems, and it just makes it worse by getting the browser stuck in using the same cached 303 response. In my opinion this is a real bug and it should not be dismissed. |
Except for one person, nobody's tried to dismiss it. But as this and other threads have pointed out it's not exactly the easiest thing to reproduce.
That's coming from the browser or web server configuration, not Joomla. Joomla doesn't have response caching like this. That is in part why this issue exists.
Depends if it's Joomla or something else issuing the redirect I guess. If it's Joomla issuing the redirect then perhaps the right headers aren't being attached ( |
So nice one but allow me to reply with a first simple question:
*Environment*
Centos 7.2
Apache 2.4
5.5.5-10.1.13-MariaDB-cll-lve
PHP 7.1.0
Server API FPM/FastCGI
None of what you describe is happening to any site on our servers nor on
some client servers located at major hosting providers
(Liquidweb/Bluehost/Hostgator to mention a few) so I cannot replicate!
what we have on Modules "not save etc" is widely commented on the Joomla
forums and has been identified by contributor Sozzled among others and
he is right : https://forum.joomla.org/viewtopic.php?f=709&t=937052
(READ THE ENTIRE THREAD PLEASE!)
This issue is confirmed by me as well as described by Sozzled and is
therefore as described not a Joomla issue imho
Leo
…On 1/6/2017 10:43 PM, lyquix-owner wrote:
Steps to reproduce the error:
*Environment*
Ubuntu 14.04
Apache 2.4.7
MySQL 5.5.53
PHP 5.5.9
*apache2.conf settings (different from fresh installation)*
|MaxKeepAliveRequests 0 <Directory /srv/www/> Options FollowSymLinks
AllowOverride all Require all granted </Directory> # Browser Caching #
ExpiresActive On ExpiresDefault "access plus 30 days" ExpiresByType
text/html "access plus 15 minutes" Header unset Last-Modified Header
unset ETag FileETag None |
*Steps*
* Fresh Joomla 3.6.5 installation
* Log in to Administrator
* Go to Modules
* Click on the Breadcrumbs module
* Click Save & Close
* Click on the Breadcrumbs module again
* You get the error message /You are not permitted to use that link
to directly access that page (#17
<#17>)./ and the list of
modules is displayed again
* If you click on the Breadcrumbs module again no warning or error
message is displayed this time and it shows the list of modules again
You can view the sequence of HTTP requests and responses here:
http://imgur.com/a/h8QJe <url>
1.
Display list of modules
GET: |?option=com_modules|
Response: 202
2.
Click on Breadcrumbs module:
GET: |?option=com_modules&task=module.edit&id=17|
Response: 303 / Location:
|?option=com_modules&view=module&layout=edit&id=17|
*GET: |?option=com_modules&view=module&layout=edit&id=17|
Response: 202*
3.
Save & Close module
POST: |?option=com_modules&layout=edit&id=17|
Response: 303 / Location: |?option=com_modules&view=modules|
GET: |?option=com_modules&view=modules|
Response: 202
4.
Click on Breadcrumbs module again:
GET: |?option=com_modules&task=module.edit&id=17|
Response: 303 / Location:
|?option=com_modules&view=module&layout=edit&id=17|
*GET: |?option=com_modules&view=module&layout=edit&id=17|
Response: 303 / Location: |?option=com_modules&view=modules|*
GET: |?option=com_modules&view=modules|
Response: 202
So, the first question is why request
|?option=com_modules&view=module&layout=edit&id=17| produces a 202
response the first time, and a 303 response the second time
redirecting to the modules list?
The second question is why requests with 202 responses include the
heading |Cache-Control: no-store, no-cache, must-revalidate,
post-check=0, pre-check=0| but the same heading is not enforced on 303
responses?
It seems to me that the browser caching issue comes after these
initial problems, and it just makes it worse by getting the browser
stuck in using the same cached 303 response.
In my opinion this is a real bug and it should not be dismissed.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#10753 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AHzLNntKAKVAZvRg72y84EumvzY-HT2fks5rPmEGgaJpZM4IwcBB>.
|
This comment was marked as abuse.
This comment was marked as abuse.
This comment was marked as abuse.
This comment was marked as abuse.
@PhilETaylor can you provide an example of how to fix an edit link? I am no expert but I am happy to help with this issue, if I can get some direction from you or @ggppdk. You both seem to have an understanding of the problem and its solution. |
@PhilETaylor why have you not proposed (!) a solution yet knowing so (seemingly) well what the issue is as you emphasize ..... Curious (and not a personal attack) ? |
This comment was marked as abuse.
This comment was marked as abuse.
Oh Phil...I do follow you believe it or not......Yeah you described that in "CASE 2: " https://github.com/joomla/joomla-cms/pull/10753#issuecomment-236978677 Question is why nobody followed up on that? |
CASE 1:
CASE 2:
Solution CASE 1:
CASE 2:
So besides the above, The 303 redirect response , that redirects from edit-task to edit-layout ("view") is missing both headers: Which brings us to the 3rd case??
|
A small suggestion (bear in mind I am no expert). Add the following lines to
This adds the headers on all redirects. Problem solved. I am unaware of issues that this may cause. Experts can weigh in. |
This comment was marked as abuse.
This comment was marked as abuse.
The place to add it is here: Like this: header('Expires: Wed, 17 Aug 2005 00:00:00 GMT');
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
header('Cache-Control', 'no-store, no-cache, must-revalidate, post-check=0, pre-check=0');
header('Pragma: no-cache');
$this->setRedirect(
JRoute::_(
'index.php?option=' . $this->option . '&view=' . $this->view_item
. $this->getRedirectToItemAppend($recordId, $urlVar), false
)
); [EDIT] |
This comment was marked as abuse.
This comment was marked as abuse.
Until someone extend that to incorporate such functionality, the only way to do it is the one @ggppdk proposed. My 2c |
No no
because JApplication::redirect is either bogus or at least let's say "incomplete" You cannot use (due the current implementation of JApplication::redirect()) JFactory::getApplication()->allowCache(false); nor: JFactory::getApplication()->setHeader('...', '...', true); Because both the variables that are set by the above methods, both of them are ignored by JApplication::redirect() even if you use
Best solution is to "fix" JApplication::redirect()
|
Bingo! Stop thinking about local hacks and fixes, these aren't your extensions you're working with folks. Fix core the "right" way. |
Yes, and also fix JApplication::redirect() |
This comment was marked as abuse.
This comment was marked as abuse.
How about: on
|
This comment was marked as abuse.
This comment was marked as abuse.
This comment was marked as abuse.
This comment was marked as abuse.
This comment was marked as abuse.
This comment was marked as abuse.
Open a new issue for that. Thanks. |
…13516) * Fix “You are not authorised to view this” when mod_expires enabled Closes #8731 Dec 18, 2015 Closes #8757 Dec 21, 2015 Closes #9013 Jan 28, 2016 Closes #9145 Feb 17, 2016 Closes #9615 Mar 26, 2016 Closes #10753 Jun 7, 2016 * code style * Unit test refactoring (cannot do it the old way as relative dynamic dates in headers) * Remove duplicate header output for charset * Better Unit Tests * More unit tests :) * Close after setting headers * Do not cache the response to this, its a redirect
Out of nowhere, while we are busy adding modules, working on some menus, adding articles, and there is a request to edit a long time existing module then suddenly we encountered this error. Tried to log out, clear all cache - Joomla and browser. Empty the session table but not luck I change the Administrator's template and I can confirm that this fix the problem on my side. Can someone try also to change Admin template and edit those article or module? |
Add some fault-tolerance to the system and recalculate edit permission (also checking out the record)
CASE 1: The initial "edit-task", failed to update session properly, due to race-conditions
CASE 2: The initial "edit-task", was never called because the HTTP request was cached by the browser for any reason
See issue here for a detailed discussion: #8757
NOTE:
3rd party extensions that extend JControllerLegacy need to re-implement this,
Maybe best solution would be instatiate the view inside the controller add / edit task,
Testing:
Try adding this to your .htaccess to force browser caching of the requests that try to add article/record "is-editable" into the sessions (NOTE: the bad effects for the effected URLs will persist for an hour, so do not add more to it)