Skip to main content

Securing a Vox installation

Vox runs inside your own .NET application, in infrastructure you control. Vox is responsible for how it stores credentials and enforces permissions; you are responsible for where secrets come from, who can reach the API and how the installation is operated. This page covers the part that is yours.

Secrets and configuration​

Vox reads its settings from the .NET configuration system: the Vox section and the connection strings, see configuration. The values themselves don't belong in the source:

var vox = builder.AddVox(options =>
{
// The first administrator from Vox:Users:InitialAdministratorEmail and Vox:Users:InitialAdministratorPassword
options.UseUsers<ApplicationUser>();
})
.AddSqlServerStorage(); // ConnectionStrings:Vox

Supply the values from a source that is not in version control:

  • Production. Environment variables, or a secret store such as Azure Key Vault, AWS Secrets Manager or HashiCorp Vault through its configuration provider. The environment variable for a nested key uses double underscores: Vox__Users__InitialAdministratorPassword, ConnectionStrings__Vox.
  • Development. The .NET user secrets store, dotnet user-secrets set, which keeps values outside the project directory.
  • Never. appsettings.json, or any file that is committed. Vox itself ships no secrets, no default credentials and no connection strings, and an installation should not introduce any.

Connection strings follow the same rule. Give Vox a database user with only the rights it needs rather than a server administrator login. Which rights those are depends on where the model is migrated:

  • Hosts that migrate at startup, the default, change the schema, so their user needs the rights to create and alter tables in Vox's schema as well as to read and write it.
  • Hosts that set RequireAppliedModel only check the model that the pipeline applied with vox migrate, see migrating in production. Their user only reads and writes data; only the pipeline's user changes the schema.

Keys that Vox hosts hold​

Besides the connection strings, a production installation holds these keys. Keep them in the secret store like the rest:

  • The deployment key, VoxOptions.Deployment.ApiKey, which the deployment pipeline sends to activate a release. It grants nothing else, and no Vox user or API client can use the deployment endpoints without it, see deployments.
  • ASP.NET Core Data Protection keys, which protect preview grants, image preview URLs and the signed content URLs of assets. Hosts share and persist them, see hosts. Anyone who can read them can make such URLs, so protect where they're kept, eg encrypt them at rest with ProtectKeysWithAzureKeyVault or a certificate.

Access to the Nexus admin, where imports and projection publications can be paused and run, needs the vox:Nexus permission, see serving the Nexus admin.

The initial administrator​

InitialAdministratorEmail and InitialAdministratorPassword have no default values. If they are not supplied, no administrator is created, which means a new installation can never be reachable through a credential that someone else could guess.

When you do use them:

  1. Supply the password from your secret store, not from a file.
  2. Sign in and change it immediately.
  3. Remove the setting from the environment once a permanent administrator exists. It is only read when there is no administrator, so leaving it configured serves no purpose and keeps a password in the environment.

Authentication​

Vox supports two modes, selected on VoxUsersOptions.

Local authentication is the default. Users sign in with an email address and a password. The admin UI receives an access token and a refresh token.

External authentication over OpenID Connect delegates sign-in to your identity provider. The admin UI performs the flow and the API validates the provider's access tokens through a bearer scheme that the host registers. Only users that have been added to Vox can sign in, so adding an account to the provider does not by itself grant access to Vox. Roles can be read from a claim on the provider's token instead of from Vox, through RoleSource and RoleClaimType.

Use external authentication where you already run an identity provider. It gives you central account lifecycle, your own multifactor policy and your own session rules, none of which Vox should be deciding for you.

Token lifetimes​

In local authentication the access token is valid for one hour and the refresh token for fourteen days. Both are configurable through AccessTokenLifetime and RefreshTokenLifetime. Shorten the refresh token if your policy requires users to re-authenticate more often; the admin UI renews the access token silently while the refresh token is valid.

How Vox stores credentials​

You do not have to configure any of this, but you may be asked about it.

  • User passwords are hashed with PBKDF2-HMAC-SHA512 at 210,000 iterations, with a 16-byte salt drawn per password from a cryptographically secure random number generator. The iteration count is stored alongside the hash, so it can be raised later without invalidating existing passwords. Verification uses a fixed-time comparison.
  • API client secrets are 256 bits of cryptographically secure random data. Only a hash is stored, and the secret is displayed once at creation and cannot be retrieved afterwards.

API clients​

Other systems authenticate with an API key rather than a user account.

  • Issue a separate API client per integrating system. One secret can then be rotated or revoked without affecting any other integration.
  • Grant each client the roles it actually needs. The permission model is the same as for users, so a client that only reads published entities should not hold write permissions.
  • Record which system holds which client. The secret cannot be read back, so an unlabelled client is one nobody dares revoke.
  • Rotate by creating a new client, moving the integration over, then deleting the old one.

The package feed​

Vox is delivered as NuGet and npm packages from Commerce Mind's package feed. The token you are given is read-only and grants nothing beyond downloading packages. Keep it as a secret in your build system, not in a committed nuget.config, and tell Commerce Mind if it may have been exposed so that it can be replaced.

Keeping current​

Vox follows semantic versioning, and every release has release notes. A release containing a security fix says so, with the severity and the affected earlier versions. Because Vox runs in your environment, you decide when to take a version; subscribe someone to the release notes so that the decision is a decision rather than an oversight.

Where a release includes a database schema migration, the release notes state whether it is reversible. Take a backup before applying one that is not, so that a rollback stays possible.

Local development​

A host that runs in Development accepts a well-known development key: send Authorization: ApiKey development.vox-local-development (VoxDevelopmentApiKey.Key in CommerceMind.Vox.Users). This authenticates a development API client with full permissions, without seeding a client or secret. The key is public and is only accepted when the host runs in Development. It is rejected in Production, Staging and other environments. A host composed with services.AddVox() rather than builder.AddVox() opts in with options.UseDevelopmentApiKey(environment).

The admin still requires sign-in, and anonymous requests and ordinary users and API clients keep their normal permissions. Preview grants must still be valid and unexpired, and the editor who opened the preview must still be enabled and allowed to preview that content. The development key does not replace the preview grant.

Reporting a security issue​

Send security issues to security@commercemind.se. Reports are acknowledged within two business days. Please allow a reasonable period for a fix before disclosing publicly.