6 ways to build in security

 

Connecting state and local government leaders

The cost and technical challenge of adding security to complex systems after the fact are prohibitive. Here are some steps developers and managers can take to build security into new software applications.

For a more thorough discussion of ways to build security into applications during development, check out the  from the Open Web Application Security Project.

IT security has recently gotten a lot of attention in the mainstream press for all the wrong reasons – like the Target hack that compromised millions of credit card numbers or the Heartbleed bug in OpenSSL that had everyone scrambling. Government IT systems are not immune (here and here for example), and it isn’t hard to see why. With agency budgets already stretched to their limits, bolting security measures on to complex architectures comprised of applications of myriad ages, technologies and levels of quality is virtually impossible.

One lesson from these failures is that the cost and technical challenge of adding security after the fact are prohibitive. As a software engineer, I believe one thing we can do to begin to address this crisis is to ensure that we build security into all new software applications. Let’s consider some steps developers and managers can take.

1. Keep it simple. This might seem obvious, but never underestimate the ability of a developer to devise a complicated solution to a problem – or a perceived problem. I once worked with a developer on a Defense Department project who rejected Java’s built-in toLowerCase method in favor of his own custom solution using complicated bit shifting to achieve supposedly better performance.

Complexity is the death of all software and architectures, and complexity compounds itself with amazing speed. Developers must remain vigilant at every decision point to take the simplest path possible to achieve the desired functionality. Simpler and leaner code is easier to maintain and evaluate for possible vulnerabilities.

2. Limit resource access. Virtually every application needs to connect to a database or to files on disk, and this access must be restricted. In a Windows architecture, for example, developers can integrate IIS with Windows Authentication if users are on the same domain as the server. For anonymous database access, create a single user representing the application and limit its permissions substantially.

Less intuitive is cleaning up after accessing resources. For databases, be sure to close connections or return them to the pool; for files, close file I/O abstractions. Use the built-in facilities of the programming language to help. In Java, this would mean try-with-resources and AutoCloseable. Functional languages enable the loan pattern that can be implemented to compel developers to clean up after themselves.

Consider also using a tool comparable to Jasypt to encrypt values in configuration files governing access to sensitive resources.

And by now, do I really need to even discuss SQL injection?

3. Be vigilant with dependencies. Speaking of libraries, most projects depend heavily on third-party libraries – open-source and otherwise. If those developers haven’t read this column or lack diligence, you could introduce vulnerabilities by using them.

I absolutely do not advocate eschewing libraries and writing everything yourself. Rather, ensure libraries are actively maintained (particularly with open source) and address any concerns via forums or paid support.

4. Handle errors gracefully. Have you ever used a Web application where an error occurred and the gory details were displayed in the browser?

Aside from a poor user experience, revealing the technical details of an application isn’t ideal for security. Never swallow errors and instead log them immediately. Also a fault barrier provides a clean mechanism for handling errors gracefully while relieving developers of the burden. (Note: The link refers to Java, but the concept transcends language.)

5. Prefer immutability. Mutability is the ability to change values in code after they’ve been created. In object-oriented (OO) languages, basic mutability is common, and objects can even be cloned after creation. Another example derives from inheritance, perhaps the most powerful feature of OO. This endows new code with the properties of existing code. Mutability makes  code more complex while introducing the potential for hacks.

Immutability makes code simpler, thread-safe and less vulnerable. Functional languages either forbid or make it difficult to write mutable code, but OO languages demand discipline from developers to write immutable code.

6. Automate security testing. In my first GCN column, I advocated automated testing to build quality into applications. The same approach can expose flaws in code that can be exploited.

While not security testing tools per se, FindBugs for Java and FxCop for .NET identify unused code, memory leaks, resource cleanup failures and other problems.

I am unaware of viable open-source security testing tools, so you will likely need to invest in the tool that works best for your situation. Look for tools that work with IDEs like Eclipse and that can be assimilated into your continuous integration infrastructure. If the tool itself can’t be automated, consider an automatable script that runs it nightly. If all else fails, make sure someone runs scans at least weekly.

guidance
X
This website uses cookies to enhance user experience and to analyze performance and traffic on our website. We also share information about your use of our site with our social media, advertising and analytics partners. Learn More / Do Not Sell My Personal Information
Accept Cookies
X
Cookie Preferences Cookie List

Do Not Sell My Personal Information

When you visit our website, we store cookies on your browser to collect information. The information collected might relate to you, your preferences or your device, and is mostly used to make the site work as you expect it to and to provide a more personalized web experience. However, you can choose not to allow certain types of cookies, which may impact your experience of the site and the services we are able to offer. Click on the different category headings to find out more and change our default settings according to your preference. You cannot opt-out of our First Party Strictly Necessary Cookies as they are deployed in order to ensure the proper functioning of our website (such as prompting the cookie banner and remembering your settings, to log into your account, to redirect you when you log out, etc.). For more information about the First and Third Party Cookies used please follow this link.

Allow All Cookies

Manage Consent Preferences

Strictly Necessary Cookies - Always Active

We do not allow you to opt-out of our certain cookies, as they are necessary to ensure the proper functioning of our website (such as prompting our cookie banner and remembering your privacy choices) and/or to monitor site performance. These cookies are not used in a way that constitutes a “sale” of your data under the CCPA. You can set your browser to block or alert you about these cookies, but some parts of the site will not work as intended if you do so. You can usually find these settings in the Options or Preferences menu of your browser. Visit www.allaboutcookies.org to learn more.

Sale of Personal Data, Targeting & Social Media Cookies

Under the California Consumer Privacy Act, you have the right to opt-out of the sale of your personal information to third parties. These cookies collect information for analytics and to personalize your experience with targeted ads. You may exercise your right to opt out of the sale of personal information by using this toggle switch. If you opt out we will not be able to offer you personalised ads and will not hand over your personal information to any third parties. Additionally, you may contact our legal department for further clarification about your rights as a California consumer by using this Exercise My Rights link

If you have enabled privacy controls on your browser (such as a plugin), we have to take that as a valid request to opt-out. Therefore we would not be able to track your activity through the web. This may affect our ability to personalize ads according to your preferences.

Targeting cookies may be set through our site by our advertising partners. They may be used by those companies to build a profile of your interests and show you relevant adverts on other sites. They do not store directly personal information, but are based on uniquely identifying your browser and internet device. If you do not allow these cookies, you will experience less targeted advertising.

Social media cookies are set by a range of social media services that we have added to the site to enable you to share our content with your friends and networks. They are capable of tracking your browser across other sites and building up a profile of your interests. This may impact the content and messages you see on other websites you visit. If you do not allow these cookies you may not be able to use or see these sharing tools.

If you want to opt out of all of our lead reports and lists, please submit a privacy request at our Do Not Sell page.

Save Settings
Cookie Preferences Cookie List

Cookie List

A cookie is a small piece of data (text file) that a website – when visited by a user – asks your browser to store on your device in order to remember information about you, such as your language preference or login information. Those cookies are set by us and called first-party cookies. We also use third-party cookies – which are cookies from a domain different than the domain of the website you are visiting – for our advertising and marketing efforts. More specifically, we use cookies and other tracking technologies for the following purposes:

Strictly Necessary Cookies

We do not allow you to opt-out of our certain cookies, as they are necessary to ensure the proper functioning of our website (such as prompting our cookie banner and remembering your privacy choices) and/or to monitor site performance. These cookies are not used in a way that constitutes a “sale” of your data under the CCPA. You can set your browser to block or alert you about these cookies, but some parts of the site will not work as intended if you do so. You can usually find these settings in the Options or Preferences menu of your browser. Visit www.allaboutcookies.org to learn more.

Functional Cookies

We do not allow you to opt-out of our certain cookies, as they are necessary to ensure the proper functioning of our website (such as prompting our cookie banner and remembering your privacy choices) and/or to monitor site performance. These cookies are not used in a way that constitutes a “sale” of your data under the CCPA. You can set your browser to block or alert you about these cookies, but some parts of the site will not work as intended if you do so. You can usually find these settings in the Options or Preferences menu of your browser. Visit www.allaboutcookies.org to learn more.

Performance Cookies

We do not allow you to opt-out of our certain cookies, as they are necessary to ensure the proper functioning of our website (such as prompting our cookie banner and remembering your privacy choices) and/or to monitor site performance. These cookies are not used in a way that constitutes a “sale” of your data under the CCPA. You can set your browser to block or alert you about these cookies, but some parts of the site will not work as intended if you do so. You can usually find these settings in the Options or Preferences menu of your browser. Visit www.allaboutcookies.org to learn more.

Sale of Personal Data

We also use cookies to personalize your experience on our websites, including by determining the most relevant content and advertisements to show you, and to monitor site traffic and performance, so that we may improve our websites and your experience. You may opt out of our use of such cookies (and the associated “sale” of your Personal Information) by using this toggle switch. You will still see some advertising, regardless of your selection. Because we do not track you across different devices, browsers and GEMG properties, your selection will take effect only on this browser, this device and this website.

Social Media Cookies

We also use cookies to personalize your experience on our websites, including by determining the most relevant content and advertisements to show you, and to monitor site traffic and performance, so that we may improve our websites and your experience. You may opt out of our use of such cookies (and the associated “sale” of your Personal Information) by using this toggle switch. You will still see some advertising, regardless of your selection. Because we do not track you across different devices, browsers and GEMG properties, your selection will take effect only on this browser, this device and this website.

Targeting Cookies

We also use cookies to personalize your experience on our websites, including by determining the most relevant content and advertisements to show you, and to monitor site traffic and performance, so that we may improve our websites and your experience. You may opt out of our use of such cookies (and the associated “sale” of your Personal Information) by using this toggle switch. You will still see some advertising, regardless of your selection. Because we do not track you across different devices, browsers and GEMG properties, your selection will take effect only on this browser, this device and this website.