I've been using some python scripts to push data into a Drupal instance over XMLRPC, and have been coding against the 2.2 release. When I upgraded to the 2.3 release, a couple of things have changed and it no longer worked. Firstly, I had to grant anonymous users permission to access the taxonomy, even though I'm using session identification. Secondly, having fixed that issue, I now get 'Access denied' errors when calling node.save, despite the fact that the permissions are set up fine and that the same called worked under 2.2.
I'm using simple session authentication, and suspect that is part of the problem. Unfortunately, I can't find my way from the security report (http://drupal.org/node/986798) or the release notes (http://drupal.org/node/986550) back to the issues or code changes involved, so I'm having trouble diagnosing it myself. Of course, I may well be doing something wrong, so before I submit an example, I'd like to find the issues and code changes that were made between 2.2 and 2.3 in order to work out what I might be doing wrong.
| Comment | File | Size | Author |
|---|---|---|---|
| #28 | services-987002_1.patch | 1.39 KB | marcingy |
| #26 | services-987002.patch | 1.5 KB | kylebrowning |
| #24 | 987002.patch | 674 bytes | gdd |
| #21 | 987002.patch | 672 bytes | gdd |
| #12 | services-987002.patch | 855 bytes | kylebrowning |
Comments
Comment #1
lord_of_freaks commentedSubscribing
Comment #2
gddIf you look at the CVS commit messages
http://drupal.org/project/cvs/109640
Then you may be able to start tracing your problem back to one of those commits. I think this is the easiest way to see what has changed recently. I will try and test this sometime soon, but I'm still trying to get settled in after my overseas move so perhaps marcingy or kylebrowning can find the time.
Comment #3
rafamatito commentedSubscribing
Comment #4
gddDoes the large number of subscribers in a short period of time mean others are having this problem?
Comment #5
rafamatito commentedYes, I'm developing a service module based on services. I'm using PHPXMLRPC for the client to test the service, yesterday it worked fine, but today after the update I got 'access denied'. Here is my code in the client side:
...
$auth_session_id = new xmlrpcval($auth_session_id, 'string');
$m = new xmlrpcmsg('mymodule.mymethod', array($auth_session_id));
$c = new xmlrpc_client('/services/xmlrpc', 'myhost', 80);
$result = $c->send($m);
...
And this is the code in the server side:
function mymethod() {
global $user;
module_load_include('inc', 'views_service');
$result = views_service_get('view_name', 'default', array($user->uid));
return $result;
}
Before the update $user in mymethod was the $auth_session_id user, but today is anonymous user, so I've got 'access denied'.
P.D: Sorry for my bad english.
Comment #6
johannesdr commentedI can confirm this problem when using the deployment module.
node.save and system.cacheClearAll give an access denied error.
system.connect and user.login however do work.
Comment #7
zeger commentedThe bug is due the incorrect handling of sessions when using xmlrpc client (the session is never set and due to the update of line 866 in services.module this problem has surfaced)
A quick solution is to comment out line 872 in service.module
Comment #8
threexk commentedI also have this problem after upgrading to 6.x-2.3: "Access denied" when trying to call methods that were working under 6.x-2.2.
Comment #9
threexk commentedComment #10
gddzeger can you elaborate? im not sure i understand what you're getting at. I recommend that people DO NOT comment out line 872. There are very good security reasons that line exists.
Comment #11
edonnelly commentedI'm in the same boat as the OP, but the method that is failing for me is views.get. Permissions and everything worked fine until the 6.x-2.3 upgrade. Now I get the "access denied" error unless I change the view's permissions and grant access to the view to "anonymous user." [Using REST server].
Comment #12
kylebrowning commentedOK i think ive figured this out.
The issue was in node_service module.
Let me know if it works
Comment #13
kylebrowning commentedIt would help if everyone gave a list of what methods are working in 2.2 and which ones are not working in 2.3.
Ive tested all of the endpoints with anonymous and logged in user with permmission for certain endpoints
Access denied errors are there when that user(anonymous or not) does not have permission to execute that function. By allowing them permissions on the permission page I no longer see that error.
With the applied patch, everything seems to be working correctly.
@Edonnely I believe that is working as intended. If you told the view to have certain permissions to check against, its going to do that. You are saying it was working in 2.2 though, can you give me anymore informaiton?
Comment #14
miraclegr commentedI can confirm that the problem persists.
I'm using node.save that worked in 6.x-2.2 and now is giving access denied.
Comment #15
kylebrowning commentedmiraclegr, did you apply that patch?
Comment #16
miraclegr commentedYes I did.
What I'm trying to do is create a new node of type x.
I've given permission to authenticated users to create node type x.
Comment #17
threexk commentedI am experiencing this problem with custom service methods defined via hook_service(). I suspect the problem is deeper than the node_service module.
Comment #18
marcingy commentedI don't use session auth so none of the testing I did used it but I believe the problem is in around this area
And was added by http://drupal.org/node/931184 - I might be wrong but it is the only change that affects session handling.
I'm thinking it should infact be
Comment #19
welovedrupal commentedJust to report my testing with this - I am also seeing this problem after upgrading the services module. I am using a php script with curl to connect to Drupal Services. I am able to get a user with user.login but when I call node.get I see the access denied error now. I have tried both as user 1 and a user that should have access to the node. Inside the Drupal services interface I can supply an nid on the node.get form for the server I am using (json_server) at admin/build/services/browse/node.get and it does return the node. My php script worked until I upgraded the module.
Comment #20
gddI believe marcingy is right in #18, although I think it has to be
Otherwise you'll be back to getting the warning this code was changed to fix in the first place. Going to try and do some testing on this tonight.
Comment #21
gddOK here's a new patch. I tested the released 6.3 and got access denied, then with this patch everything worked. Please test and report back. If everything is good I will roll a new release.
Thanks all.
Comment #22
marcingy commentedshould it be
Comment #23
anj commentedThe patch in #21 works for me, and restores the functionality I lost.
The version in #22 is missing a bracket, but I'm guessing you meant
But I think this should be functionally equivalent to the patch in #21, because && takes precedence over ||. However, perhaps this is a coding-standards thing I'm not aware of.
Comment #24
gddWhile functinally the same I like the extra set of parens because it is more explicit and clear. New patch attached.
Comment #25
kylebrowning commentedI also feel like my above patch in #12 still applies to fixing part of this issue, can we get both patches rolled into one?
Comment #26
kylebrowning commentedAttached is 1 patch with both patches :P
Comment #27
gddI'd like to see one more of the people in this issue testing the patch then I think I'm ready to go.
Comment #28
marcingy commentedSame as above patch just removes a stray space. As with Heyrocker this looks good to go once we have some more testing feedback.
Comment #29
jaypanSubscribing. I'm finding that session data is not getting saved to the sessions table upon user.login or user.get. The table always shows the user as being anonymous. I explained it a little more in detail here: http://drupal.org/node/988018
Comment #30
marcingy commented@Jay Matwichuk can you test the above patch as it should result in user.login recreating session table entries.
Comment #31
jaypanThe patch in #28?
(thanks for the response by the way)
Comment #32
marcingy commentedYeah well actually the patch in #26 or #28 as they are the same except for an extra space character ;)
Comment #33
jmseigneur commentedSubscribing
Comment #34
threexk commentedPatch in #28 fixed the problem for me. All my services seem to be working properly, although I do not use the Node Service module. Thanks for your efforts.
Comment #35
jaypanThe patch in #28 has fixed my problem. My authenticated session data is now being saved to the sessions table in the database. I don't use the node_services though, so I cannot comment on whether that is working or not.
Comment #36
aspedia commentedPatch in #28 fixes the problem here! Lets get a commit!
Comment #37
edonnelly commented@kylebrowning (comment #13)
My site has no publicly-available information and only serves pages to authorized users. The views also have availability set only to authorized users. In 2.2, if a user was not logged in, the view would not be served by the REST server, while if he/she were logged in, it would be served. With 2.3, even logged-in users get the "Access Denied" error when calling views.get.
EDIT: I applied the patch, though, and it is working! Much thanks!
Comment #38
gddHave you tried the patch in #28? or just the one in #13?
Comment #39
edonnelly commentedYou're right, I had only tried the patch with half the fix. Thanks! Working now, I edited the above to avoid future confusion.
Comment #40
kylebrowning commentedI think this is RTBC, soo Ill mark it as such.
Comment #41
gddOK this issue has been fixed and a new release has been done. Upgrade to 2.3 for the fix for this issue. Thanks all.
Comment #42
kylebrowning commentedHe meant 2.4, marking this as fixed