What security protections do Session Settings provide against unauthorized session hijacking?
Answer
Basics: After login Salesforce issues a session ID stored in a cookie. Anyone who steals it (sniffing, XSS, shared computer) can act as the user without a password. Session Settings (Setup > Security > Session Settings) are the org-wide controls that limit that exposure.
How it works:
- Timeout value: 15 minutes to 24 hours of inactivity (default 2 hours); a warning popup appears before logout. Profiles can set their own timeout, which overrides the org value.
- Lock sessions to the IP address from which they originated: a request from a different IP invalidates the session.
- Lock sessions to the domain in which they were first used: blocks reuse of the session on other domains.
- Require secure connections (HTTPS): non-HTTPS requests are rejected or redirected; Salesforce enforces TLS today.
- Require HttpOnly attribute: JavaScript cannot read the session cookie, mitigating XSS theft.
- Enable clickjack protection (setup, Visualforce, non-setup pages) and CSRF protection on GET/POST.
- Session security levels (Standard, High Assurance) gate sensitive actions behind MFA: authentication methods map to a level and a profile or connected app can require High Assurance.
- Enforce login IP ranges on every request (instead of only at login), and session-level restrictions via login hours and trusted IP ranges.
Advanced / deep dive: IP locking breaks mobile and VPN users whose IP changes, so it is often a trade-off; combine it with MFA, short timeouts and login IP ranges for privileged profiles. Session timeout applies to inactivity, not absolute lifetime, and API/Connected App sessions follow connected app policy (refresh token policy and session policy) rather than UI timeout. Users can be forced out through Setup > Session Management (Active Sessions), and admins can revoke OAuth tokens. Transaction Security Policies and Event Monitoring (LoginEvent, LogoutEvent, SessionHijackingEvent via Shield) detect hijacking: session hijacking detection compares browser fingerprint and IP changes. In Apex, supports step-up (high assurance) and should never be logged or sent to third parties.