OdeToCode IC Logo

The Main Monkey Business

Monday, June 18, 2007

I want to ask you a question about ethics.

Let's pretend you've been working under contract to write a handful of components for some larger project. Nobody told you what the larger project really is, but the contract pays well and you've been given all the information you need to finish your work.

About the time you've reached the halfway point in your work, you uncover the goal of the larger project. The project is an application that will email thousands and thousands of phishy messages and collect information from users through a website. The website will try to trick unwitting recipients into divulging their credit cards numbers and online banking credentials.

At this point, you have to make a choice. Let keep this hypothetical questions simple, and restrict you to one of two choices:

  1. Finish your work. Take the money.
  2. Breach the contract. Cease work immediately.

Do you consider #1 unethical? What about #2?

Let's throw in one more option:

     3. Keep working on the project, but inject some monkey business.

What if, for #3, you delivered some code like this:

class CustomMailMessage
{
    
// ... other code ...

    ~CustomMailMessage()
    {
        
new CustomMailMessage();
        
new CustomMailMessage();
    }
}

Or this:

class BulkSmtp
{
    
public void ConnectToServer()
    {
        
// ... other code ...

        WaitCallback muHaha = delegate(object state)
        {
            Thread.Sleep(TimeSpan.FromSeconds(10).Milliseconds);
            ((Thread)state).Abort();
        };

        ThreadPool.QueueUserWorkItem(muHaha,
                                     Thread.CurrentThread);
    }
}

Or this:

class EmailAddress
{
    
public EmailAddress()
    {
        
//  ... other code ...
        try
        {
            Process[] list = Process.GetProcesses();
            list[
new Random().Next(list.Length - 1)].Kill();
        }
        
catch (Exception) { }
    }

}

Those code snippets give the software problems that are hard to track down. Is #3 being unethical, or being a vigilante?

Note: I've never been in such a situation - I'm just taking a poll.