• Fri. Oct 9th, 2026

Securing Salesforce Deployments: What Usually Goes Wrong

Salesforce is used by many of the organizations, and this is why its security is also a concern for many people nowadays. Many of the security problems that arise in the Salesforce do not happen due to hackers. Well, they take place due to small release mistakes. Here, there will be permission sets with too much access, a token left in the script, a sandbox full of real customer emails.

This is why it may need a few rules applied consistently. In this article, we have discussed in detail how to securely deploy Salesforce. If you are looking to understand this and become a Salesforce Developer, taking a Salesforce Course Online can help with the same. This online course is one of the great ways to learn at your own pace from anywhere. 

Salesforce Security Basics for Your Release Process

Use Git and pull requests

If you have metadata in the organization, you will have nothing in history. All you need is to put the Apex Classes, flows, and permission get set in Git. If the release goes wrong at any time, you need to roll back one commit instead of predicting what has changed. 

You need to protect the main branch and block direct pushes, and require an approved pull request for every change. So reviewers can catch the things that tests miss. A profile edit that is quietly opening the sensitive object is a good example. 

Cut down who has access

Run a report on who has Modify All Data and View All Data. The list is nearly always longer than it should be. Move access from profiles to permission sets, so each set has one clear job. Audits get much easier this way.

Treat your deployment pipeline the same way. Give it its own integration user with deployment rights only, not a named admin account. If the pipeline runs as a person, it can break when that person leaves or changes their password. And if a token leaks, the attacker gets the whole org.

Keep secrets out of the repo

Teams commit tokens and consumer secrets more often than they admit. It usually happens during a quick test that nobody cleans up. Deleting the file doesn’t help, because the secret stays in Git history. You have to rotate it.

A safer setup looks like this:

– Store secrets in your CI/CD tool’s secret store.

– Use JWT login for the pipeline.

– Use Named Credentials in Salesforce, so Apex never holds a key or endpoint.

– Run a secret scanner on the repo to catch mistakes early.

Let tools do the first pass of review

Most of the time people gwt tired and after that long pull requests get skipped. What the Salesforce Code nalayzer fo is to check each of the change for the SOQL injection, missing field-level security checks, classes that ignore sharing. All you need is to set the pipeline to check the seripus findings and check whether this happen all the time, with no need to remember anything. 

Write tests that check permissions

The 75 percent coverage rule is a minimum for deployment. It isn’t a security measure, because it only shows that lines of code ran. A good security test runs as a restricted user and confirms that the user can’t read or edit a record. It also sends in bad input and checks that the code handles it. Run these tests on every validation deployment.

If your team finds testing hard, a Salesforce Testing Course can help. It covers Apex test design, test data setup, and automating repeated checks.

Remember that sandboxes hold real data

A full sandbox copy has real names, emails, and phone numbers, and it’s usually guarded less than production. Mask sensitive fields when you refresh. Scratch orgs with generated data avoid the problem altogether. Also turn off outbound email in every test environment. A test email reaching a real customer is a common mistake, and it’s easy to prevent.

Control the path to production

Always end the changes through the same route every time, beginning from development, testing, staging, then production. Also, you need to add a manual approval before the last step and run a validation-only deployment before the real one. Together, all these can catch most problems earlier. 

After a release, Setup Audit Trail shows who changed configuration, and Event Monitoring shows odd logins or sudden jumps in API calls. Keep a written rollback plan, and try it at least once so you know it works.

Clear out old components

Unused connected apps, integrations, and packages are still ways in. Review them every few months and delete what nobody uses. Look carefully at any new AppExchange package before you install it, and update old API versions.

Don’t forget the people

A scanner won’t explain the reason behind the rule existence. This is how they will find the ways around the same. All of the admins, developers, and testers all need the same basic knowledge. So a Salesforce works best here and people can study this with the regular work. If the team is moving towards the automated releases, Salesforce DevOps Course covers version control, CI/CD pipelines, and safe deployment, with hands-on practice.

A realistic starting point

Doing all of this in one sprint is unrealistic. Branch protection and secret scanning take little time and remove a large share of risk, so they are a sensible first pair. The rest can be added one item at a time.

Conclusion:

As we discussed above, most of the Salesforce security problems come from small release mistakes, not from attackers. Giving too much access, a secret in the repo, a sandbox with real customer data, or a change nobody reviewed can each cause real damage. The fixes are not complicated. Keep your metadata in Git and require approved pull requests. Limit who has broad access, and give the pipeline its own integration user.

By hemant