[PR #1254] [MERGED] Fix autofill on Chrome from the iOS Share Extension #2809

Closed
opened 2025-11-26 23:24:23 -06:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/bitwarden/android/pull/1254
Author: @eliykat
Created: 2/8/2021
Status: Merged
Merged: 2/11/2021
Merged by: @eliykat

Base: masterHead: ios-share-no-matching-sites


📝 Commits (2)

  • 7ecb0e5 Process UTTypeURL data received from host app
  • fb7cb76 Disable autofill via Share extension for Chrome

📊 Changes

3 files changed (+4 additions, -1 deletions)

View changed files

📝 src/iOS.Core/Constants.cs (+1 -0)
📝 src/iOS.Extension/LoadingViewController.cs (+1 -0)
📝 src/iOS.Extension/LoginListViewController.cs (+2 -1)

📄 Description

Objective

Fix #1035 - when using Chrome, the iOS Share Extension would not find any matching sites and would not autofill.

Code Changes

As discussed, Chrome does not support our extension.js script required for autofill operations. This also meant that the URL was being passed to the extension using an unexpected data type.

We discussed allowing the user to copy/paste their login info instead of autofilling. There is actually already code there to do that! However, my guess is that Chrome changed the UTType it was using to send the URL information to the extension, which meant the app wasn't catching the URL info and wasn't activating the copy/paste options.

With that in mind, the changes are actually very minor to get this to work properly:

  • Constants.cs - add the identifier for the URL type, i.e. public.url
  • LoadingViewController.cs - add the URL type for processing when the extension loads, so that the URL information is picked up
  • LoginListViewController.cs - add the URL type to the conditions that will trigger copy/paste instead of autofill.

This fix assumes that any browser that uses the URL type to communicate with the extension suffers from this issue. I did a quick test with Brave (as another Chromium based browser), and it uses a different data type and auto-fills correctly. The risk here would be that we accidentally disable autofill on other browsers that don't actually experience this bug.

Testing considerations

This change affects Bitwarden's behaviour from the share extension. i.e. open a browser, navigate to a login form, click the iOS share button, and select Bitwarden as the app to share to.

Expected behaviour:

  • When sharing from all browsers, Bitwarden should load a list of matching logins for that URL.
  • When sharing from Chrome only, Bitwarden should allow the user to copy the username, password and TOTP. This is done by clicking the login item and then selecting the information to copy from the menu. It should not autofill.
  • When sharing from any other browser, Bitwarden should allow the user to autofill by clicking the login item.

Please test on a couple of major browsers, especially Chromium-based browsers, to make sure that autofilling is only disabled on browsers that suffer from this issue (which is only Chrome, to my knowledge).


🔄 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/1254 **Author:** [@eliykat](https://github.com/eliykat) **Created:** 2/8/2021 **Status:** ✅ Merged **Merged:** 2/11/2021 **Merged by:** [@eliykat](https://github.com/eliykat) **Base:** `master` ← **Head:** `ios-share-no-matching-sites` --- ### 📝 Commits (2) - [`7ecb0e5`](https://github.com/bitwarden/android/commit/7ecb0e5f9db4a20897781a083bd64a3c57c5d8ce) Process UTTypeURL data received from host app - [`fb7cb76`](https://github.com/bitwarden/android/commit/fb7cb76a3927aae4d82eb0a77d1610036de4eaff) Disable autofill via Share extension for Chrome ### 📊 Changes **3 files changed** (+4 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `src/iOS.Core/Constants.cs` (+1 -0) 📝 `src/iOS.Extension/LoadingViewController.cs` (+1 -0) 📝 `src/iOS.Extension/LoginListViewController.cs` (+2 -1) </details> ### 📄 Description ## Objective Fix #1035 - when using Chrome, the iOS Share Extension would not find any matching sites and would not autofill. ## Code Changes As discussed, Chrome does not support our `extension.js` script required for autofill operations. This also meant that the URL was being passed to the extension using an unexpected data type. We discussed allowing the user to copy/paste their login info instead of autofilling. There is actually already code there to do that! However, my guess is that Chrome changed the `UTType` it was using to send the URL information to the extension, which meant the app wasn't catching the URL info and wasn't activating the copy/paste options. With that in mind, the changes are actually very minor to get this to work properly: * `Constants.cs` - add the identifier for the [URL type](https://developer.apple.com/documentation/uniformtypeidentifiers/uttype/3551585-url), i.e. `public.url` * `LoadingViewController.cs` - add the URL type for processing when the extension loads, so that the URL information is picked up * `LoginListViewController.cs` - add the URL type to the conditions that will trigger copy/paste instead of autofill. This fix assumes that any browser that uses the URL type to communicate with the extension suffers from this issue. I did a quick test with Brave (as another Chromium based browser), and it uses a different data type and auto-fills correctly. The risk here would be that we accidentally disable autofill on other browsers that don't actually experience this bug. ## Testing considerations This change affects Bitwarden's behaviour from the share extension. i.e. open a browser, navigate to a login form, click the iOS share button, and select Bitwarden as the app to share to. Expected behaviour: * When sharing from all browsers, Bitwarden should load a list of matching logins for that URL. * When sharing from Chrome only, Bitwarden should allow the user to copy the username, password and TOTP. This is done by clicking the login item and then selecting the information to copy from the menu. It should not autofill. * When sharing from any other browser, Bitwarden should allow the user to autofill by clicking the login item. Please test on a couple of major browsers, especially Chromium-based browsers, to make sure that autofilling is only disabled on browsers that suffer from this issue (which is only Chrome, to my knowledge). --- <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 2025-11-26 23:24:23 -06:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/android#2809