Skip to content

Harden Android backup and FileProvider guard tests #1739

Backlog

Description

@smart-ssh-planner

Goal

The Android guard tests fail when a backup exclusion is only commented out, and when a re-added FileProvider shares a whole directory in any spelling.

Context

Follow-up of #1716 (PR #1731): the review found that the guard tests are plain substring searches.

  • crates/persistence-sqlite/src/paths.rs:689 (test_android_manifest_excludes_app_data_from_backup) uses contains on the manifest and on data_extraction_rules.xml. A commented-out <!-- android:allowBackup="false" --> next to allowBackup="true" still passes, and so does a commented-out <exclude domain="…"/>.
  • crates/persistence-sqlite/src/paths.rs:723 (test_android_file_provider_paths_are_narrow) only rejects the literal strings external- and path=".". A path file with <root-path path="/" />, <cache-path path="" /> or <files-path path="./" /> still passes. The provider is currently removed, so this only matters if one is re-added.

Requirements

  • Strip XML comments from the manifest and the rules file before the assertions in the backup test.
  • In the FileProvider test, also reject root-path elements and path values that are empty, ., ./ or /.
  • Keep all existing assertions; do not loosen any.

Acceptance Criteria

  • With <!-- android:allowBackup="false" --> and an active android:allowBackup="true", the backup test fails.
  • With an <exclude domain="sharedpref"/> only inside a comment in <cloud-backup>, the backup test fails.
  • A file_paths.xml containing <root-path path="/" />, <cache-path path="" /> or <files-path path="./" /> makes the FileProvider test fail (checked with a temporary provider reference; each counter-proof restored afterwards).
  • The current manifest and rules file still pass.
  • Relevant automated tests pass (cargo test -p persistence-sqlite android)

Technical Notes

Test-only change in crates/persistence-sqlite/src/paths.rs. Comment stripping can be a small helper in the test module; no new dependency is needed.

Files: crates/persistence-sqlite/src/paths.rs

Spec impact: none

Open questions

  • Check a merged manifest or plugin library manifests for a provider? Recommendation: no. It needs a Gradle build, which does not belong in a unit test, and nothing in the used plugins declares one today.
  • Exclude the device_* domains in data_extraction_rules.xml? Recommendation: no. Nothing writes to device-protected storage (rg finds no createDeviceProtectedStorageContext/directBootAware).

Related Work

Activity

  1. added
    tests
    follow-up
    on Dec 4, 2026
  2. smart-ssh-coder commented on Dec 4, 2026

    @smart-ssh-coder
    Contributor

    Needs maintainer: The issue waits for #1733, but "blocked by" could not be set. Set it on the issue (Relationships), then remove needs-maintainer: The tests this issue hardens (test_android_manifest_excludes_app_data_from_backup, test_android_file_provider_paths_are_narrow in crates/persistence-sqlite/src/paths.rs) and the Android manifest/rules files exist only on release/0.8.0, not on develop. They reach develop through the open back-merge PR #1733; nothing to attach the change to until then.

  3. added
    needs-maintainer
    question-triage
    and removed
    question-triage
    needs-maintainer
    on Dec 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    follow-uptests

    Type

    Fields

    Priority

    P3 - Low

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions