# How do IP restrictions and Login IP Ranges secure Salesforce integration endpoints against unauthorized network access?

**Topic:** Integration · **Difficulty:** Medium · **Tags:** Integration, IP Restrictions, Network Security

Read it on the site: https://www.forcechallenges.com/interview-questions/how-do-ip-restrictions-and-login-ip-ranges-secure-salesforce-integration-endpoints-against-unauthorized

## Answer

**Basics:** If an integration's credentials leak, an attacker outside your network could still use them. IP controls add a network condition: the credentials work only from approved addresses, such as your gateway or middleware egress IPs.

**How it works:**
1. Profile Login IP Ranges (Setup > Profiles > Login IP Ranges): a login from an address outside the ranges is denied. They are set on profiles, not permission sets.
2. Network Access trusted IP ranges (Setup > Network Access): logins from these addresses are not asked for an identity verification code. They do not block anything else.
3. Connected app IP Relaxation: choose "Enforce IP restrictions" (the user's profile ranges apply), "Relax IP restrictions" (profile ranges bypassed for this app) or "Relax IP restrictions with second factor".
4. Session Settings can lock sessions to the originating IP and, with "Enforce login IP ranges on every request", apply the ranges throughout the session rather than only at login.

**Advanced / deep dive:** Use a dedicated integration profile with login IP ranges for the integration's static egress addresses. Cloud middleware often has changing IPs, so use dedicated or static egress, a private network link, or mTLS and certificate auth instead of broad ranges. Login IP ranges work together with login hours and permission sets in a layered, least-privilege design. For outbound calls from Salesforce to your systems, allowlist Salesforce's published IP ranges on your firewall (verify, and note that ranges change and Hyperforce differs). IP restrictions do not replace OAuth scopes, MFA or field-level security.

**Code / config example:**
```text
Profile: API Integration User
  Login IP Ranges:  203.0.113.10 - 203.0.113.20   (gateway egress)
Connected App > Manage > Edit Policies:
  Permitted Users: Admin approved users are pre-authorized
  IP Relaxation:   Enforce IP restrictions
Session Settings: [x] Enforce login IP ranges on every request
```

**Hidden gotchas & must-remember points:**
- Trusted IP ranges are not a blocklist. Only Login IP Ranges deny access.
- Login IP ranges live on profiles, so permission sets cannot add them.
- "Relax IP restrictions" on a connected app can silently remove your profile protection.
- A wrong range locks out the integration, so test in a sandbox and keep an admin recovery path.
- Shared cloud IPs make narrow ranges unreliable.
- Username-password OAuth flows without a trusted IP may need a security token.

**Best practice:** Use a dedicated integration profile with the narrowest static IP range, and add certificate-based authentication rather than relying on IPs alone.

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