LWCAdvancedsecurityexperience-cloudlds
Secure LWC against IDOR when record Id comes from URL parameter
Real World Scenario
Experience Cloud LWC reads recordId from CurrentPageReference and displays Order details. User changes URL Id to view another customer order.
Expected Answer
• Server Apex validates recordId belongs to current user before returning data
• Wire getRecord returns error for inaccessible records—handle not leak data
• Never trust client-side recordId alone for authorization decision
• Encrypted or tokenized public URLs instead of raw Salesforce Id in community
• stripInaccessible in Apex for any supplemental data beyond LDS wire
• Penetration test URL Id enumeration on community pages
• Log unauthorized access attempts with user and attempted Id
Follow-Up Questions & Answers
Click to expand — each follow-up includes a direct, interview-ready answer
Direct answer: Server Apex validates recordId belongs to current user before returning data Also consider: Wire getRecord returns error for inaccessible records—handle not leak data In practice: Never trust client-side recordId alone for authorization decision Optimize for scale and operational observability.
Architect Perspective
URL recordId is user input—server authorization on every read path mandatory in community.