Establishing a Trusted Connection Between Private Spaces and Salesforce
Last updated December 03, 2024
When using Heroku and Salesforce together, you can improve the security posture with an exclusive trust relationship, preventing undesired traffic from the public internet. Using IP restrictions, you can establish exclusive trust between Heroku Private Spaces and Salesforce. You can configure the two directions of traffic independently.
Requirements:
For Salesforce Hyperforce External IPs, see this document.
You can only establish Salesforce -> Heroku connections for apps in Cedar-generation spaces until we add custom Trusted IP ranges to Fir. Subscribe to our changelog to stay informed of when we add features.
Salesforce → Heroku Apps
Frequently, apps running on Heroku should be accessible only to Salesforce. A popular use-case is a Heroku app providing HTTP/REST query interfaces to custom Apex or Lightning components. If an API is not intended for public consumption, then best to block public access.
Allow Incoming Salesforce Traffic
Set all Salesforce IP ranges as Trusted IP ranges for the Cedar-generation Private Space. Reference the Salesforce IP Addresses & Domains knowledge article for a list of all CIDR blocks to trust.
This IP restriction is not specific to individual Salesforce orgs. It allows traffic from any Salesforce instance. IP restrictions cannot be used to limit access from a specific Salesforce instance, because of regular site switching and infrastructure maintenance.
Prevent public traffic
Remember to remove the default entry 0.0.0.0/0
from the Trusted IP ranges for the Private Space. This will block all traffic from the public internet that is not explicitly allowed.
Heroku Apps → Salesforce
By default, Salesforce allows login from anywhere on the public internet. Risk of malicious login activity can be minimized through IP address restrictions.
Limit Direct User Login
Setup Salesforce Login IP restrictions for the integration user.
Limit Connected App (OAuth) Access
Configure an IP Range for a connected app, to block public access to a connected app’s OAuth provider.
All traffic from a Private Space egresses through its stable outbound IP addresses. The space’s list of addresses may be used for this restriction.
Best Practices for Hyperforce
Salesforce discourages IP allowlisting because Hyperforce runs in the cloud, and IPs are updated frequently in Hyperforce, outside of Salesforce’s control. Updating IPs can cause connection interruptions such as with Heroku Connect configurations. For best practices on connecting to Hyperforce, see Preferred Alternatives to IP Allowlisting on Hyperforce.
Combine with Other Techniques
IP restrictions are just one security tool, not a magic bullet. Layering more security strategies together will further decrease risks: SSL/TLS certificates, request authentication, and proactive penetration testing are all crucial to developing a trustworthy app.