From a project perspective, IT systems consist of a functional part and a nonfunctional part. Both are described by different requirements, but today we are more interested in the second area. As you probably guess, some quality factors are very specific to particular applications, while others matter to everyone (apart from special cases). One of them is security, understood in two ways: safety (protection against unintentional actions and events) and security (protection against attacks).
Security topics have gained popularity in recent years, and not without reason: more and more data is digitized and stored on all kinds of servers, including the cloud. We keep more and more data online, from temporary, unimportant, even "recreational" data to personal and downright critical data. And we don't mean only personal details, but also financial and legal data, our activity history, or passwords whose leak could seriously harm us and usually does. It is nothing new to hear that a database from some popular service has appeared on the "market", or that someone's account was broken into.
Of course, there are specialists who deal only with software security, and bless them for it. Their work matters not only to the IT sector but also (and perhaps above all) to ordinary people, the general public of the global network. On top of their regular work for business, these experts also find time to run popular sites and blogs that explain various attacks and ways to defend against them. Many of you know Niebezpiecznik, Zaufana Trzecia Strona or Sekurak, and if you don't, they are worth getting to know, because they present their material in a way that is both technical and "digestible" for the average internet user.
However, you don't always have to deal with an attack. There is a well-known rule, "prevention is better than cure", and it works in IT too. Developers and administrators have many techniques at their disposal that help strengthen the defense and sometimes make sure that any stolen information is useless to the attacker. What is more, most of these techniques are not hard to use, and very often the basic safeguards are an integral part of various frameworks. Some protective measures are applied almost automatically, while others take a bit of work. Today we would like to present them, also to show those worried about having to spend a larger sum on security what basic weapons software houses have at hand.
Password hashing
Let's start with something basic and important for every internet user: passwords have to be stored somewhere, and this usually happens in a database. So you may wonder what happens when someone gets into that database (directly or, for example, through an admin panel) or even downloads it. Such things have happened before, and the usual recommendation was then to change the password used on the service. With the right technique, however, the probability that such a leak will compromise your particular password is quite small. Why?
Passwords in databases have long been stored in hashed form, which means that for every string of characters a suitable algorithm generates a specific digest. As a result, when a user types the password "Abcd1234", it is indeed sent by the browser to the server (it is important that this happens over HTTPS, which we will come back to), but there it can be turned into a form like this (when Bcrypt with 13 rounds is used):
$2a$13$sOa6zWfUOVJD6V.1QcB9s.2umv.B8LbR9/wjWQ5Ind3t/QBGuZOGe
Only in this form is it stored in the database, and at login the strings are compared by matching the hash from the database against the hash of the password just typed. What is more, this digest is one-way: you cannot reverse the operation and recover the original password from it. There are many algorithms of this kind (BCrypt, SHA, MD5 and so on), and they differ in the level of protection and in performance. In this case, though, the speed differences are so small that it is worth using the stronger protection, which most portals do. This also answers the question "will an administrator see my password in the admin panel?" No, they won't, because all they can see is that very hash, which cannot be unmasked. They can also change the password to a different one, but it will be hashed again and impossible to read later.
Of course, in theory it is still possible to guess a password by successively hashing various strings and comparing them with the hash taken from the database. In practice, however, this can take a very long time (so long that it is not worth it), and long, complex passwords help with that (although at some point this becomes a burden, unless we use password managers). Every additional character adds hours, days, or even years needed to crack a given string. So it is worth the effort: let's set suitably hard and long passwords.
As a curiosity, some services have given up on remembering passwords altogether. Instead, you log in by entering your email address and then reading a short-lived code from the message you receive. This is how (or how used to) the serverless platform Vercel (once known at now.sh) and the job portal SOLID.jobs work, for example.
Authentication and authorization
For the sake of order, it is worth mentioning something we know well from practice but not necessarily by name. Authentication (the Polish calque "autentykacja" is discouraged by Polish language experts) is the process of confirming that a person is who they claim to be. Authorization, in turn, is verifying whether a given user has access to a particular resource. In practical terms: when we log in to Facebook, we go through authentication (our password and email address are checked against the information stored in the database). When we later want to see the posts of a closed group for our year at university, we have to go through authorization (so the service must check whether we have the right to view, or even publish, posts in that group).
Of course, these basic techniques let us hide certain data from unauthorized access and are so natural that it is hard to imagine storing any less innocent information without them. But the authentication process itself is critical here, which is why there are different ways of carrying it out. Services don't always rely on just a login and password. Additional methods can include:
- entering a CAPTCHA code or, for example, picking out photos: recognizing robots trying to break into a given account,
- entering a code sent to an email address: described above,
- entering a code from an SMS or from an app such as Google Authenticator: an additional confirmation of identity.
The last item is so-called two-factor authentication (2FA), and it is recommended to turn it on wherever possible. It increases our certainty that whoever logs in to our account is really us. Unless we have lost our phone, but that is a different kind of problem.
Authentication with an SSH key
We mentioned that a password is not always enough. That is because it can always be cracked (even if it takes a very long time), and what is more, logging in is sometimes so frequent that having to type a long password every time is an extra burden. That is why SSH keys become essential in more technical services.
In a nutshell, this is a pair of files containing very long, matching strings of characters, forming a private and a public part. Once the public key is placed in a given service, a user who wants to log in must use (and have on their disk) the corresponding private key. It is like a magical artifact from fantasy films, where two matching halves open a particular gate. In IT, this method of authentication is often used for Git repositories, that is, the place where the source code of our system lives. That code is not only our intellectual property but sometimes also holds further credentials and API keys that the application itself uses.
Just as often, though, SSH keys are used to log in to the servers themselves, where securing access is one of the key tasks of an administrator. This gives us not only convenience but also additional confirmation that the user is who they claim to be (unless someone breaks directly into their computer).
Protection against SQL Injection and Cross-Site Scripting (XSS)
Both of these attack techniques have a permanent place in descriptions of the most common threats to websites. Fortunately, over the years techniques have been developed that developers often use almost unconsciously and that mostly nip such an offensive in the bud. We mean using ORM libraries (object-relational mappers) when working with the database, so-called parameter binding in SQL queries, and "encoding" displayed text to get rid of malicious JavaScript.
Of course, using a framework alone does not solve every problem. Sometimes a safeguard has to be adapted to the situation, or extra attention paid so that programming convenience does not hide potential security problems. In any case, thanks to the development of programming tools, this problem has been greatly reduced.
A website with an SSL certificate
SSL certificates let us serve resources on the web not over the unencrypted HTTP protocol but over encrypted HTTPS. What does this mean? That if someone tries to eavesdrop on the transmission between the user's computer and the server (including the login password being sent), they will intercept data that cannot be read without the right key, and they do not have that key, because only the user and the server do. Of course, a sufficiently trustworthy certificate is crucial here, as is attention when checking it. Still, serving pages over HTTPS has never been as easy as it is today, and in most cases it is a requirement for a service to interest users, and search engines too.
Server access through a VPN and limiting device visibility
Above we wrote about accessing a server with an SSH key, but it is worth noting that being able to reach a server from anywhere in the world may be convenient, yet it raises concerns from a security point of view. That is why, for servers prepared individually to order and maintained by a specific company, extra safeguards are sometimes put in place.
This can be access only from specific IP addresses, which is simple but sometimes not enough, especially if not all developers connect from locations that have a static IP. That is why setting up a VPN connection is very popular. It works by first going through a gateway server, from which you can then reach the target machine or other parts of the infrastructure. Such a connection is possible with suitable software (for example OpenVPN) once the administrator provides the right configuration and an account.
Besides, it is not only the server whose access can be restricted. Other components can also be hidden from public access. This is practiced, for example, for databases that can be reached only from another, predefined platform. In the case of many backend services too, certain components can be hidden from outside access and one specific other service named as the only possible source.
Administrators can carry out all of these measures, at least in closed environments, that is, services provided individually to order. With "ready-made" servers offered en masse by hosting companies, such additional safeguards are usually either impossible or limited. You shouldn't be put off by this, though, and it is always worth asking technical support about the relevant option.
CORS and CSP
Speaking of limiting access, in most technologies you can define CORS rules (Cross-Origin Resource Sharing). In short, they let you allow access to the backend only from specific origins. In practice, this makes it possible to hide backend services from being called from any page or program. That helps protect against, for example, reproducing how someone moves around a site's resources by sending specific HTTP requests (which is sometimes of interest to people who cannot solve their task with a scraper).
CSP (Content Security Policy), in turn, is a technique that allows resources on the page itself to be loaded only from specific places. This way you can prevent images or scripts from being loaded from any location other than a particular one (most often the domain where the portal lives). It is a technique within a developer's reach, although it should usually be consulted with cybersecurity people, and special care is needed so that the additional safeguards do not make the site uncomfortable to use. It is also worth remembering that this method does not protect our data directly. It rather protects us against the possibility of an attack that could, as a consequence, steal the data.
Regular backups
Finally, a classic method, but one so often forgotten by the people looking after a given service. Sometimes the goal of an attack is not to steal data or gain access to it, but only to destroy it. You should also keep in mind that situations where users accidentally delete information they need, or where something goes wrong when deploying a new version to the server, are not as rare as they might seem. For this reason, and for plain peace of mind in case of a failure, it is worth making regular backups of the database and files.
You can do this manually and run a specific program on the server every so often, or rely on programs that automate the process, such as BorgBackup. It all depends on the technical possibilities on the server, the skills of the people involved (this is rather the administrator's "department"), and the confidentiality level of the data.
Summary
As you can see, some software security techniques are quite natural and sometimes available "in the package" with the engines and libraries in use. On the other hand, many aspects are on the side of administrators who look after the server and can manage its configuration so that not only is convenient access to the machine and database possible for developers, but critical data is also hidden from unauthorized access, even accidental. Of course, portals with a high level of trust or very popular ones require additional precautions and a stricter policy on, for example, password rules. Still, if until now you were afraid that your passwords are available to practically anyone, we can reassure you: getting them is much harder than it seems, as long as developers apply basic precautions, comparable to locking the door when leaving home.
Best regards and thank you, Jakub Rojek.


