Download & Extend

Every anonymous user has author role access

Project:Workflow
Version:6.x-1.x-dev
Component:Code
Category:bug report
Priority:major
Assigned:Unassigned
Status:needs review

Issue Summary

Not sure if this is technically a bug, but any anonymous user can view/edit/delete nodes created by other anonymous authors when workflow access is set to author role.

I think the author role should only apply to nodes created by authenticated users, otherwise the author role access permission becomes relatively meaningless for node types that can be created by both authenticated and anonymous users.

Attached is patch which will return the workflow_access_owner grant id as $node->uid only for authenticated users, otherwise it returns 1 (e.g. superuser). Previously, it could also return 0 which, as I said, is every anonymous user.

AttachmentSize
workflow_access-anon-author.patch620 bytes

Comments

#1

Priority:normal» critical

Very much a security flaw imo; drupal general treats uid 0 isn't a real user so shouldn't be treated as a user, right?
ie from node_access

<?php
 
if ($op == 'view' && $account->uid == $node->uid && $account->uid != 0) {
    return
TRUE;
  }
?>

ie most users would not think this the behaviour, I'd think XD

Anyhow I added the additional check

<?php
function workflow_access_node_grants($account, $op) {
   
$access['workflow_access'] = array_keys($account->roles);
    if (
$account->uid) $access['workflow_access_owner'] =array($account->uid);
  return
$access;
}
?>

as a double gotcha so uid 0 doesn't get workflow_access_owner permission.

AttachmentSize
workflow_access_additional_check.patch 631 bytes

#2

Category:bug report» feature request
Priority:critical» normal
Status:needs review» needs work

It's not bug: it was decision of module author to make it work like that. And you can't change default module behavior only because you don't like it, in this case. Some people may want to treat all anonymous users equally and allow edit between all anonymous content. So if you want to change default behavior in the module, you need to implement it as module setting which can be switched to what user likes.

#3

Hm, I see ya point,

There may be a bug then in workflow_field_choices in that anonymous users are not given the author role

<?php
 
if (($user->uid == $node->uid && $node->uid > 0) || (arg(0) == 'node' && arg(1) == 'add')) {
   
$roles += array('author' => 'author');
  }
?>

Anyhow here's my new suggestion for a patch. It introduces one variable, worklfow_user0_is_author and one alter hook 'workflow_authors'. Twas done that way to other modules could alter who is considered an author as far as work flow is considered; useful for those using user reference to have several authors? Missing one $node->uid in workflow_access ie. in workflow_access_form_submit; not sure what that form is doing.

AttachmentSize
workflow_author.patch 5.13 KB

#4

Some people may want to treat all anonymous users equally and allow edit between all anonymous content.

Can anyone give me a realistic use case where anonymous user permissions > authenticated user permissions?

As the module now stands, an anonymous user could view a node created by another anonymous user whereas an authenticated user could not... that makes sense how? where? when?

Further, said authenticated used could just logout and then view the node. It's pretty clearly a flaw in logic... unless I'm missing something (likely).

#5

Version:6.x-1.1» 6.x-1.4

(Applies to version 6.x-1.4 too.)

John's primary solution sounds reasonable and works. Thanks a lot.

#6

I just setup the first patch in this que.
It was simple and I have no use for anon authors in our workflow.

However, the patch in #3 looks valid and more flexible.
Which I like.

Anybody want to check it out and try and get it committed?
I'm 'subscribing' so I can come back to it later.

Thanks for the patches!

#7

Category:feature request» bug report
Status:needs work» needs review

As core sets uid to 0 for all nodes created by a user when it's deleted, and that there's no configuration, this is a bug, and might be a security issue. All anon users gaining access to nodes created by a deleted user!

Updated patch 3 to remove the variable as it seems unnecessary overhead; the alter hook on the occasion someone would want to customize this, can. fixed some coding style issues, but haven't re-tested it.

AttachmentSize
437874_workflow_author.patch 2.92 KB

#8

Removing "$" from beginning of call for workflow_get_authors from the patch on #7.

Adjusting coding style and tested hook_workflow_authors_alter.

Also changing out "SELECT *" to only the necessary fields.

All seems to work well.

This patch is against 6.x-1.4.

If I have time later I will make one against dev.

AttachmentSize
437874-8_workflow_author.patch 3.88 KB

#9

+1 for this. I was wondering why when I logged out I was able to edit workflow settings on certain nodes. The reason was that when I migrated all of my old content to Drupal, my migration script saved all of the nodes as an Anonymous user. So if you weren't logged in, you had access to workflow settings because you were also an Anonymous user. This definitely doesn't make any sense. Thanks for the patch!

#10

hm, didn't apply to dev, so here's an re-done

AttachmentSize
437874_workflow_anon_10.patch 3.12 KB

#11

Failure of a manual apply

AttachmentSize
437874_workflow_anon_11.patch 3.72 KB

#12

And realized an update operation is needed to say to rebuild node access :/

AttachmentSize
437874_workflow_anon_12.patch 4.15 KB

#13

Forcing someone to rebuild all node access is a bit of a PIA for big sites; here's one that just drops the owner for uid = 0;

AttachmentSize
437874_workflow_anon_13.patch 4.25 KB

#14

Version:6.x-1.4» 6.x-1.x-dev
Priority:normal» major

This bug allows spammers to find and edit nodes, deleting and posting anything they want. It's a major problem that can disrupt a site and I dont know if it isn't even a security issue...

nobody click here