Currently we hard-code some checks for authored by and authored on node fields by surrounding their validation and processing in node_validate() and node_submit() with user_access('administer nodes'). If users don't have access to those fields, it should be impossible to submit invalid data, so why should we bother skipping it. This only hurts modules like Override node options that alter core node form elements to make them accessible by individual permissions.

CommentFileSizeAuthor
#1 683630-node-remove-stupid-D7.patch2.64 KBDave Reid
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Dave Reid’s picture

Status: Active » Needs review
FileSize
2.64 KB

Removes the check for 'administer nodes' permission. Let's see how the bot likes it.

agentrickard’s picture

Issue tags: +D7DX

Yes, please.

In fact, we should probably open a meta-issue to remove all access checks from validate and submit functions.

moshe weitzman’s picture

Status: Needs review » Reviewed & tested by the community

Indeed. These checks are pure cruft.

drewish’s picture

subscribing

agentrickard’s picture

dww’s picture

<hat class="security-team">

Yes, definitely RTBC. This patch is making core more secure since we're now *always* validating these fields, not just for folks with 'administer nodes'.

</hat>

Dries’s picture

Status: Reviewed & tested by the community » Fixed

Looks good to me. Committed to CVS HEAD.

Dave Reid’s picture

Arg we didn't have any test coverage to know this was broken, but it is even before this patch landed. You can't change node authors. Working on a quick test.

Dave Reid’s picture

So the check for !isset($node->uid) is pointless because it's *always* going to be defined. We should just check of $node->name is set.

Dave Reid’s picture

Priority: Normal » Critical
Status: Fixed » Needs work
Issue tags: +Needs tests
dww’s picture

@Dave Reid: #8 implies this is a completely distinct bug, separate from this change. I'm not sure why we're piling it on here. Why not open a new critical bug and mark this one fixed? This didn't have anything to do with the problem...

int’s picture

2 Issues for one bug, is too much.. We need a new Status Message, instead of one tag Needs tests, I think is better to know this Issue is fixed, and only "Needs tests"

Dave Reid’s picture

Priority: Critical » Normal
Status: Needs work » Fixed
Issue tags: -Needs tests

We've got an existing critical issue open at #492186: Authoring information is never updated. for not being able to update node names. Reverting meta-data and marking as fixed.

dww’s picture

@int: I think you misunderstand me. I'm not proposing 2 issues for 1 bug. There are two completely unrelated bugs. This bug is about pointless access checks that make life difficult for contrib modules. The other bug is about not being able to change the owner of a node when you edit it. They just happen to touch nearly the same lines of code... My point was that it's silly to keep talking about the 2nd bug in the issue that already fixed the first.

@Dave Reid: Thanks. That's exactly what I meant. ;)

Cheers,
-Derek

Status: Fixed » Closed (fixed)
Issue tags: -D7DX

Automatically closed -- issue fixed for 2 weeks with no activity.