Upgraded from 7.x-2.4 to 7.x.2.8 and then could not longer save a change to a css file - When clicking save a dialog box appears with the message 'The url used contains a sub-filextension which poses a security threat. Saving not allowed.' Tested on 7.14 and 7.18 -reverting to 7.x.2.4 resolved the problem.

CommentFileSizeAuthor
Screen Shot 2013-01-20 at 21.34.29.png31.97 KBpault

Comments

pault’s picture

Some extra info - No messsage in the system log but message in admin area - 'For security reasons, your upload has been renamed to http://www.xxxxxxxx.co_.uk/themes/etc ie an underscore is inserted - but the file has not been uploaded

guybedford’s picture

Thanks. I've included a fix on the dev branch. Let me know if this works for you and then I will re-release.

pault’s picture

Thanks for the quick response but unfortunately I'm getting the same error with 7.x-2.8+0-dev. I'm relatively new to Drupal so if there is any more info you require please let me know.

guybedford’s picture

It seems the dev branch hasn't updated yet. I've pushed out the change into a 7.x-2.9 release now anyway so that should sort it.

pault’s picture

Great - 7.x-2.9+0-dev has resolved the issue. Thanks

pault’s picture

Status: Active » Closed (fixed)

Resolved.

Robert_T’s picture

Status: Closed (fixed) » Needs work

Just installed a fresh Drupal 7 site using live_css version 7.x-2.9. This was derived from a staging site, which also had live_css version 7.x-2.9. Both sites have identical file structures and identically-named css files. We had no issues on the staging site, but on the new site we encounter the "The url used contains ..." message, followed by the message "For security reasons, your upload has been renamed ..." on a subsequent page load. Both sites have variable 'allow_insecure_uploads' set to FALSE, so file_munge_filename() should work the same on both sites. Ideas?

Robert_T’s picture

Version: 7.x-2.8 » 7.x-2.9
guybedford’s picture

I was asked to add this as a security fix. The previous version doesn't use the file_munge_filename for security.

Can you see what the path is that is being saved? It should then hopefully be obvious why it is returning the error.

Normally it will give an error for filenames that contain a '.'. So any file that looks like file.php.less will not be able to be saved.

If you let me know the full filename I can try and give some suggestions or see if this is a bug.

Robert_T’s picture

Status: Needs work » Closed (fixed)

Found it. The site root folder was named subdomain.example.com. By changing the site root folder to subdomain_example_com, I avoided triggering the file_munge_filename() failure. Thank you for the fast response!

guybedford’s picture

Glad that worked. Unfortunately I have to add this in for security - sorry about that!

hozt’s picture

Is there any way around this? On a multi-site drupal install the directories are named as the domain name i.e. sites/mydomain.com

guybedford’s picture

Ok, I can see how that can be a problem. I've added a fix that should restrict the check to the filename only. It is in the development branch, and should update shortly (can take a few hours).