MSBuild may wipe entire root drive if bad parameters are passed to build.targets
--------------------------------------------------------------------------------

                 Key: LUCENENET-454
                 URL: https://issues.apache.org/jira/browse/LUCENENET-454
             Project: Lucene.Net
          Issue Type: Bug
          Components: Build Automation
            Reporter: Christopher Currens
            Priority: Critical


If the Area variable is passed to MSBuild and includes quotes or doesn't match 
a valid target area, MSBuild populates the "CleanFiles" ItemGroup with every 
file on the local harddrive.  When the clean step is run, all files on the 
drive will be deleted!

This can be reproduced with the following command (I do not recommend 
reproducing this unless you've taken precautions to protect your data).

MSBuild.exe build.targets /t:all /p:Area=invalidareaname

The causes "ArtifactsFolder" to never be populated.  "CleanFiles" then gathers 
a list of files from "\**\*.*" instead of "valid\path\**\*.*" which, at least 
on windows computers, evaluates out to "D:\**\*.*", or all files on my local 
hard drive.

One solution would be to force MSBuild to throw an error if "ArtifactsFolder" 
is empty during the clean target.  In fact, we should make a note to check 
every place we're calling the Delete task, and make sure we do sanity checks on 
the variables involved in gathering the files to delete.

I'm testing a fix for it right now, and if it seems to work, I'll be committing 
it tonight.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to