I marked this critical because it has the potential to crash a site hard, even though the site will appear to function normally up until the time the bug is triggered/detonated.

On page http://example.com/admin/content/types/add, you can specify for "Type", the machine-readable name of the content type, such values as 'group' or 'access'. If the table node_group, for example, already exists, CCK will report that the type was successfully created. The only indication of error is that the second normal success message, which would say "The content fields table node_group has been created", does not appear.

(A clever sysadmin like me can compound the problem by then renaming the created type. This has the effect of renaming node_group or node_access to node_foo, again with no indication of error. Ouchie. "Good thing I made a backup!" he gasped, spitting out the pills and re-stowing his revolver.)

Best I can tell, CCK allows any type name, with the potential for table-name collisions with all of of the tables node_* that aren't part of the node_typename pattern, including node_access, node_group, node_group_fields, node_type, and node_counter.

In most cases I expect this bug will only cause the content type in question to fail. However, if any unlucky soul renames such a type and triggers the second level of the bug, the database could be damaged to the point that many site admins couldn't hope to repair it.

I recommend a couple of changes:

  1. Change the table-naming scheme from node_typename to something like nodetype_typename, or even better, ccktype_typename.
  2. If for any reason this cannot be done quickly, and I can imagine a few, content.module should be modified with a list of unacceptable typenames. If the user tries to use one of the Typenames of Doom™, he should get an error message and the type should not be created. It might also be good to add that list of names to the description string for the Type field on the form.

I'll try to submit a patch soon, but I wanted to get this report in first, before anyone (else) trashes their database.

And remember, kids: backup, backup, backup, backup, backup! :-(

Comments

yched’s picture

Status: Active » Closed (duplicate)

there's an ongoing patch about this : http://drupal.org/node/105787
It's been paused until we got the 1.2 release packed, but we should go ahead with it now.