Enterprise License Validation#
Enterprise (EE) license validation in Strapi is handled by two files in packages/core/core/src/ee/:
index.tsā orchestrates the EE state machine (init,onlineUpdate,checkLicense,validateInfo,enable,disable)license.tsā implements the crypto and network primitives (verifyLicense,fetchLicense,readLicense,LicenseCheckError)
How Validation Works#
1. Optimistic Init#
init() runs once at startup. It reads the license from the STRAPI_LICENSE environment variable or a license.txt file on disk. verifyLicense() decodes the base64 token, verifies an RSA-SHA256 signature against a bundled public key, and parses the JSON payload into a LicenseInfo object (type, features, expiration, seats, etc.). If valid, EE is optimistically enabled before the network check.
2. Online Registry Update#
checkLicense() decides whether to contact the registry. Unless the license type is 'gold' and STRAPI_DISABLE_LICENSE_PING=true, it calls onlineUpdate().
onlineUpdate() reads the ee_information row from strapi::core-store inside a FOR UPDATE transaction and decides whether to contact the registry:
shouldContactRegistry = (storedInfo?.lastCheckAt ?? 0) < Date.now() - ONE_MINUTE
- If stale (> 1 minute old): calls
fetchLicense(), which POSTs{ key, projectId, deviceId }tohttps://license.strapi.io/api/licenses/validate. The response is parsed with Zod schemas; a 200 returns the new signed license token, a 400 surfaces a registry error, and network or unexpected errors throw aLicenseCheckErrorwithshouldFallback = true. - If fresh (⤠1 minute old): the stored license token is reused directly ā without verifying that
storedInfo.licensewas issued for the currentlicenseKey. This is a known gap (see #27920).
After obtaining a license token (from registry or cache), verifyLicense() is called again to verify the signature, then validateInfo() checks expiration. If features, seats, or type changed, an ee.update event is emitted on the event hub .
3. Fallback Behavior#
If fetchLicense() throws with shouldFallback = true and a previously stored license exists, the stored license is used as a fallback rather than disabling EE . Network failures (e.g. transient outages) are the expected trigger for this path.
4. Cron Schedule#
After the initial onlineUpdate, a cron job is registered to run onlineUpdate every 12 hours (shifted randomly by shiftCronExpression to spread load across instances): 0 0 */12 * * *.
5. Offline Mode (Gold)#
Gold-type licenses can opt out of the registry ping with STRAPI_DISABLE_LICENSE_PING=true . In that mode, validateInfo() runs directly against the locally parsed expireAt field.
Known Gap: License Key Not Validated Against Cache#
onlineUpdate() skips the registry call when ee_information was last updated less than one minute ago. It does not compare the stored license's licenseKey against the current ee.licenseInfo.licenseKey. This means a restart with a new license key within that one-minute window silently continues to use the cached license .
Impact:
- A downgrade (e.g., Enterprise ā Growth) retains the higher-tier features and seat limit for up to 12 hours.
- An upgrade retains the previous (lower) seat limit, so the seat enforcement at boot may incorrectly disable admin users .
The issue was filed as strapi/strapi#27920 against Strapi 5.55.1. No fix has been merged as of the time of this writing.
Key Types and Feature Tiers#
The LicenseInfo interface defines three tiers: 'bronze', 'silver', 'gold'. Default features are bundled in DEFAULT_FEATURES : gold includes sso, audit-logs, review-workflows, cms-content-releases, cms-content-history, and cms-advanced-preview. Features returned by the registry override these defaults.
Entry Points for Engineers#
| What you need | Where to look |
|---|---|
| EE state & public API | ee/index.ts ā init, checkLicense, onlineUpdate, validateInfo |
| Crypto & registry | ee/license.ts ā verifyLicense, fetchLicense, LicenseCheckError |
| Cache key mismatch bug | Issue #27920 |
| Registry response hardening | PR #26935 |