Skip to main content

Security best practices

Systems in an intranet are more secure than those in the internet, but it requires a bit of context to understand why. Let's break down the reasons for this and why it's strongly encouraged to use a security proxy behind an intranet.

  1. Controlled Environment: An intranet is a private network that is typically owned and managed by an organization. This means that the organization has control over who can access the network and what resources are available. In contrast, the internet is a vast and open network where anyone can potentially access your system.

  2. Limited Access Points: In an intranet, access points to the network are limited and tightly controlled. This means that there are fewer entry points that need to be secured, making it easier to monitor and protect them. In contrast, the internet has countless entry points, making it much more challenging to defend against potential threats.

  3. Security Policies: Organizations can implement strict security policies within their intranet. This includes firewalls, intrusion detection systems, and other security measures that are tailored to the organization's specific needs. On the internet, security measures are often more generic and may not be as finely tuned to a particular organization's requirements.

  4. Reduced Exposure: Intranet systems are not directly exposed to the public internet. This reduces the surface area for potential attacks, as malicious actors have to breach the perimeter of the intranet before they can target specific systems.

Why use a security proxy and not run the system directly in a hosted environment:

  1. Security Proxy: A security proxy acts as an additional layer of security between your internal systems and external users. It can inspect incoming requests, filter out malicious traffic, and enforce access controls. By using a security proxy, you add an extra layer of protection to your intranet systems, reducing the risk of unauthorized access and attacks.

  2. Controlled Access to REST Endpoints: Configuring the security proxy to allow requests only to certain REST endpoints is a best practice known as access control. It ensures that only authorized users or applications can access specific resources on your intranet. This minimizes the attack surface and reduces the risk of data breaches or unauthorized access to critical systems.

  3. Avoiding Direct Hosting: Hosting your internal systems directly on the public internet can be risky because it exposes them to a much larger and potentially hostile audience. Even with strong security measures, the sheer volume of potential threats on the internet makes it more challenging to maintain a high level of security. By keeping your systems within your intranet and using a security proxy to selectively expose them, you maintain better control and security.

In summary, the security of systems in an intranet is generally stronger due to controlled environments, limited access points, and tailored security measures. Using a security proxy to control access to REST endpoints is a recommended practice to enhance security, and avoiding direct hosting on the internet helps protect sensitive systems from the broader threatscape of the public internet.

Encryption of stored secrets​

Secrets that the system keeps in its database, e.g. the private key for push notifications or the connection to Google Drive, are encrypted with AES-256-GCM before they are stored. The key is taken from the environment of the server and never from the database:

Create a key once and keep it safe
openssl rand -base64 32

Set the result as the environment variable APP_SECRETS_KEY of the server. If you change the key later, list the former keys in APP_SECRETS_OLD_KEYS (separated by commas) so existing values can still be read; they are written with the new key the next time they are saved.

Without APP_SECRETS_KEY the system does not store secrets of the Google Drive connection, and the settings page warns that the push private key is stored as plain text. If a stored value was written with a key that is no longer configured, it is treated as not entered and has to be entered again.

Secrets of a diagram​

How a diagram declares secrets from the environment of the server and uses them is explained in Secrets.

Secrets of the user​

Besides the secrets a diagram declares from the environment, the settings of the account of the user who started a run are available to that run. They are read as ${secret:user.<name>} and need no declaration:

SecretFrom the account settings
user.push.publicKeyPush notifications: public key (only with a private key)
user.push.privateKeyPush notifications: private key, decrypted
user.push.subjectPush notifications: contact

Like all secrets they are looked up at the moment an activity needs them and are never stored in the variables of the run, so they do not show up in the task details, the log or the agent chat; the values are masked if they appear in a text. A run that sleeps and is continued later, e.g. when a customer taps a link, finds the current settings of the user who started it. In a dry run only a mask is used.