Sub topic 10
Security, governance, and monitoring of integrations
This chapter assumes you know basic Salesforce objects, REST and JSON, and what an integration between two systems is. It covers how security, governance, and monitoring differ between native Salesforce tools and a middleware layer. That difference is one signal for choosing middleware.
Why this matters for the decision
One integration with one partner system is easy to secure and watch. Twenty integrations are not. Each has its own credentials, error logs, and owner. Middleware pays off when you need to apply the same rules across many integrations. For a single request-reply call, native tools are often enough.
Security: where the controls live
Native Salesforce handles outbound security with Named Credentials. A Named Credential stores the endpoint and authentication details, so Apex code never contains a secret.
HttpRequest req = new HttpRequest();
req.setEndpoint('callout:ERP_Credential/orders/' + orderId);
req.setMethod('GET');
HttpResponse res = new Http().send(req);
System.debug(res.getStatusCode());For inbound calls, an external system authenticates through a connected app with OAuth, and permission sets limit what the integration user can read or write.
Middleware adds a policy layer in front of the systems. In MuleSoft, an API gateway applies policies without changing the code of the API behind it. Typical policies are:
- Client ID enforcement, so only registered consumers can call.
- Rate limiting and throttling, to protect a backend from overload.
- IP allow lists.
- Token validation, such as OAuth 2.0 or JWT.
The backend system then needs to trust only the middleware, not every caller.
Governance: who may use what
Governance means knowing which APIs exist, who owns them, and who may consume them. Native Salesforce gives you metadata and permission sets, but no catalog of every integration across the company. Middleware platforms usually provide:
- A catalog where teams publish and discover APIs.
- Versioning, so a change does not break existing consumers.
- Approval of access requests per consumer.
- Reuse of existing APIs instead of new point-to-point links.
Monitoring: seeing failures
Native monitoring is spread across several places. Apex failures appear in debug logs and Apex Exception Emails. Platform Event delivery and API usage have their own views, and the Event Monitoring product adds audit data.
Middleware gives one place to look. It records each transaction with a correlation ID, which is a unique identifier passed through every hop so you can trace one business request across systems.
| Capability | Native Salesforce | Middleware layer |
|---|---|---|
| Credential storage | Named Credentials | Central secrets and policies |
| Access control | Connected apps, permission sets | Gateway policies per API |
| API catalog | None across systems | Built-in catalog and versioning |
| Tracing | Debug logs, per-org views | End-to-end with correlation IDs |
| Alerting | Custom, per feature | Central dashboards and alerts |
Common mistakes
- Putting credentials in custom settings or code instead of Named Credentials.
- Giving the integration user a System Administrator profile instead of least privilege.
- Logging full payloads that contain personal data.
- Running middleware without alerts, so failures stay hidden until a user complains.
Signals for the decision
Lean toward middleware when several of these are true:
- Many systems consume the same data and need consistent access rules.
- Auditors require a record of who called what and when.
- Support teams need to trace a request across systems.
- Backends must be shielded from direct exposure to Salesforce.
Lean toward native when one or two integrations exist, one team owns both sides, and Named Credentials plus Salesforce logs meet your audit needs.
Exercise
Your company has one Salesforce-to-ERP order lookup, owned by one team, with no audit requirement beyond standard logs. A manager proposes adding middleware only for security. What do you recommend, and what would change your answer?
Show answer
Recommend staying native. A Named Credential, a least-privilege integration user, and Salesforce logs cover the security need for a single integration. Your answer would change if more consumers appeared, if auditors required end-to-end tracing, or if the ERP had to be shielded behind a gateway with rate limiting and token policies.