Hi, great idea for a module.

Here is how we do it in my company:

# protect .txt files from exposing info about the drupal version and close the DoS attack vector towards cron.php
# Also defend update.php / install.php
  <LocationMatch ^/(cron)\.php$|^/[A-Z][A-Za-z.]*\.txt$>
    Order deny,allow
    Deny from all
    Allow from 127.0.0.1

    ErrorDocument 403 "Good day! You do not have access to this resource. (error 403). If you think that you should have access - email us at office AT velko.org<br />Back to <a href=\"http://velko.org\">velko.org</a>"

  </LocationMatch>

Why not make your drush command ask what to do and output this text as an option?

Possibly drupal-core version aware and updated with more file definitions - like the READMe-s not in the drupal root...

Thanks for the follow-up - if you do.

Comments

abaddon’s picture

an apache upgrade can cause htaccess to fail and expose sensitive stuff, a failure could be provoked, i use the above too when im lazy, when im not i rm-rf every test, readme, and extra files not needed for the site to function

Chris Charlton’s picture

Thanks for the feedback.

I think cleaning out the files versus hiding them is an administration preference. Both solutions are good. Others have debated heavily over even the fact if hiding the files is really a security practice or a false sense of security, and while I don't want to spark that debate here I always think Drush & Drupal is happy to take new contribs that satisfy each method/preference.

@rsvelko - Your idea would be best as another plug-in, or as a add-on to maybe something like a Security Report module that may already exist.

@abaddon - You mention you clean out the tests too, if I added a tests folder cleanup argument to this command I would require a Y/N prompt since someone may name a folder "tests" for something else and I wipe out that folder, which would suck for them. No undos.

@EVERYONE - Any interest in seeing this plug-in clean out the README.txt, LICENSE.txt, & INSTALL.txt files from contrib modules/themes?

Chris Charlton’s picture

Status: Active » Closed (won't fix)