FAQ-001482 - Permission Set Security / Permission Set Design and Best Practices

Current Status:VALID_RESPONSEErrorUnable to AnswerSuggests Case

Current FAQ

Question
How do I determine the minimum required permissions for my application to function correctly?
Answer
To determine the minimum required permissions for your application, ensure it requests only the least privilege permissions necessary for its use case. The permissions should align with the specific actions the application needs to perform, as described on the installation screen. Avoid requesting permissions beyond what is required for the app's stated functionality to maintain security and prevent unauthorized actions. To determine appropriate permission sets and security permissions for your managed package: align permissions with the specific functionality and access requirements of the package, use `Schema.sObjectType` to verify field accessibility before performing DML operations, even in USER_MODE, review and define sharing configurations, user permission sets, and access controls within the managed package, and audit changes to access control and ensure only users with specific permissions can execute sensitive functions.
Enhancing FAQ...

Enhancing FAQ with AI recommendations...

AI Recommended Enhancement

Related Security Rules (click to view)
ApexCRUDViolationApexSharingViolations
Question
How do I determine the minimum required permissions for my application to function correctly?
Recommended Answer Update
To determine the minimum required permissions for your application, ensure it requests only the least privilege permissions necessary for its use case. The permissions should align with the specific actions the application needs to perform, as described on the installation screen. Avoid requesting permissions beyond what is required for the app's stated functionality to maintain security and prevent unauthorized actions. To determine appropriate permission sets and security permissions for your managed package: align permissions with the specific functionality and access requirements of the package, use `WITH USER_MODE` in SOQL queries and `AccessLevel.USER_MODE` in Database methods to automatically enforce field accessibility and object permissions, review and define sharing configurations, user permission sets, and access controls within the managed package, and audit changes to access control and ensure only users with specific permissions can execute sensitive functions.
Reasoning
The main improvement needed is updating the outdated security enforcement approach. The original answer recommends using `Schema.sObjectType` to verify field accessibility before performing DML operations, even in USER_MODE. This is an outdated approach that's been superseded by modern Salesforce features. According to the security approaches guidelines, we should prioritize modern features like `WITH USER_MODE` for SOQL queries and `AccessLevel.USER_MODE` for Database methods, which automatically enforce permissions while requiring less code. I've updated this specific point while preserving all other content and structure. The ApexCRUDViolation rule relates directly to this FAQ because it detects when Apex code performs CRUD operations without proper permission checks - which is exactly what this FAQ is teaching developers to avoid by implementing proper permission verification. The ApexSharingViolations rule is relevant because the FAQ discusses reviewing sharing configurations and access controls, which directly relates to this rule's purpose of detecting sharing violations in Apex code.
Reasoning References
Recommended Related Articles