Sub topic 5
Checking permissions, data access, and external connections
This chapter assumes you can navigate Setup, know how profiles and permission sets combine to grant access, and can run sf commands against a sandbox. You should also know which objects and fields in your org hold sensitive data. The goal is to learn what an app can do before you install it, and to confirm after installation that it does only that.
The three questions to ask
Every package asks for access in three places. Check all three, because a package that looks harmless in one area can be risky in another.
- What can it read and change inside Salesforce? This covers objects, fields, user permissions, and Apex code that runs with elevated access.
- What can it do on behalf of users or other systems? This covers connected apps, OAuth scopes, and API access.
- Where can it send data? This covers remote site settings, CSP Trusted Sites, named credentials, and any other outbound endpoints.
The publisher's documentation and the Security Review both help, but neither replaces your own inspection. The review is a point-in-time check by Salesforce. Your org's data and risk tolerance are specific to you.
Start with the listing and documentation
Before you install anything, collect the publisher's own statements. Look in the listing, the install guide, and any security or privacy whitepaper for:
- A list of objects and fields the app reads or writes.
- The permission sets it ships, and which one is meant for admins and which for end users.
- The domains it calls, and what data goes to each one.
- Where the publisher stores your data outside Salesforce, and how long they keep it.
- Whether the app needs an API-enabled integration user.
Write these claims down. After installation you will compare them with what the package actually contains. A mismatch is a finding to raise with the publisher before you go further.
Read the install page, not just the button
When you open an install link in a sandbox, Salesforce shows a page before anything is installed. Several parts of it matter.
- View Components lists what the package will add: custom objects, fields, Apex classes, Lightning components, permission sets, connected apps, remote site settings, named credentials, and more. Scan it for items you did not expect, such as many Apex classes in a package that claims to be a simple widget.
- Approve Third-Party Access appears when the package includes remote site settings or CSP Trusted Sites. It lists external websites that the package may send your data to. You must select the checkbox to continue. Read the domains. Do not select it by reflex.
- Install options (admins only, all users, or specific profiles) decide who gets access immediately. The next chapters cover this in detail. For now, remember that "all users" is a poor default for any app you have not yet inspected.
Inspecting internal access
Object and field permissions
Packages usually grant data access through permission sets rather than profiles. Open each permission set in the package (Setup, Permission Sets) and review the object settings. Pay particular attention to these permissions:
| Permission | What it allows | Why it matters |
|---|---|---|
| Read, Create, Edit, Delete | Normal CRUD on an object | Check that it is limited to objects the app needs |
| View All Records | Reads every record, ignoring sharing | Bypasses record-level sharing for that object |
| Modify All Records | Edits and deletes every record, ignoring sharing | Treat as high risk unless the app's purpose requires it |
| View All Data | Reads every record on every object | Org-wide read access |
| Modify All Data | Full edit and delete access on every object | Org-wide write access, rarely justified |
| API Enabled | Allows API calls | Required for integrations, and it widens the attack surface |
You can query these values instead of clicking through each permission set. Replace examplens with the package's namespace prefix. The first query finds permission sets with org-wide permissions, and the second lists object-level access.
sf data query --target-org my-sandbox --query "SELECT Name, Label, PermissionsModifyAllData, PermissionsViewAllData, PermissionsApiEnabled, PermissionsAuthorApex FROM PermissionSet WHERE NamespacePrefix = 'examplens'"
sf data query --target-org my-sandbox --query "SELECT Parent.Name, SobjectType, PermissionsRead, PermissionsCreate, PermissionsEdit, PermissionsDelete, PermissionsViewAllRecords, PermissionsModifyAllRecords FROM ObjectPermissions WHERE Parent.NamespacePrefix = 'examplens'"The object query lists every standard object the package's permission sets touch, not just the package's own custom objects. A package for managing event registrations that requests Modify All Records on Account or Contact deserves a question to the publisher.
Field-level security
Object access is only half the picture. Check field permissions on sensitive fields that the package's permission sets touch, such as personal identifiers, financial data, or health information. The package cannot override a restriction that you set on a field unless a permission set grants it. If the package's permission set grants read access to a sensitive field on a standard object, ask why.
Code that runs with elevated access
Apex in a managed package is hidden from you, so you cannot read its sharing keywords. Apex classes in unmanaged packages are visible, and you can read them. Look for these patterns:
without sharingon classes that query or update records. Such code ignores the running user's record-level access.WITH SECURITY_ENFORCEDorWITH USER_MODEin queries, andSecurity.stripInaccessiblebefore DML. These show the developer respects field-level security. Their absence is a warning in code you can see.- Classes marked
@AuraEnabledorglobalthat expose data to components or other code.
For managed packages, rely on the publisher's documentation, the Security Review summary, and your own behavior tests in the sandbox. Test with a low-privilege user and confirm that the user cannot see records or fields they could not see before.
Inspecting delegated access
A package can include a connected app, which lets an external system authenticate to your org using OAuth. The scopes on the connected app decide how much that system can do. Look at them in Setup, under Connected Apps, then Manage Connected Apps or the OAuth usage page.
| OAuth scope | Meaning | Review note |
|---|---|---|
| `api` | Access to your data through the REST and SOAP APIs as the user | Normal for integrations. Pair it with a restricted user. |
| `refresh_token` | Lets the app keep access after the session ends | Confirm the app needs long-lived access. |
| `full` | Everything the user can do | Treat as high risk. |
| `web` | Use the user's session in a browser | Rarely needed for server integrations. |
Two settings reduce risk. In the connected app's policies, set Permitted Users to "Admin approved users are pre-authorized" so that only users you assign through a permission set or profile can use it. Set IP Relaxation according to your policy, and restrict by IP range when the publisher can give you fixed addresses. A connected app that allows "All users may self-authorize" lets any user grant the external system access to their own data.
Inspecting outbound connections
Salesforce blocks Apex callouts to hosts that are not registered. A package that calls an external service must therefore ship one or more of these:
- Remote Site Settings, which allow Apex callouts to a URL.
- CSP Trusted Sites, which allow browser-side requests from Lightning pages to a host.
- Named Credentials (with external credentials), which store an endpoint and its authentication, so secrets are not in code.
List what the package registered. These queries use the namespace placeholder again. The first one needs the Tooling API flag.
sf data query --use-tooling-api --target-org my-sandbox --query "SELECT DeveloperName, EndpointUrl, IsActive, NamespacePrefix FROM RemoteProxy WHERE NamespacePrefix = 'examplens'"
sf data query --target-org my-sandbox --query "SELECT DeveloperName, Endpoint, NamespacePrefix FROM NamedCredential WHERE NamespacePrefix = 'examplens'"For each endpoint, check these points:
- Is it HTTPS? Plain HTTP sends data without encryption.
- Does the domain belong to the publisher or to a vendor they name? Compare it with the documentation you collected. Subprocessors are normal, but they should be disclosed.
- Is the hostname broad? A wildcard or a generic cloud host name is harder to attribute than a dedicated domain.
- Where does authentication live? Credentials in a named credential are better than keys in custom settings or in code.
Observing real behavior in the sandbox
Static inspection tells you what the package is allowed to do. A short observation period in the sandbox shows what it does. During your trial:
- Turn on Event Monitoring or Setup Audit Trail if your edition supports them. Review API activity from the app's integration user.
- Open Debug Logs for a test user and run the app's main flows. Look for callout entries and the endpoints they hit.
- Run the same flows as a user with the minimum permission set, then as a user with none. Record what each can see.
- Compare observed endpoints with the list you built from the documentation and the install page.
If you find a callout to a host that appeared in neither the documentation nor the Remote Site Settings list, it may be a platform service or a subprocessor. Ask the publisher, and do not guess.
Common errors
- Reading only the permission set names. Names such as "Admin" or "User" do not tell you what they grant. Query or open them.
- Approving third-party access without reading it. The checkbox is the only gate for outbound hosts at install time.
- Assuming the Security Review covered your concerns. It checks the publisher's code and architecture against Salesforce's rules, not your data classification or compliance rules.
- Giving the integration user a full System Administrator profile. Create a dedicated user with a minimal permission set instead.
- Ignoring standard objects. Packages often request access to Account, Contact, and User, which hold your most sensitive records.
- Treating "hidden code" as "safe code." Managed packages protect the publisher's intellectual property. They also stop you from reading the code, so your inspection must lean on permissions, endpoints, and observed behavior.
A review checklist
Use this list as the output of the chapter. Record the result for each item in a document you keep with the install approval.
- Publisher's stated data use and endpoints, written down before installation.
- Package components reviewed on the install page, and any unexpected items noted.
- Permission sets queried for org-wide permissions and standard object access.
- Sensitive fields checked against the package's field permissions.
- Connected app scopes and policy settings reviewed.
- Remote sites, CSP Trusted Sites, and named credentials listed and matched against the publisher's claims.
- Behavior observed in the sandbox with logs and low-privilege users.
- Open questions sent to the publisher, with their answers saved.
Exercise
A package's permission set grants Modify All Records on Account. Name two checks you would do before you decide whether to install it, and say what result would make you decline.
Show answer
First, check the publisher's documentation to see whether the app's stated purpose needs to edit or delete every Account record regardless of sharing. Second, in the sandbox, run the app's main flow as a low-privilege user and confirm whether the app works without that permission, for example by assigning a copy of the permission set with Modify All Records removed. Decline, or ask for a narrower permission set, if the app's features work without the permission or if the publisher cannot explain why it is needed.
Exercise
You run the Tooling API query against RemoteProxy for a package and find an HTTP (not HTTPS) endpoint on a domain the publisher never mentioned. What should you do, and what should you not do?
Show answer
Contact the publisher and ask what data goes to that endpoint, who owns it, and why it is not HTTPS. Keep the package out of production until you have a satisfactory answer. Do not install the package for all users or approve the access on the basis that the Security Review passed, because the review does not confirm that every endpoint fits your data policy.
Exercise
Which connected app policy setting prevents users from authorizing the external system on their own, and what should it be set to?
Show answer
Permitted Users. Set it to "Admin approved users are pre-authorized" and then assign the connected app through a permission set or profile to the users who need it.