Plugin Installation & Security

PluginInstallation, PluginApiKey, and PluginPermissionGrant — the three entities managing per-tenant plugin deployment, API authentication, and permission grants.

When a tenant installs a plugin, three core entities are created: a PluginInstallation record tracking deployment state, a PluginApiKey for secure plugin-to-platform API calls, and PluginPermissionGrant records for each platform capability the plugin is allowed to access.

PluginInstallation Entity

Represents a tenant's installation of a specific PluginDefinition at a particular PluginVersion. A tenant can install the same plugin only once — enforced by a unique constraint on (TenantId + PluginDefinitionId).

FieldTypeDescription
IdGuidPrimary key
PluginDefinitionIdGuidFK to the installed PluginDefinition
TenantIdGuidTenant that installed this plugin (unique per TenantId + PluginDefinitionId)
PluginVersionIdGuidFK to the specific PluginVersion pinned at install time
StatusInstallationStatusInstallation lifecycle status (Installing, Active, Inactive, Error, default: Installing)
SettingsJsonstring?Tenant-specific configuration overrides as a JSON blob
InstalledAtDateTimeUTC timestamp when the install was initiated
InstalledByUserIdGuidAdmin user who triggered the installation
LastHealthCheckAtDateTime?UTC timestamp of the most recent health check (null = never checked)
HealthCheckPassingboolWhether the latest health check succeeded (default: true)
ConsecutiveHealthCheckFailsintCount of consecutive health-check failures; reset to 0 on recovery

Installation Lifecycle

A PluginInstallation starts in Installing status while the platform provisions resources, then transitions to Active. Admins can deactivate/reactivate it. Persistent health-check failures move it to Error.

Installing
provisioning succeeds
Active
admin deactivates
Inactive
Error
Uninstalled (soft-deleted)

PluginApiKey Entity

Represents an API key issued to a plugin installation for authenticating plugin-to-platform API calls. Stores the hashed key value, a human-readable prefix for identification, activation status, and optional expiration.

FieldTypeDescription
IdGuidPrimary key
PluginInstallationIdGuidFK to the plugin installation this key authenticates
TenantIdGuidTenant scope for this API key
KeyHashstringBcrypt / SHA-256 hash of the actual key value (never stored plain)
KeyPrefixstringHuman-readable prefix shown in the UI for identification (e.g. "sk_plug_abc")
IsActiveboolWhether this key is currently active and can be used for authentication (default: true)
ExpiresAtDateTime?Optional expiration timestamp (null = never expires)
LastUsedAtDateTime?UTC timestamp of the most recent successful API call using this key

PluginPermissionGrant Entity

Records an explicit permission grant to a plugin installation within a tenant. Each grant authorizes the plugin to access a specific platform capability. Platform admins must explicitly approve each permission during the installation setup wizard.

FieldTypeDescription
IdGuidPrimary key
PluginInstallationIdGuidFK to the installation receiving this permission grant
TenantIdGuidTenant scope for this grant
PermissionstringPlatform capability being granted (e.g. "users.read", "invoices.create")
GrantedByUserIdGuidAdmin user who explicitly approved this permission grant