API Key Check

The API Key Check verifies the configuration of the API keys stored in the system for security-related aspects. The goal is to minimize the risk in the event of an API key being compromised by limiting its scope of permissions and validity period.

The following aspects are checked:

  • Scope of Permissions: The system checks whether too many organizations, roles, or permissions are assigned to an API key. An API key should be configured according to the principle of * least privilege.*

  • Validity Period: API keys with a very long or unlimited validity period pose an increased risk. The check verifies whether the validity period exceeds a configured threshold.

  • Key Length: To make brute-force attacks more difficult, the length of the API key is checked.

  • Critical Roles: An explicit warning is issued if an API key has been assigned the role bpcadmin, as this grants full access to the system.

Check Configuration

The thresholds for the check can be adjusted in the configuration file KARAF/etc/de.virtimo.bpc.core.security.checks.cfg.

Parameter Default value Description

apiKeyMaxOrganisations

1

Maximum number of organizations that may be assigned to an API key.

apiKeyMaxRoles

2

Maximum number of roles that may be assigned to an API key.

apiKeyMaxRights

15

Maximum number of permissions that may be assigned to an API key.

apiKeyMaxDurationMonths

6

Maximum validity period of the API key in months.

apiKeyMinLength

40

Minimum required length of the API key in characters.

Example KARAF/etc/de.virtimo.bpc.core.security.checks.cfg
# API-Key Security Check Configuration
apiKeyMaxOrganisations=1
apiKeyMaxRoles=2
apiKeyMaxRights=15
apiKeyMaxDurationMonths=6
apiKeyMinLength=40

Security Measures

If the check reports errors or warnings, the affected API keys should be reviewed and adjusted as necessary:

  • Restrict Permissions: Reduce the assigned organizations, roles, and permissions to the absolute minimum necessary.

  • Limit Validity Period: Create API keys with shorter validity periods and establish a process for regular renewal (rotation).

  • Use Long Keys: Ensure that newly generated API keys meet the minimum length requirement of 40 characters.

  • Avoid administrative roles: Remove the bpcadmin role from API keys. Instead, use specific roles with restricted permissions.