Pular para o conteúdo

The Guest User, In Full

Este conteúdo não está disponível em sua língua ainda.

Module 2 of 8 in the chapter External Users: Sites, Communities, Licenses and Roles, chapter 14 of Securing Salesforce: Sharing and Visibility. Each module stands on its own.

The question this module answers: A public site’s guest user is everyone on the internet at once. Beyond its records, what else can it reach, and how do you lock it down?

In class I say it simply: this profile is the profile that represents the access of an anonymous user. Every visitor to a public site is that one user. Chapter 7 took apart how a guest gets records: guest user sharing rules, Read Only, and nothing else. That’s one of the two locks. This module is the other one, the profile, and everything else a guest can touch.

A guest sees a record only if both locks open: the profile gives the object and its fields, and a guest user sharing rule gives the record (the two locks). For the records, Salesforce has already locked it down. With Secure guest user record access, which “is enabled by default and can’t be disabled,” guest users have org-wide defaults “set to Private for all objects,” “Can’t be added to queues or public groups,” and “Can be granted Read Only access to records only through guest user sharing rules” (Best Practices and Considerations When Configuring the Guest User Profile (opens in a new tab), Salesforce Help, checked 2026-11-26).

So the records lock is mostly Salesforce’s. The profile lock is yours. And the guest profile is specific to its site: “Check the guest user profile for each site to ensure data security” (same page). Three sites, three profiles to check.

Locking down the guest, beyond the records Locking down the guest, beyond the records. Objects and fields: no access for almost all objects; only read and create are allowed; never View All Records, Modify All Records, update or delete; remove fields guests shouldn't see. System permissions: turn off View All Users, Run Flows and API Enabled unless the site needs them. Pages and code: only the Visualforce pages and Apex classes the site needs; with sharing on any @AuraEnabled method a guest can call, from Aura or Lightning web components; no object pages for objects outsiders shouldn't see. Review and test: the guest user sharing rule access report, and testing pages as a guest. Footnote: the records lock is Salesforce's; the profile lock is yours, one profile per site. {"author": "Steve Simpson", "blueprint": "1.0.1", "builder": "standard 1.59.0", "built": "2026-11-21", "id": "DGM-SVA-ES-02", "rights": "\u00a9 2026 Twinshark LLC. All rights reserved.", "template": "comparison 0.5.0", "theme": "stevetecharc 1.4.0"} Objects and fields start with nothing No access for almost all objects Only read and create allowed Never View All, Modify All, update or delete Remove fields guests shouldn't see System permissions off unless needed View All Users Run Flows API Enabled Pages and code only what the site needs Visualforce pages and Apex classes With sharing on guest @AuraEnabled methods No object pages for hidden objects Review and test as the guest Guest user sharing rule access report Test every page, not logged in The records lock is Salesforce's. The profile lock is yours, one profile per site. © 2026 Twinshark LLC · stevetecharc.com
Click to enlarge

Start with nothing. Salesforce: “For almost all objects, we recommend that the guest user has no access. If your business case calls for object data to be exposed to the guest user, set a maximum Read permission where possible” (same page).

And some of it isn’t a choice any more: “The only object permissions allowed for guest users are read and create.” Salesforce removed guest assignments from permission sets and groups that carried more, in Winter ‘23. The rules that stay with you (same page):

  • “Never assign the View All Records or Modify All Records permission to guest users.”
  • “Never assign update or delete permissions to guest users.”
  • Check the permission sets, permission set groups and permission set licenses assigned to the guest, so none of them gives “permissions not required for their business needs.”
  • Change the default record type on any object a guest can reach; the system default is Master.
  • “Remove field-level access to fields that you don’t want guest users to see.”

Create is the one to think hard about. A guest that can create records is a public form. Who owns what guests create is chapter 7’s last section (records guests create): turn on “Assign new records created by guest users to the default owner” (same page).

Three switches, each off unless the site needs it (same page):

  • View All Users. “Disable the View All Users permission if you don’t want guest users to see other users of the site.” It’s off by default on guest profiles in orgs created since Winter ‘20. Module 8 covers what site users can see of other people.
  • Run Flows. “If guest users aren’t using flows, disable the Run Flows permission. If guest users need flow access, disable the pause option on flows that guest users are accessing.”
  • API Enabled. “Salesforce strongly recommends that you disable the API Enabled permission unless guest users explicitly need API access.” Try it in a sandbox first.

A guest doesn’t only read records. It runs pages and code, and code can run with more access than the profile gives. From the same page:

  • Visualforce pages. Salesforce adds a set of pages to the guest profile by default: login, forgotten password, maintenance and error pages, and self-registration. “If your site doesn’t offer self-registration, remove these self-registration pages from your guest profile,” and “Remove all other Visualforce pages unless they support specific business processes.”
  • Apex classes. “Restrict Apex classes for guest users. Allow Apex class access only for REST or SOAP API use. Apex classes that serve as Visualforce controllers don’t need explicit access.” And look for code “that don’t check field-level security or object permissions or are in ‘without sharing’ classes.”
  • @AuraEnabled methods, for Aura and Lightning web components. “If a guest user can execute an @AuraEnabled method in an Apex controller used by a Lightning component, always use the ‘with sharing’ keyword,” and “Add guest user profile access to any @AuraEnabled Apex class used by an Experience Cloud site” (same page, checked 2026-11-26).

Visualforce is the older page technology, and Salesforce’s list still starts there because every site gets its default Visualforce pages. Today’s site pages are built from Lightning components. “Lightning component” in that quote covers both kinds: Aura components and Lightning web components (LWC), Salesforce’s current component model. A Lightning web component calls Apex the same way an Aura component does: “To expose an Apex method to a Lightning web component, the method must be static and either global or public. Annotate the method with @AuraEnabled” (Expose Apex Methods to Lightning Web Components (opens in a new tab), Lightning Web Components Developer Guide, checked 2026-11-26). So the rule isn’t only for Aura: any @AuraEnabled method a guest can reach, from either kind of component, runs with sharing.

That last one is the one I’d check first in any review. A component on a public page that calls without sharing code isn’t held back by guest user sharing rules at all. It’s the same lesson as Set 5, on the open internet. Chapter 17 covers secure Apex.

And the pages themselves. For object pages in Experience Builder, Salesforce’s advice: “Don’t create object pages for objects that aren’t exposed to external users,” and “If you set up object pages for authenticated users, test the pages to ensure that guest users can’t see them” (Best Practices and Considerations for Page-Level Access in Experience Builder (opens in a new tab), Salesforce Help, checked 2026-11-26).

Two ways to check your work.

The report. “Use the Guest User Sharing Rule Access Report page in Setup to quickly see what objects, records, and fields are accessible to your guest users using guest user sharing rules.” It “evaluates your configuration and flags potentially misconfigured sharing rules,” but “only you know your site’s business needs” (Give Secure Access to Unauthenticated Users with the Guest User Profile (opens in a new tab), Salesforce Help, checked 2026-11-26).

The test. Chapter 13’s three users work here too, with the guest as the user who shouldn’t see. Open the site in a private browser window, not logged in, and try every page and every object page an authenticated user has. Then try the records a guest rule shouldn’t reach. The guest is the negative test for the whole internet.

Test knowledge. Know that each site has its own guest user profile; that guest users can have only read and create object permissions, and never View All, Modify All, update or delete; that Secure guest user record access can’t be turned off; and to turn off View All Users, Run Flows and API Enabled unless the site needs them. Know that an @AuraEnabled method a guest can call, from an Aura component or a Lightning web component, should be with sharing, and that the guest profile needs access to its Apex class. A likely area, not a known question.

  • For each site, its guest profile: the objects, at Read where possible, and the fields.
  • Which objects guests may create records on, and who owns those records.
  • Which system permissions stay on: View All Users, Run Flows, API Enabled.
  • Which Visualforce pages and Apex classes the guest can reach, and that every @AuraEnabled method a guest can call, from Aura or Lightning web components, runs with sharing.
  • Which object pages exist on the site, and the guest test that proves the authenticated ones are closed.
  • Who reviews the guest user sharing rule access report, and how often.

Beyond the exam: what AI changes. An agent on a public site is the guest’s most powerful tool. If it answers as the guest user, every visitor gets what the guest can reach, through a sentence instead of a page. If its actions run code, the same rule applies as for an @AuraEnabled method: with sharing, or it isn’t held back at all. Before an agent goes on a public page, list what its user can read, and test it as an anonymous visitor. Chapter 20 covers agents.