# How do administrators secure real-time streaming event channels against unauthorized data access and interception?

**Topic:** Integration · **Difficulty:** Medium · **Tags:** Integration, Event Security, Access Permissions

Read it on the site: https://www.forcechallenges.com/interview-questions/how-do-administrators-secure-real-time-streaming-event-channels-against-unauthorized-data-access-and

## 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:**
1. Subscribers must authenticate (session or OAuth token) with API Enabled; connected apps need an appropriate scope such as `api`.
2. 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.
3. 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.
4. Traffic is encrypted via TLS.
5. 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:
1. Create permission set `Order_Events_Subscriber`: Object Settings > `Order_Event__e` > Read.
2. Assign only to the integration user and enable System Permission "API Enabled".
3. Connected app: OAuth scope `api` (and `refresh_token` only if needed), Permitted Users "Admin approved users are pre-authorized", IP Relaxation "Enforce IP restrictions".

**Hidden gotchas & must-remember points:**
- Platform event access is object-permission based, not sharing based.
- Sending a record ID instead of full data limits exposure.
- Trigger subscribers run as Automated Process by default, bypassing the original publisher's context.
- Streaming needs API Enabled; Experience Cloud users have extra restrictions.
- Over-permissioned integration users are the most common leak.
- Event messages are retained 72 hours and replayable by anyone authorized.

**Best practice:** Least-privilege permission sets per subscriber, identifiers instead of sensitive payloads, and a dedicated integration user.

---
Source: ForceChallenges · last updated 2026-11-02
