LiteBus
Operations

Security and Tenancy

Production tier: GA

LiteBus v6 supports optional payload encryption and tenant-scoped lease filters on inbox and outbox stores. These are application-supplied implementations; the core libraries define contracts only.

Packages to Install

PackageRole
LiteBus.Inbox / LiteBus.OutboxUsePayloadEncryption, tenant filter hooks
LiteBus.Messaging.AbstractionsIPayloadEncryptor
Your implementationAES, envelope encryption, or KMS wrapper

Enterprise unit tests demonstrate round-trip encryption and tenant lease scoping: LiteBus.Enterprise.UnitTests.

Registration

Payload Encryption

builder.AddInbox(inbox =>
{
    inbox.UsePayloadEncryption(new AesPayloadEncryptor(key));
    // storage + dispatch...
});

builder.AddOutbox(outbox =>
{
    outbox.UsePayloadEncryption(new AesPayloadEncryptor(key));
});

Dispatchers resolve axis-specific protectors (IInboxPayloadProtector, IOutboxPayloadProtector) registered from your IPayloadEncryptor.

Tenant Lease Filter

Configure store options so lease SQL filters by tenant_id when the request carries a tenant:

inbox.UsePostgreSqlStorage(connectionString, options =>
{
    options.TenantId = "tenant-a";
});

Multi-tenant hosts typically register one store options factory per tenant or pass tenant on lease requests from processor options.

Options Reference

ContractRole
IPayloadEncryptorEncrypt/decrypt persisted payload bytes
ITenantRoutingStrategyOptional routing metadata on publish (transport adapters)
Store TenantId on lease requestsLimits candidate rows in PostgreSQL/EF lease SQL

Guarantees and Non-Guarantees

GuaranteedNot guaranteed
Encrypted payloads stored as opaque bytes at restKey rotation without application migration
Tenant filter applied in lease SQL when configuredCross-tenant isolation without correct tenant on every request

Operations

RiskMitigation
Key lossBackup keys; document rotation procedure
Wrong tenant on acceptValidate tenant at API edge; audit tenant_id column
Cleartext in logsDo not log decrypted payloads; use correlation IDs

Tests

ScenarioLocation
Encryption round-tripLiteBus.Enterprise.UnitTests.PayloadEncryptionTests
Tenant lease scopingLiteBus.Enterprise.UnitTests.TenantLeaseFilterTests

On this page