A role that doesn't have permission to create nodes of a given content type can still create them if the content type contains an underscore in its machine name.

Example:

Content type machine name: content_type1

User doesn't have permission to create/edit nodes of type content_type1, but there is a bug that allows him to create such nodes.

If the machine name is renamed to contenttype1, without the underscore in the machine name, everything works normally, and user cannot create nodes of contenttype1 if he doesn't have the permission.

Comments

mlachance’s picture

Priority: Normal » Critical

This is a security flaw. Flagged as critical.

joachim’s picture

Status: Active » Postponed (maintainer needs more info)

Could you explain how to reproduce this?

I made a content type called 'under_score' and as an anon user I get an access denied at node/add/under-score

odegard’s picture

I've got a site with users allowed to create node types of type A. I then created a new content type called test_test. I did not give permission to create test_test for this particular user. Tried to create a node by going to /node/add/test_test but that did not work.

So, can not reproduce I guess.

dunlop’s picture

Status: Postponed (maintainer needs more info) » Active

Instead of using:

/node/add/test_test

for the test, the path should be:

/node/add/test-test

since underscores are converted to hyphens when used in a url.

joachim’s picture

Status: Active » Postponed (maintainer needs more info)

I still can't reproduce this.

miiimooo’s picture

Version: 7.10 » 7.14
Status: Postponed (maintainer needs more info) » Active

It's correct that you get an "access denied" on node/add/HYPHENATED-CONTENT-TYPE-NAME

The problem really is with menu_router but I can't exactly see where it is:

To reproduce:
1. (as before) create a content type with an underscore content_type1
2. go to permissions and remove the create permission for this content type from authenticated user (or admin)
3. create a menu entry node/add/content-type1 in a visible menu
4. result: although the role doesn't have permission to create content of type content_type1 the menu item is still shown. Clicking the link takes you to "access denied". Here the check is done correctly.

My suspicion is that the router access check for node/add/content-type1 somehow leads to a check for creating content in general but I can't see where this happens. It's linked to the underscore.

Maybe this should be in the menu component.

UPDATE: And just now as I clicked refresh the menu item disappeared. I guess it's a menu router rebuild issue then.

marcingy’s picture

Priority: Critical » Normal

This is not critical as you can't actually do anything it gives a 403.

pasqualle’s picture

Issue summary: View changes
Status: Active » Closed (cannot reproduce)

- inaccessible menu items are not displayed, that's how it works
- nobody can reproduce the origin issue reported here