Home > SOA Tips > .NET Developer > Best practices for secure code
SOA Tips:
EMAIL THIS
 TIPS & NEWSLETTERS TOPICS 

.NET DEVELOPER

Best practices for secure code


Benjamin Vigil
04.06.2004
Rating: -3.20- (out of 5)


Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   


Though security is usually associated with the perimeter; firewalls, IDE and antivirus software, the security of your systems often boils down to how securely the code of your applications was written.

While attending VSLive 2004 in San Francisco, I picked up a few best practices for designing and writing code within the .NET framework. But first, here are some of the threats that your code might be exposed to, courtesy of Gabriel Torok, PreEmptive Solutions:

  • Spoofing
  • Tampering
  • Repudiation
  • Information disclosure
  • Denial of Service
  • Elevation of Privileges

This list provides the easy to remember acronym STRIDE. Torok recommends that you categorize the possible threats to your code into the above categories. Since security is about protecting assets, he also suggests that you rank the threats according to the menace they pose:

  • Damage Potential
  • Reproduce-ability
  • Exploitability
  • Affect on users
  • Discoverability

This list also provides a handy acronym: DREAD.

So once the threats are identified and categorized, how do you go about making sure your code is secure? The first step is to develop the correct mindset: consider security to be a feature of your code. Security should be one of the first considerations in the design process. Portability and efficiency are admirable code qualities, but so is security. Spend time on developing it early in the process.

Once you have established security as a part of your process, here are some more tangible best practices:

  • Follow the principle of least privilege. Only allow the code access to the minimum files and directories.
  • Encryption standards. Use encryption for password transport. And don't roll your own. The .NET framework supports encryption and standard encryption algorithms have proven their security.
  • Prevent reverse engineering and tampering. Encryption is not useful to prevent reverse engineering since the code has to be unencrypted to run. Obfuscation is the best way to secure your code and protect your intellectual property. An obfuscator called Dotfuscator is available in the .NET Framework.
  • Fail and recover securely. Test every line of code, even error handlers. Make sure your code is not susceptible to a buffer overrun.

You may want to consider having people on staff that specialize in security. And remember, a secure product is a better product.


Benjamin Vigil is a technical editor for SearchWebServices.com


Rate this Tip
To rate tips, you must be a member of SearchSOA.com.
Register now to start rating these tips. Log in if you are already a member.




Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   


RELATED CONTENT
Platforms and Servers
Tracking down managed memory leaks
Handling exceptions in .NET
.NET Compact Framework graphics
The Data Access Application Block
Decision time: .NET or J2EE?
A great .NET resource: .Net2TheMax
Delegates vs. interfaces in .NET
Project structure best practices
Working with PDFs in a .NET environment
Displaying errors with the error provider

.NET Developer
Programming Indigo
DataSets and Web services don't mix
Security in .NET 2.0
Tracking down managed memory leaks
Handling exceptions in .NET
.NET Compact Framework graphics
The Data Access Application Block
A great .NET resource: .Net2TheMax
Delegates vs. interfaces in .NET
Project structure best practices

Microsoft .NET Web services
New SOA tools for Microsoft server
Yahoo proxy fight looms
New Microsoft site for architects
LAMP coders go hybrid route
Silverlight shines on bank RIAs
Microsoft fights on for Yahoo
New Microsoft language for SOA?
Ballmer details software-plus-services
Microsoft/Yahoo could rock Web services world
SOA needs information management
Microsoft .NET Web services Research

RELATED GLOSSARY TERMS
Terms from Whatis.com − the technology online dictionary
Common Language Infrastructure  (SearchSOA.com)
Visual J#  (SearchSOA.com)

RELATED RESOURCES
2020software.com, trial software downloads for accounting software, ERP software, CRM software and business software systems
Search Bitpipe.com for the latest white papers and business webcasts
Whatis.com, the online computer dictionary

DISCLAIMER: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.

About Us  |  Contact Us  |  For Advertisers  |  For Business Partners  |  Site Index  |  RSS
SEARCH 
TechTarget provides enterprise IT professionals with the information they need to perform their jobs - from developing strategy, to making cost-effective IT purchase decisions and managing their organizations' IT projects - with its network of technology-specific Web sites, events and magazines.

TechTarget Corporate Web Site  |  Media Kits  |  Reprints  |  Site Map




All Rights Reserved, Copyright 2001 - 2008, TechTarget | Read our Privacy Policy
  TechTarget - The IT Media ROI Experts