[PR #6975] [PM-37255] feat: Consume fill-assist targeting rules from server config #93600

Open
opened 2026-05-27 12:50:51 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/bitwarden/android/pull/6975
Author: @aj-rosado
Created: 5/25/2026
Status: 🔄 Open

Base: mainHead: PM-37255/consume-fill-assist-rules-data


📝 Commits (2)

  • 7fcae79 Fetches, parses, and caches map-the-web data
  • 5fde287 Simplified sync on fill assist to match the vault sync

📊 Changes

33 files changed (+2127 additions, -0 deletions)

View changed files

📝 app/src/main/kotlin/com/x8bit/bitwarden/BitwardenApplication.kt (+4 -0)
app/src/main/kotlin/com/x8bit/bitwarden/data/autofill/datasource/disk/FillAssistDiskSource.kt (+44 -0)
app/src/main/kotlin/com/x8bit/bitwarden/data/autofill/datasource/disk/FillAssistDiskSourceImpl.kt (+72 -0)
app/src/main/kotlin/com/x8bit/bitwarden/data/autofill/di/FillAssistModule.kt (+57 -0)
app/src/main/kotlin/com/x8bit/bitwarden/data/autofill/manager/FillAssistManager.kt (+23 -0)
app/src/main/kotlin/com/x8bit/bitwarden/data/autofill/manager/FillAssistManagerImpl.kt (+226 -0)
app/src/main/kotlin/com/x8bit/bitwarden/data/autofill/model/FillAssistRules.kt (+47 -0)
📝 app/src/main/kotlin/com/x8bit/bitwarden/data/platform/datasource/network/di/PlatformNetworkModule.kt (+7 -0)
📝 app/src/main/kotlin/com/x8bit/bitwarden/data/vault/manager/VaultSyncManagerImpl.kt (+3 -0)
📝 app/src/main/kotlin/com/x8bit/bitwarden/data/vault/manager/di/VaultManagerModule.kt (+3 -0)
📝 app/src/test/kotlin/com/x8bit/bitwarden/data/auth/repository/AuthRepositoryTest.kt (+1 -0)
app/src/test/kotlin/com/x8bit/bitwarden/data/autofill/datasource/disk/FillAssistDiskSourceTest.kt (+135 -0)
app/src/test/kotlin/com/x8bit/bitwarden/data/autofill/manager/FillAssistManagerTest.kt (+685 -0)
📝 app/src/test/kotlin/com/x8bit/bitwarden/data/platform/datasource/sdk/ServerCommunicationConfigRepositoryTest.kt (+1 -0)
📝 app/src/test/kotlin/com/x8bit/bitwarden/data/platform/manager/FeatureFlagManagerTest.kt (+1 -0)
📝 app/src/test/kotlin/com/x8bit/bitwarden/data/platform/repository/util/FakeServerConfigRepository.kt (+1 -0)
📝 app/src/test/kotlin/com/x8bit/bitwarden/data/vault/manager/VaultSyncManagerTest.kt (+6 -0)
📝 authenticator/src/test/kotlin/com/bitwarden/authenticator/data/platform/manager/FeatureFlagManagerTest.kt (+1 -0)
📝 authenticator/src/test/kotlin/com/bitwarden/authenticator/data/platform/repository/util/FakeServerConfigRepository.kt (+1 -0)
📝 data/src/test/kotlin/com/bitwarden/data/datasource/disk/ConfigDiskSourceTest.kt (+1 -0)

...and 13 more files

📄 Description

🎟️ Tracking

https://bitwarden.atlassian.net/browse/PM-37255

📔 Objective

Implements the data pipeline for Fill-Assist Targeting Rules (Task 2 of 3).
This PR fetches, parses, and caches server-provided autofill field rules per
account environment. The rules are not yet applied to autofill (Task 3); this
PR establishes the infrastructure that Task 3 will consume.

What's included

Feature flag (fill-assist-targeting-rules):

  • Added to FlagKey, FeatureFlagListItems, and strings_non_localized.xml

Network layer (:network module):

  • FillAssistManifestJson and FillAssistFormsV1Json models
  • FillAssistService / FillAssistServiceImpl using createStaticRetrofit()
    to bypass BaseUrlInterceptor (the fill-assist CDN is external to the
    Bitwarden API base URL)
  • fillAssistRulesUrl added to ConfigResponseJson.EnvironmentJson

Data layer (:app module):

  • FillAssistRules domain model — CSS selectors parsed at sync time into
    SelectorClause(tag, id, name, type, role) for efficient matching at
    autofill time
  • FillAssistDiskSource — per-server SharedPreferences storage (keyed by the
    server's fill-assist CDN URL so multiple accounts on the same server share
    one cached copy)
  • FillAssistManager — self-managing singleton that syncs on app start,
    config refresh, and account switch. Uses a 6-hour timestamp throttle before
    checking the manifest CID, matching the browser implementation

Sync behaviour:

  • Timestamp check first (skip all network if < 6 hours since last fetch)
  • Manifest fetch to compare CID (skip forms download if unchanged)
  • Forms download and parse on CID change only
  • syncIfIdle() drop-if-busy pattern matches VaultSyncManagerImpl
  • CURRENT_CACHE_VERSION migration clears all cached rules on breaking parser
    changes

CSS parsing:

  • Compound selectors (input#id[name='x']) fully supported
  • Shadow DOM selectors (>>>) excluded (unreachable via Android autofill)
  • Forms from all pathnames pooled per host and merged by category (one
    HostRule per form category per host, deduplicating identical entries)
  • FileEntryJson.deprecated — logs a warning when the current schema version
    is marked end-of-life

Currently targets CURRENT_FORMS_VERSION = "v0" matching the prerelease
schema version of the map-the-web project.

Not in this PR

  • Applying rules in AutofillParserImpl
  • Opt-in user setting toggle

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/bitwarden/android/pull/6975 **Author:** [@aj-rosado](https://github.com/aj-rosado) **Created:** 5/25/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `PM-37255/consume-fill-assist-rules-data` --- ### 📝 Commits (2) - [`7fcae79`](https://github.com/bitwarden/android/commit/7fcae79136abf90d0a0d36dd08b64ccc118f4cda) Fetches, parses, and caches map-the-web data - [`5fde287`](https://github.com/bitwarden/android/commit/5fde28716a09c18a74c93e221c7fb54f9cb4d70c) Simplified sync on fill assist to match the vault sync ### 📊 Changes **33 files changed** (+2127 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `app/src/main/kotlin/com/x8bit/bitwarden/BitwardenApplication.kt` (+4 -0) ➕ `app/src/main/kotlin/com/x8bit/bitwarden/data/autofill/datasource/disk/FillAssistDiskSource.kt` (+44 -0) ➕ `app/src/main/kotlin/com/x8bit/bitwarden/data/autofill/datasource/disk/FillAssistDiskSourceImpl.kt` (+72 -0) ➕ `app/src/main/kotlin/com/x8bit/bitwarden/data/autofill/di/FillAssistModule.kt` (+57 -0) ➕ `app/src/main/kotlin/com/x8bit/bitwarden/data/autofill/manager/FillAssistManager.kt` (+23 -0) ➕ `app/src/main/kotlin/com/x8bit/bitwarden/data/autofill/manager/FillAssistManagerImpl.kt` (+226 -0) ➕ `app/src/main/kotlin/com/x8bit/bitwarden/data/autofill/model/FillAssistRules.kt` (+47 -0) 📝 `app/src/main/kotlin/com/x8bit/bitwarden/data/platform/datasource/network/di/PlatformNetworkModule.kt` (+7 -0) 📝 `app/src/main/kotlin/com/x8bit/bitwarden/data/vault/manager/VaultSyncManagerImpl.kt` (+3 -0) 📝 `app/src/main/kotlin/com/x8bit/bitwarden/data/vault/manager/di/VaultManagerModule.kt` (+3 -0) 📝 `app/src/test/kotlin/com/x8bit/bitwarden/data/auth/repository/AuthRepositoryTest.kt` (+1 -0) ➕ `app/src/test/kotlin/com/x8bit/bitwarden/data/autofill/datasource/disk/FillAssistDiskSourceTest.kt` (+135 -0) ➕ `app/src/test/kotlin/com/x8bit/bitwarden/data/autofill/manager/FillAssistManagerTest.kt` (+685 -0) 📝 `app/src/test/kotlin/com/x8bit/bitwarden/data/platform/datasource/sdk/ServerCommunicationConfigRepositoryTest.kt` (+1 -0) 📝 `app/src/test/kotlin/com/x8bit/bitwarden/data/platform/manager/FeatureFlagManagerTest.kt` (+1 -0) 📝 `app/src/test/kotlin/com/x8bit/bitwarden/data/platform/repository/util/FakeServerConfigRepository.kt` (+1 -0) 📝 `app/src/test/kotlin/com/x8bit/bitwarden/data/vault/manager/VaultSyncManagerTest.kt` (+6 -0) 📝 `authenticator/src/test/kotlin/com/bitwarden/authenticator/data/platform/manager/FeatureFlagManagerTest.kt` (+1 -0) 📝 `authenticator/src/test/kotlin/com/bitwarden/authenticator/data/platform/repository/util/FakeServerConfigRepository.kt` (+1 -0) 📝 `data/src/test/kotlin/com/bitwarden/data/datasource/disk/ConfigDiskSourceTest.kt` (+1 -0) _...and 13 more files_ </details> ### 📄 Description ## 🎟️ Tracking https://bitwarden.atlassian.net/browse/PM-37255 ## 📔 Objective Implements the data pipeline for Fill-Assist Targeting Rules (Task 2 of 3). This PR fetches, parses, and caches server-provided autofill field rules per account environment. The rules are not yet applied to autofill (Task 3); this PR establishes the infrastructure that Task 3 will consume. ### What's included **Feature flag** (`fill-assist-targeting-rules`): - Added to `FlagKey`, `FeatureFlagListItems`, and `strings_non_localized.xml` **Network layer (`:network` module)**: - `FillAssistManifestJson` and `FillAssistFormsV1Json` models - `FillAssistService` / `FillAssistServiceImpl` using `createStaticRetrofit()` to bypass `BaseUrlInterceptor` (the fill-assist CDN is external to the Bitwarden API base URL) - `fillAssistRulesUrl` added to `ConfigResponseJson.EnvironmentJson` **Data layer (`:app` module)**: - `FillAssistRules` domain model — CSS selectors parsed at sync time into `SelectorClause(tag, id, name, type, role)` for efficient matching at autofill time - `FillAssistDiskSource` — per-server SharedPreferences storage (keyed by the server's fill-assist CDN URL so multiple accounts on the same server share one cached copy) - `FillAssistManager` — self-managing singleton that syncs on app start, config refresh, and account switch. Uses a 6-hour timestamp throttle before checking the manifest CID, matching the browser implementation **Sync behaviour**: - Timestamp check first (skip all network if < 6 hours since last fetch) - Manifest fetch to compare CID (skip forms download if unchanged) - Forms download and parse on CID change only - `syncIfIdle()` drop-if-busy pattern matches `VaultSyncManagerImpl` - `CURRENT_CACHE_VERSION` migration clears all cached rules on breaking parser changes **CSS parsing**: - Compound selectors (`input#id[name='x']`) fully supported - Shadow DOM selectors (`>>>`) excluded (unreachable via Android autofill) - Forms from all pathnames pooled per host and merged by category (one `HostRule` per form category per host, deduplicating identical entries) - `FileEntryJson.deprecated` — logs a warning when the current schema version is marked end-of-life Currently targets `CURRENT_FORMS_VERSION = "v0"` matching the prerelease schema version of the map-the-web project. ### Not in this PR - Applying rules in `AutofillParserImpl` - Opt-in user setting toggle --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-05-27 12:50:51 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/android#93600