Transaction Security at the Door
Dette indhold er ikke tilgængeligt i dit sprog endnu.
Module 6 of 6 in the chapter Watching the Door: Troubleshooting and Audit, chapter 16 of Securing Salesforce: Identity and Access. Each module stands on its own.
The question this module answers: Can Salesforce act on a login as it happens, not just record it?
From a record to a rule
Section titled “From a record to a rule”Everything so far in this chapter happens after the fact. Login History tells you who logged in yesterday. The Setup Audit Trail tells you who changed a setting last week. Useful, and often enough. But security teams usually ask one more question: when a login looks wrong, can Salesforce stop it, right then?
It can. Transaction security lets you write a policy on an event, and when the event matches, Salesforce takes an action. For logins, the event is LoginEvent. This module covers the login side only: what a login policy can see, what it can do, and what it can’t. Sharing and Visibility, chapter 19 (Monitoring: Real-Time Events, Log Files and Transaction Security) covers transaction security in full, for reports, list views, API queries and the rest (Transaction Security Policies Notify, Ask for Proof, or Block and Watch the Exits).
First, the license, plainly. LoginEvent policies “require Salesforce Shield or Salesforce Event Monitoring add-on subscriptions,” in Enterprise, Unlimited and Developer Editions (S4). So a Developer Edition org can try it, and a production org needs the add-on (as of 2026-11-06).
What a login policy can see
Section titled “What a login policy can see”A policy is a set of conditions on the login. Salesforce lists what you can test (S4), and for identity, these are the useful ones:
- Who: Username, User Type.
- Which door: Login Type, Login Subtype (which OAuth flow), Login URL, Application, API Type.
- From where: Source IP, Country, Platform, Browser, TLS Protocol.
- How well proven: Session Level, Authentication Method Reference.
Most of these are the same columns you read in Login History in module 2. That’s the useful way to think about it: a login policy is a Login History filter that acts. You build one in the Condition Builder, with no code, or in Apex for logic the builder can’t express (S10).
What it can do
Section titled “What it can do”Three actions (S4, S5):
- Block. The login doesn’t happen. For a login, the user sees Salesforce’s standard message; a custom message is only for API, list view and report events (S5).
- Multi-factor authentication. Ask for more proof before letting the login through. But only where a person can answer: “Multi-factor authentication isn’t supported for Lightning Login (passwordless login) users or for API-based logins. For API-based logins, the action is upgraded to Block” (S4).
- Notifications. An email, with the subject “Transaction Security Alert,” or an in-app notification, to the people you choose (S5). On its own, or with Block or MFA.
Read that MFA line twice. A policy that says “ask for MFA from outside our country” will, for an integration logging in through the API from a cloud server abroad, block the integration. That might be what you want. It might also be the outage nobody can explain at two in the morning, unless they know to look here.
What it can’t see
Section titled “What it can’t see”Two limits, so nobody expects more than it gives.
It doesn’t see wrong passwords. Login policies “aren’t triggered by invalid login attempts such as incorrect passwords” (S4). Someone trying password after password is in Login History (module 2), and the add-on’s credential stuffing detection (module 5), not in a login policy.
It sees Salesforce’s side only. A login through single sign-on is a SAML login to Salesforce, and LoginEvent captures it (S4). But what happened at the identity provider, before Salesforce, is the identity provider’s business and its own logs.
A rule at the door can lock the door
Section titled “A rule at the door can lock the door”Here’s the part I’d want every architect to take away. A login policy is a lock on the front door, and you’ve seen in this course what happens when the front door locks the wrong people out. A policy that blocks the admins is chapter 4’s bad day, made by you.
So treat a login policy like any change to the door, and start with the back door. My rule is simple: if any mechanism could lock people out, by mistake or because it fails, keep at least one user who can bypass it and use Salesforce’s own login. That usually means one profile, and maybe a couple of users, kept as a backup. That’s your way back in, your break glass, for the day the policy locks out the wrong people. It’s the same back door as chapter 4, module 5, and those admins shouldn’t match a policy that can block them.
That isn’t a user with no authentication. It’s Salesforce’s own authentication, without the extra rules on top, and you can still lock it down: MFA, IP restrictions, and more. In a small org of ten users, the extra license may not be worth it. In any larger or critical org, it is.
Salesforce’s own Well-Architected guidance says the same thing in its words. Transaction security policies “tuned too aggressively can block valid business activity,” so “stage them in monitor-only mode before enforcing them, and design a break-glass path for when a control misfires” (S15). And for any emergency access: “Maintain break-glass procedures for emergency access and post-use auditing” (S15). A back door nobody watches is just another way in, so log every time it’s used.
Then the rest:
- Watch before you block. Run the policy with notifications only, and read what it would have caught, before you turn on Block or MFA (S15).
- Test it, in a sandbox or a Developer Edition org, with real user types: an employee, an integration, a customer on a site.
- Know what happens when it fails. An Apex policy is code, and code can throw. Salesforce’s answer has been the same since Spring ‘19: it fails closed. “If the Apex code in a policy fails at runtime or exceeds the org’s metering limits, the policy blocks the user,” so “users can be locked out of Salesforce when the policy code has a bug.” For a login policy, getting back in means asking Salesforce Customer Support to turn Transaction Security off while you fix the code (S16). That’s one more reason to keep the back door above outside every login policy.
- Know who’s told. Salesforce’s own quick start says to “work with your InfoSec or security teams” (S10). A notification nobody reads is a record, not a rule.
A policy, a login flow, or a session level?
Section titled “A policy, a login flow, or a session level?”Three tools in this course can act at the login, and they’re easy to mix up.
- A login policy (this module) watches every login against conditions and blocks, asks for MFA, or notifies. It needs the add-on.
- A login flow (the Front Door chapter) puts screens after the login for a profile: an extra question, a terms page, a check. Every org has it.
- Session security levels (chapter 13 for apps; the Front Door chapter for profiles) require a high-assurance session for a profile or an app. Every org has them.
If you need “every login from outside these countries must do MFA, and tell security,” that’s a login policy. If you need “partners see a terms page once a year,” that’s a login flow. If you need “this app needs a high-assurance session,” that’s a session level. The simplest one that does the job is usually the right one.
Test knowledge. In my experience, know that transaction security can act on logins (block, MFA, notify), that it needs Shield or Event Monitoring, and that MFA becomes a block for API logins. Be ready to choose between a login policy, a login flow and a session security level.
The end of the chapter
Section titled “The end of the chapter”You’ve now got a method (module 1), the logs (module 2), the wire (module 3), the usual failures (module 4), the audit (module 5), and the rule at the door (this module). The practice puts them together: break four things on purpose in your lab orgs, find each one, and write the one-page runbook chapter 6 promised.
Then chapter 17 adds a new kind of user at the door: the agent.
What an architect decides here
Section titled “What an architect decides here”- Whether a login needs a rule, or only a record: a policy, or Login History read on a schedule.
- Which tool acts at the login: a policy, a login flow, or a session level.
- What every policy does to integrations, knowing MFA becomes a block for API logins.
- Who is outside every blocking policy: the back door.
- Who receives the alerts, and what they do next.
Explore
Section titled “Explore”- LoginEvent Policies (opens in a new tab) (Salesforce Help; checked 2026-11-21)
- Transaction Security Actions and Notifications (opens in a new tab) (Salesforce Help; checked 2026-11-21)
- User Lockout When Apex-Based Transaction Security Policy Fails at Runtime (Spring ‘19 Behavior Change) (opens in a new tab) (Salesforce Help; checked 2026-11-25)
- Trust (opens in a new tab) (Salesforce Architects, Well-Architected; checked 2026-11-21)
- Quick Start: Event Monitoring (opens in a new tab) (Salesforce Help; checked 2026-11-21)
