Guest user access and site security
What unauthenticated visitors can do, guest OWD and guest sharing rules, record ownership for guest submissions, securing guest-accessible Apex and flows, clickjacking and CSP settings, and periodic reviews.
Simple explanation
Guest users represent anonymous visitors. They're the highest-risk users because anyone on the internet is one.
Platform guardrails
- Guest OWD is Private for every object; access only through guest user sharing rules (criteria-based, read-only).
- Records created by guests are assigned to a default owner (an internal user); guests can't see them afterwards unless deliberately shared.
- Guests can't be granted some permissions at all, and others are restricted β verify current list.
Your responsibilities
- Give the guest profile the minimum object and field permissions.
- Apex reachable by guests (
@AuraEnabledin classes the guest profile can access, or invoked from guest flows) must usewith sharing, validate every input and return only non-sensitive data. - Flows run in guest context should avoid "system context without sharing" unless reviewed.
- Configure clickjacking protection, CSP Trusted Sites, and HTTPS-only settings.
- Use rate limiting, CAPTCHA or similar on public forms to prevent abuse β verify available options.
- Run the Guest User Access Report and site security reviews regularly.
Real-world analogy
Guests are visitors in a museum lobby. They can look at the exhibits on display (read-only, public records) and drop a letter in the suggestions box (create a record they can't retrieve). Every door off the lobby must be locked unless you deliberately opened it.
Worked example
A public claim-notification form: guests submit a screen flow that calls an invocable Apex action. The action validates and creates a claim owned by the claims queue's default owner, returns only a reference number, and never queries existing records. The guest profile has Create on a staging object only, not on Claim directly.
Diagram
Key points
- Guest OWD Private; access only via read-only guest sharing rules.
- Guest-created records get a default internal owner.
- Minimal guest profile; review guest-accessible Apex and flows.
- Clickjacking, CSP and HTTPS settings per site.
- Abuse protection on public forms.
- Regular guest access reviews.
Limits and gotchas
- One guest-accessible
without sharingmethod can expose data to the internet. - Search on guest pages can reveal more than intended if objects are readable.
- Old sites may keep risky settings from before guest hardening; review them.
π€ How to say this in an interview
Guest security is the classic "what could go wrong?" question for portals. Name the guardrails, then the developer responsibilities, then a review process.
Common follow-ups
Can guests update records?
Not directly through guest sharing (it's read-only). Updates must go through controlled server logic, which should verify the visitor (for example by a token sent by email) before changing anything.
How do you let guests track a submission?
Prefer asking them to register or log in. Otherwise send a secure link with a signed token to a page whose Apex validates the token and returns only status information.