DEV Community

Cover image for How to Secure Your Mobile App

Posted on • Updated on


How to Secure Your Mobile App

$ 3,9 million — is the average cost of a data breach in 2019. The ‘average’ means that the costs might differ depending on the country (the most expensive is in the USA), on the industry (the most expensive is healthcare), and a particular case. In addition to significant expenses, a data breach may ruin the company’s reputation. The society is frustrated a lot with the security of sensitive data, so losing people’s personal information may result in a substantial decrease in the number of users.

Not to put the company at such a risk, the security should be a top priority task during the whole process of the application development: from design and architecture to support and maintenance.

What type of app should it be?

Among the 3 types of applications — native, web, hybrid — the first one is the most secure. It is simpler to enhance security of native mobile apps: they have easier access to the existing security features of a particular device (like TouchID or FaceID) as well as the implementation of multi-factor authentication.

From the users’ perspective, there is one more argument towards the native apps — the quality and security requirements of the app stores. So, if the application is available on the store, it has already passed all security checks and was approved.
Tips on mobile app security

5 tips on enhancing the mobile app security

Even though native mobile apps are considered to be the safest, it does not mean they are safe by definition. They just provide more opportunities and tools to enhance their security simpler and faster. But still, a lot has to be done to develop a secure application. And here are some tips on what to consider when developing a safe mobile app.

1. Write secure code and test it properly

This one might be obvious but as practice shows, it is never superfluous to remind common-know things: the weaknesses of the security mechanisms cause more than half of all mobile apps’ vulnerabilities. Most of them could be prevented at the design stage if all the procedures were done properly. Being revealed too late, these vulnerabilities require a lot of changes to the code (= time and money).

The advice here is not to rush, take time for thoughtful planning, and pay much attention to the code. One more thing to consider is accurate and regular testing with rapid fixes of all the detected bugs.

2. Encrypt the data

Even if the security mechanisms fail their job and an attacker turns out to be too smart and skilled, the encryption could help to save the hacked information. After being encrypted, the data becomes unavailable for strangers who have no keys to read it.

3. Be careful with libraries

Third-party libraries can significantly broaden the range of features of your app. But along with the benefits and opportunities, they can conceal vulnerabilities that will migrate to your product. That is why you’d better double-check all the third-party pieces of software you take on board of your application and chose only proven and reliable libraries.

Security when developing a mobile app

4. Use high-level authentification

An authentification can be compared to a fence that protects your house from the outside threats. The more fences you have and the higher they are, the more secure your app gets.
A lot of users are lazy and prefer to search for the less secure yet shorter way to what they need (in our case — the functionality of an app): they choose weak and easy-to-hack passwords and save them in the cache.

To strengthen the security you can design an app to accept only sophisticated passwords (even though users would grumble at notifications like “your password should contain numbers, symbols, and capital letters”) and require the password change once a month/decade. One more tool here — asking to add a mobile phone number to the account in the app and use confirmation codes to perform actions dealing with sensitive data.

5. Request only necessary permissions

Any permission your app asks for creates an additional connection which equals one more gate in a security fence. It can be well-protected but it is still one more potential way for attackers that could make an application more vulnerable.

That is why developers are advised to create an app that would ask only for the permissions it really needs to perform well. So, if your app’s functionality perfectly works without using the device’s camera or contact list, do not make it ask permission to access those native features.


More and more personal information gets to the web these days. With the appearance of IoT solutions for smart homes as well as social networks, this process accelerated and reached a new level. That puts app’s security on the top of the priority list for software developers.
To create reliable and secure solutions and to avoid fraud and data breaches, you have to keep an eye on all the potential vulnerabilities and learn ways to eliminate them.

Top comments (0)

Timeless DEV post...

Git Concepts I Wish I Knew Years Ago

The most used technology by developers is not Javascript.

It's not Python or HTML.

It hardly even gets mentioned in interviews or listed as a pre-requisite for jobs.

I'm talking about Git and version control of course.

One does not simply learn git