There are conflicting guidelines regarding batch Apex classes invoked from PostInstall classes:
**Permissive View**: Yes, batch Apex classes invoked from PostInstall classes are allowed to use "without sharing" if there is a legitimate use case and no security impact. However, it is important to carefully evaluate the necessity of using "without sharing" and ensure proper security measures, such as CRUD/FLS checks, are implemented where applicable.
**Restrictive View**: It is not acceptable for a batch Apex class initiated from a PostInstall script to run `without sharing`. All classes performing database operations should explicitly enforce sharing rules by being marked as `with sharing`, unless there is a clear and documented exception (e.g., for community or site applications requiring `without sharing`).
**Technical Consideration**: Using `with sharing` on a `Database.Batchable` class prevents it from being created by an install handler because install handlers execute with elevated privileges and do not enforce sharing rules. These elevated privileges are necessary to ensure the installation process completes without being restricted by sharing settings.
**Recommendation**: Given the conflicting guidance, it's best to document your specific use case and consult with Salesforce Support or security review guidelines for your particular scenario.