Mitigation Strategy: Rigorous Permission Request Justification and Review (PermissionsDispatcher-Specific)
-
Description:
- Documentation: For each permission requested using
@NeedsPermission
, developers must create a justification document. - Justification Content: The document must include:
- Necessity: Why the permission is essential for the feature.
- Data Access: What specific data is accessed.
- Data Usage: How the accessed data is used.
- Data Protection: How the accessed data is protected.
- Denial Handling: What happens if the permission is denied.
- Code Review Process:
- Mandatory Check: Reviewers must verify the justification document for every
@NeedsPermission
. - Alignment Verification: Reviewers must ensure code uses the permission as described.
- Challenge Requests: Reviewers should challenge any seemingly excessive requests.
- Annotation Check: Verify correct usage of all PermissionsDispatcher annotations:
@NeedsPermission
,@OnShowRationale
,@OnPermissionDenied
, and@OnNeverAskAgain
. This is crucial for ensuring the library is used as intended.
- Mandatory Check: Reviewers must verify the justification document for every
- Documentation: For each permission requested using
-
Threats Mitigated:
- Over-Granting of Permissions (Principle of Least Privilege Violation): Severity: High. Directly addresses this by forcing justification of every
@NeedsPermission
. - Data Exposure: Severity: High. By linking data access/usage to
@NeedsPermission
, it prevents misuse. - Incorrect Annotation Usage: Severity: Medium. The annotation check ensures PermissionsDispatcher is used correctly, preventing logic errors.
- Over-Granting of Permissions (Principle of Least Privilege Violation): Severity: High. Directly addresses this by forcing justification of every
-
Impact:
- Over-Granting of Permissions: Significantly reduces risk by requiring justification for each
@NeedsPermission
. - Data Exposure: Reduces risk by ensuring transparency tied directly to PermissionsDispatcher usage.
- Incorrect Annotation Usage: Prevents errors arising from misusing PermissionsDispatcher's core functionality.
- Over-Granting of Permissions: Significantly reduces risk by requiring justification for each
-
Currently Implemented:
- Partially. Justification documents are required for new features, but a retrospective review is needed. Code reviews include a permission check, but the annotation check needs to be more rigorous.
-
Missing Implementation:
- Comprehensive review of all existing
@NeedsPermission
annotations. - Formal training on creating justifications and using PermissionsDispatcher annotations correctly.
- Update code review checklist to explicitly include verification of all relevant annotations.
- Comprehensive review of all existing
Mitigation Strategy: Graceful Degradation and Comprehensive Denial Handling (PermissionsDispatcher-Specific)
-
Description:
@OnPermissionDenied
Implementation:- User-Friendly Messages:
@OnPermissionDenied
methods must provide clear explanations. - Alternative Functionality: Offer alternatives if possible, without the denied permission.
- No Crashes or Freezes: The app must never crash due to a denial.
- No Sensitive Data Leakage: Error messages must not leak information.
- No Bypassing: Code must not try to circumvent the denial handled by PermissionsDispatcher.
- User-Friendly Messages:
@OnNeverAskAgain
Implementation:- Settings Guidance:
@OnNeverAskAgain
methods must guide users to re-enable permissions in settings. - Avoid Nagging: Do not repeatedly prompt after "Never Ask Again."
- Settings Guidance:
- Testing (PermissionsDispatcher-Focused):
- Denial Simulation: Create UI/integration tests simulating all denial scenarios handled by PermissionsDispatcher (both "Deny" and "Never Ask Again").
- All Flows Tested: Test all code paths affected by PermissionsDispatcher's denial handling.
-
Threats Mitigated:
- Poor User Experience: Severity: Medium. Directly addresses user experience when PermissionsDispatcher denies a request.
- Application Instability: Severity: High. Prevents crashes caused by unhandled denials within PermissionsDispatcher's generated code.
- Information Disclosure: Severity: Medium. Prevents leaks through error messages in
@OnPermissionDenied
. - Incorrect
OnNeverAskAgain
Handling: Severity: Medium. Ensures correct behavior when the user permanently denies a permission.
-
Impact:
- Poor User Experience: Improves experience by providing clear explanations within PermissionsDispatcher's flow.
- Application Instability: Eliminates crashes related to PermissionsDispatcher's denial handling.
- Information Disclosure: Reduces leaks within
@OnPermissionDenied
methods. - Incorrect
OnNeverAskAgain
Handling: Ensures correct and respectful handling of permanent denials.
-
Currently Implemented:
- Partially.
@OnPermissionDenied
methods exist, but consistency needs improvement.@OnNeverAskAgain
handling is inconsistent. Basic denial testing exists, but not comprehensive for all PermissionsDispatcher scenarios.
- Partially.
-
Missing Implementation:
- Review and refactor all
@OnPermissionDenied
and@OnNeverAskAgain
methods. - Comprehensive automated tests covering all PermissionsDispatcher denial scenarios.
- Implement alternative functionality where feasible.
- Review and refactor all
Mitigation Strategy: Clear and Concise Rationales (PermissionsDispatcher-Specific)
-
Description:
@OnShowRationale
Content:- Plain Language: Rationales (in
@OnShowRationale
) must be clear and non-technical. - Honest and Accurate: Accurately explain why the permission is needed.
- Specific to the Feature: Tailor the rationale to the feature using the permission.
- User-Centric: Focus on user benefits.
- No Manipulation: Avoid coercive language.
- Plain Language: Rationales (in
- Review Process:
- Rationale Text Review: Code reviews must check the rationale text in
@OnShowRationale
. - User Perspective: Evaluate from a non-technical user's viewpoint.
- Rationale Text Review: Code reviews must check the rationale text in
- Testing (PermissionsDispatcher-Focused):
- UI Testing: Verify the rationale (from
@OnShowRationale
) is displayed correctly and is interactive.
- UI Testing: Verify the rationale (from
-
Threats Mitigated:
- User Mistrust: Severity: Medium. Builds trust through transparent explanations within PermissionsDispatcher's rationale flow.
- Low Permission Grant Rate: Severity: Medium. Improves grant rates by making the request understandable.
- Incorrect Rationale Handling: Severity: Medium. Ensures the
@OnShowRationale
method functions as intended.
-
Impact:
- User Mistrust: Reduces mistrust by providing clear explanations via
@OnShowRationale
. - Low Permission Grant Rate: Improves grant rates by making the request clearer.
- Incorrect Rationale Handling: Prevents issues with the rationale presentation managed by PermissionsDispatcher.
- User Mistrust: Reduces mistrust by providing clear explanations via
-
Currently Implemented:
- Partially.
@OnShowRationale
methods are used, but rationale quality varies.
- Partially.
-
Missing Implementation:
- Review and refactor all
@OnShowRationale
methods. - Establish guidelines for writing effective rationales.
- Expand UI testing of rationale presentation (specifically testing PermissionsDispatcher's output).
- Review and refactor all