FAQ-001018 - Flow Security and System Mode / Custom Flow Actions Security

Current Status:VALID_RESPONSEErrorUnable to AnswerSuggests Case

Current FAQ

Question
How should Field-Level Security be handled in custom flow actions that run in different contexts?
Answer
Field-Level Security (FLS) in custom flow actions should be handled by: 1. **Explicit FLS Checks**: Ensure users have the necessary permissions to access or modify specific fields by implementing explicit FLS checks. 2. **Aligning Context**: Design custom flow actions to align with the flow execution context, considering security requirements. 3. **Verifying Permissions**: Always verify CRUD and FLS permissions for all fields and objects involved in the action. 4. **Using User Mode**: Where applicable, use "user mode" to dynamically enforce FLS checks based on the logged-in user's permissions. These practices ensure secure and compliant handling of FLS in custom flow actions across different contexts.
Enhancing FAQ...

Enhancing FAQ with AI recommendations...

AI Recommended Enhancement

Related Security Rules (click to view)
ApexCRUDViolationPreventPassingUserDataIntoElementWithoutSharingPreventPassingUserDataIntoElementWithSharing
Question
How should Field-Level Security be handled in custom flow actions that run in different contexts?
Recommended Answer Update
Field-Level Security (FLS) in custom flow actions should be handled by: 1. **Explicit FLS Checks**: Ensure users have the necessary permissions to access or modify specific fields by implementing explicit FLS checks or using WITH USER_MODE in SOQL queries and AccessLevel.USER_MODE for Database methods. 2. **Aligning Context**: Design custom flow actions to align with the flow execution context, considering security requirements. 3. **Verifying Permissions**: Always verify CRUD and FLS permissions for all fields and objects involved in the action. 4. **Using User Mode**: Where applicable, use "user mode" to dynamically enforce FLS checks based on the logged-in user's permissions. These practices ensure secure and compliant handling of FLS in custom flow actions across different contexts.
Reasoning
The recommendations improve the FAQ by modernizing the security approach guidance. In point 1, I refined the wording to be more specific by mentioning the modern approaches (WITH USER_MODE for SOQL queries and AccessLevel.USER_MODE for Database methods) alongside the existing explicit FLS checks recommendation, following the FAQ review guidelines that prioritize modern features while maintaining that traditional approaches remain valid. This clarification makes the guidance more actionable for developers while preserving all original points. For the security rules selected: ApexCRUDViolation relates to the FAQ's emphasis on 'verify CRUD and FLS permissions for all fields and objects involved in the action' and 'explicit FLS checks' - this rule detects when Apex code performs data operations without proper permission validation. PreventPassingUserDataIntoElementWithoutSharing relates to the FAQ's discussion of 'design custom flow actions to align with the flow execution context, considering security requirements' and 'different contexts' - this rule specifically addresses security concerns when user data flows into elements that run without sharing. PreventPassingUserDataIntoElementWithSharing also relates to the flow context alignment guidance and helps developers understand security implications across different flow execution contexts mentioned in the FAQ.
Reasoning References
Recommended Related Articles