OBLYTECH Logo
OBLYTECH Logo

Trust Architecture Review: Shared Responsibility for Salesforce Custom Code

Salesforce operates the underlying platform and its built-in security features. Your implementing team owns what it configures, grants, builds and stores on top: access settings, custom code, integration credentials and business data. Writing that split down before go-live shows who signs off on each control and where gaps tend to appear.

Where the platform provider’s duties end and yours begin

Shared responsibility in a hosted platform means the provider secures the layers it runs: the physical and network infrastructure, the application runtime, and the security features it exposes to you. The customer keeps the layers that reflect its own business decisions. Those decisions include who may see which records, which automations run, what custom code does with data, and how external systems prove who they are.

The boundary is not one clean line. A configuration you make can switch off or weaken a protection the platform offers, so the test question for each control is who chose its setting and who checks it afterward. A protection that is available but disabled by your team is your gap, even though the platform supplied it.

Building the ownership inventory before the first review

Start with an inventory rather than a policy document. List each control area on its own line and write one accountable name beside it.

A workable inventory usually covers these areas:

  • Sign-in and identity, including how internal and external users authenticate.
  • Roles, permission sets and record access.
  • Configuration changes such as validation rules, flows and page layouts.
  • Custom code, including Apex classes, Lightning components and scheduled jobs.
  • Integrations, including integration users, connected apps and stored credentials.
  • Data handling, covering what leaves the org, where test data comes from and how long audit records are kept.

Teams that skip this step often find that an administrator assumed the developers had checked a field restriction, while the developers assumed the administrator had set it. The inventory exposes that gap before a user finds it. For help planning this work, see Salesforce implementation.

Access controls your team owns

Permission sets and record access

Access is often assigned by habit rather than by design. Prefer permission sets for new grants where your org’s design allows it, and keep each set narrow enough that its purpose is clear from its name. Review anyone who holds system-level permissions, such as the ability to change configuration or export data, and record why each holder needs that access. The design approach for smaller teams is covered in permission set design for small teams.

Check field access and record access separately. A user can open a record and still be unable to see one of its fields, so a test that only confirms the record appears proves less than it seems.

External users and login paths

Users who sign in through a community or portal form a separate population with their own risk. Decide which login methods each group may use, who approves each external identity, and what those users can see if a sharing setting is wrong. Login options for community-style sites are covered in Experience Cloud login options.

Test each login path with a user who has the smallest role you plan to support. An administrator account typically sees more than a standard user, so a test run as an administrator tells you little about what a restricted user is shown.

Approvals for access changes

Name one approver for each permission set and keep that person separate from the requester. For sets that grant broad system access, add the security owner as a second approver.

Custom code: where the shared line blurs

Custom code is where the split between platform and team is hardest to see. The platform executes the Apex, Lightning components and flows your team deploys, but it cannot judge whether a piece of logic exposes the wrong data to the wrong person. For each component, record its purpose, the objects and fields it reads or writes, whether it runs with the calling user’s access, and which external services it calls.

Review checklist before release

  1. Confirm that the code respects the access the calling user already has, rather than reaching for wider access to finish its job.
  2. Check that record values do not appear in debug output, logs or error messages shown to users.
  3. Move hard-coded identifiers, endpoints and credentials out of the code and into managed configuration.
  4. Have a second reviewer, who did not write the change, sign off against this checklist.

A change can pass its automated tests and still expose a field a user should not see. Tests often run with broad access, so the review needs a case that runs as a restricted user.

Limits and partial failure

Bulk and scheduled code is where platform limits turn into data integrity problems. A job that stops partway can leave some records updated and others not, which affects reports and anything downstream that reads the data. Before you release code of this kind, review it against the execution limits that apply, and decide in advance how a partial run will be detected and corrected. The admin-facing view of those limits is in governor limits for admins.

Integrations, credentials and outbound data

Integrations are where custom code most often holds a secret it should not. Keep credentials in the platform’s credential storage or in your identity provider, not in code, custom fields or shared documents. Give each integration its own user with the narrowest access the job needs, so that its activity can be traced to one owner.

Set a rotation date for each credential and name the owner who receives the reminder. A credential with no named owner usually outlives the project that created it, and the gap often surfaces only when it is compromised or expires during an outage.

Treat outbound data with the same scrutiny as code. List the fields each outbound call sends, confirm that the receiving system is approved to hold them, and remove any field it does not need. Configuration changes can also affect the inbound side. A new validation rule can reject records an integration sends, so check changes with the integration owner before release. The mechanics are covered in validation rules without breaking integrations.

Testing the security model before release

Test the security model in a sandbox that has been refreshed recently enough to match current roles and data. An old sandbox hides permission changes made after its copy was taken, so a passing test can describe a configuration that no longer exists. Plan refresh timing ahead of each release so testers are not working from last quarter’s setup. The planning steps are covered in sandbox refresh planning.

Use test data that contains no real personal information unless your data policy explicitly allows it, and point outbound integrations in test environments at test endpoints. An integration that still calls a live system from a test environment can send real records and real messages, so confirm the endpoint before any run.

A minimum test set for a security-sensitive release usually includes:

  1. One run per restricted role the release touches, checking visible records and fields.
  2. A run of each changed integration against a test endpoint, with its credential confirmed.
  3. A check that scheduled jobs still have an active owner after the change.
  4. A written result for each test, with the tester’s name and the build it covered.

Reporting, monitoring and evidence

Keep the change record for each permission grant, the code review sign-off, the credential rotation log and the results of restricted-user tests. Export the audit and login information your org makes available on a regular schedule, and store the export outside the org so it survives a sandbox refresh or a configuration cleanup.

Confirm on your own instance how long each audit record stays available. That period can differ by release and by setup, so set the export schedule from the retention you actually observe rather than from a figure you assume.

Reviewing the split at each platform release

Revisit the ownership inventory at each platform release and whenever the team changes. A new feature can move a control from your side of the line to the platform’s side, and a staff change can leave a control with nobody in charge. Start the review with the inventory, confirm that each named owner is still in role, and open a task for each control that lacks a clear owner.

Questions about shared responsibility for Salesforce custom code

Does the platform check my custom code for security problems?

Treat code review as your team’s job. The platform runs what you deploy, but a successful deployment does not show that the logic respects your access model. Reviewers and restricted-user tests carry that check.

What should happen when a team member leaves?

Remove the person’s access on their last working day rather than at the next review. Reassign any integration user, flow or code component they owned, and confirm that scheduled jobs still have an active owner, because a job left under a departed user’s account can keep running unwatched.

Do external users need a separate review?

Yes. External users arrive through different login paths, and they often meet sharing rules that were written with internal staff in mind. Review them with their own test users, and repeat that check after any change to a public-facing page.

Where should a team with no written split begin?

Begin with a single page that lists the control areas and one accountable name for each. Then run a restricted-user access test and record the gaps it finds, starting with the areas that hold the most sensitive data.