Sub topic 11
Designing access with least privilege
This chapter assumes you know what a user, a user licence, a profile and a permission set are, and that you can create a user in Setup. It covers how to combine those pieces so each person gets the access their job needs and nothing more.
What least privilege means in Salesforce
Least privilege means a user receives only the permissions required for their work. In Salesforce, access is the sum of several layers:
- The user licence sets the ceiling. It decides which features and objects a profile can ever grant.
- The profile is the baseline. Every user has exactly one.
- Permission sets add access on top of the baseline. A user can hold many.
- Roles and sharing decide which records the user can see. They are covered separately from object and field permissions.
Permissions from a profile and from permission sets are additive. Salesforce takes the union of everything granted. Almost nothing a permission set grants can be cancelled by another permission set, so the safest design keeps the baseline small and adds access deliberately.
The baseline-plus-additions pattern
The recommended pattern has three parts.
- Use a minimal profile that grants only what every user of that licence type needs. Typical examples are login access, basic tab visibility and read access to a few shared objects.
- Create task-based permission sets, each describing one capability. Examples are "Edit Opportunities", "Run Reports" and "Manage Case Queue".
- Combine permission sets into permission set groups that match job roles, such as "Sales Rep" or "Support Agent".
A new hire in sales then receives a standard profile plus one group. Nobody edits a profile for a single person. When a job changes, you swap the group instead of rebuilding the user's access.
Choosing between a profile and a permission set
Use this table when you decide where a permission belongs.
| Question | If yes | If no |
|---|---|---|
| Does every user of this licence need it? | Put it in the profile | Put it in a permission set |
| Does only one team need it? | Permission set | Profile |
| Is it a setting that only profiles control? | Profile | Permission set |
| Will it change as people change jobs? | Permission set or group | Profile |
Some settings live only on profiles, including login hours, login IP ranges and the default record type for an object. Plan for these in your baseline profiles. Salesforce has been moving other settings toward permission sets, so check the current release notes before assuming a setting is profile-only.
Building a minimal profile
Start from a cloned profile rather than editing a standard one. Standard profiles cannot be fully restricted, and Salesforce can change them between releases.
- In Setup, open Profiles and clone the profile closest to your needs. The clone keeps the same user licence.
- Name it for its purpose, for example
Base - Salesforce User. - Remove object permissions the baseline does not need. Remove Delete, Modify All and View All first.
- Review system permissions and turn off anything not required, such as Export Reports or Manage Users.
- Save, then test with a sandbox user.
Treat Modify All Data and View All Data as administrator-only. They bypass sharing rules and record ownership, so one assignment overrides the careful design you built everywhere else.
Building task-based permission sets
A good permission set has one purpose and a name that says what it does. Keep these rules in mind.
- Grant at the lowest level that works: Read before Edit, Edit before Delete.
- Prefer field-level security that grants only the fields the task uses.
- Avoid a catch-all "Everything Sales" set. Large sets are hard to review and tend to grow.
- Record why each set exists in its Description field. Reviewers rely on it.
A permission set can be tied to a user licence or left without one. A set with no licence can be assigned to users on any licence, but it can only grant permissions that the user's licence allows. A set bound to a licence can be assigned only to users of that licence. If a permission set needs a permission set licence, the assignment fails until the user has that licence. Chapter material on permission set licences explains the capacity side.
Permission set groups and muting
A permission set group bundles permission sets so you can assign one thing per job role. Group members receive the combined permissions of every set inside.
Muting handles the case where a set is nearly right. Suppose "Support Core" includes Delete on Cases, but your junior agents should not delete. Instead of duplicating the set, you add a muting permission set to the group that removes Delete on Cases for that group only. Other uses of "Support Core" are unaffected.
Two points to remember:
- Muting applies only inside the group. The same permission set assigned directly to a user still grants the permission.
- A group has a status. After you change its members, it recalculates, and the group is usable only when the status shows Updated.
Verifying what a user can actually do
Design is not finished until you check the result. Use these tools.
- On the user record, open Permission Set Assignments to see every set and group assigned.
- In Setup, use the View Summary page on a permission set or profile to read the grants in one place.
- Use Login As or a test user in a sandbox and try the real task.
- Query assignments in bulk with SOQL.
This query lists every permission set assigned to one user. It excludes the hidden sets that profiles create internally.
SELECT PermissionSet.Label, PermissionSet.Name, PermissionSetGroupId
FROM PermissionSetAssignment
WHERE AssigneeId = '005XXXXXXXXXXXXXXX'
AND PermissionSet.IsOwnedByProfile = false
ORDER BY PermissionSet.LabelReplace the ID with a real user ID. This query shows who holds a powerful system permission and is useful in access reviews:
SELECT Assignee.Name, Assignee.Username, PermissionSet.Label
FROM PermissionSetAssignment
WHERE PermissionSet.PermissionsModifyAllData = true
AND Assignee.IsActive = true
ORDER BY Assignee.NameThe second query returns permission sets, including those that profiles own internally. That is intentional here, because it also finds users whose profile grants Modify All Data.
Common failure modes
| Symptom | Likely cause | Fix |
|---|---|---|
| A user can do something you never intended | A permission is granted by a second set, the profile, or a group, and permissions add up | Check all assignments, then remove the grant at its source |
| Muting seems to have no effect | The permission is also granted by a set assigned directly to the user | Remove the direct assignment and use the group |
| Assignment fails with a licence error | The permission set requires a permission set licence the user lacks | Assign the permission set licence first |
| A group does not give the expected access | The group status is not Updated | Wait for recalculation, then retest |
| One profile per person has appeared | Profiles were edited to fit individuals | Move the extra access into permission sets and reassign a baseline profile |
Running an access review
Least privilege decays unless you maintain it. Schedule a review, at least quarterly, and follow this routine.
- List users with Modify All Data, View All Data or Manage Users, using the query above. Confirm each one is justified.
- Look for permission sets with no assignments and retire them.
- Compare each group to its job role. Remove sets that no one uses.
- Check inactive users. Deactivate those who have left, which also releases a licence.
- Record the outcome so the next review can compare.
Decision criteria
- Few users, one-off need: a single permission set assigned directly is fine.
- A recurring job role: build a permission set group.
- A restriction that applies to a group only: use muting.
- A setting that applies to everyone on a licence: adjust the baseline profile.
- Anything that bypasses sharing: limit to administrators and review it regularly.
Exercise
A support agent needs to edit Cases but not delete them. The existing "Support Core" permission set grants Edit and Delete on Cases and is used by several teams. Describe how you would give this agent the right access without changing the other teams.
Show answer
Create a permission set group for the agent's role and add "Support Core" to it. Create a muting permission set that mutes Delete on Cases and add it to the group. Assign the group to the agent, and make sure "Support Core" is not also assigned directly, because a direct assignment would still grant Delete. Other teams keep using "Support Core" unchanged. Confirm the group status is Updated, then test as the agent in a sandbox.
Exercise
Why is it better to put a rarely needed permission in a permission set than to add it to the profile, and what is one setting that must still live in the profile?
Show answer
A profile applies to everyone who holds it, so adding the permission there gives it to all of them. A permission set grants it only to the people who need it and can be removed when their job changes. Login hours and login IP ranges are examples of settings that are controlled on the profile.