How do administrators secure real-time streaming event channels against unauthorized data access and interception?
Answer
Basics: Platform events and Change Data Capture are delivered over the Streaming API (CometD) or Pub/Sub API. Anyone who can subscribe sees the messages, so access control must be set up deliberately.
How it works:
- Subscribers must authenticate (session or OAuth token) with API Enabled; connected apps need an appropriate scope such as
api. - Grant Read on the platform event object via profile/permission set to subscribe, and Create to publish. Without it the subscription fails with an authorization error.
- For Change Data Capture, subscribers need Read on the entity, and delivered field data is limited by their field-level security; event delivery is not governed by record sharing rules in the same way as queries, so verify behavior for your use case.
- Traffic is encrypted via TLS.
- Apex trigger subscribers run as the Automated Process user unless you configure a run-as user (
PlatformEventSubscriberConfig).
Advanced / deep dive: Platform events have no per-record sharing: any user with read permission on the event sees every message. So partition sensitive data into separate event types or custom channels, and publish only identifiers (then let the subscriber query records, enforcing its own sharing) when data is sensitive. Custom channels with filtering and enriched events exist in recent releases (verify current availability and syntax). Shield Platform Encryption can protect event fields at rest in the event bus, an add-on feature (verify scope). Restrict the integration user with a dedicated minimal permission set, enable IP restrictions or connected app IP policies, and use certificate-based JWT flows for server clients. Monitor with Event Monitoring.
Code / config example: Setup steps: