Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Android] Localhost permission #29730

Closed
ShivanKaul opened this issue Apr 14, 2023 · 2 comments · Fixed by brave/brave-core#18222
Closed

[Android] Localhost permission #29730

ShivanKaul opened this issue Apr 14, 2023 · 2 comments · Fixed by brave/brave-core#18222
Assignees
Labels
Android 8 - Test/Verification Checking on an older Android device to make sure everything is working as expected OS/Android Fixes related to Android browser functionality priority/P3 The next thing for us to work on. It'll ride the trains. privacy/localhost-permission privacy/permissions privacy features related to limiting, lifetime or other permissions QA Pass - Android ARM QA Pass - Android Tab QA/Test-All-Platforms QA/Yes release-notes/include

Comments

@ShivanKaul
Copy link
Collaborator

Android port of #27346

When feature is on:

  1. Prompt users for localhost permission when visiting websites that make connections to localhost subresources.
  2. Have an entry for Localhost in Site Settings in Settings. Adding/subtracting exceptions should work.
@ShivanKaul ShivanKaul added OS/Android Fixes related to Android browser functionality privacy/permissions privacy features related to limiting, lifetime or other permissions labels Apr 14, 2023
@ShivanKaul ShivanKaul self-assigned this Apr 14, 2023
@ShivanKaul ShivanKaul added QA/Yes release-notes/include priority/P3 The next thing for us to work on. It'll ride the trains. labels Apr 25, 2023
@brave-builds brave-builds added this to the 1.52.x - Nightly milestone Apr 26, 2023
@kjozwiak kjozwiak added QA/Test-All-Platforms Android 8 - Test/Verification Checking on an older Android device to make sure everything is working as expected labels May 10, 2023
@Uni-verse Uni-verse added the QA/In-Progress Indicates that QA is currently in progress for that particular issue label May 25, 2023
@Uni-verse
Copy link
Contributor

Uni-verse commented May 25, 2023

Verified on Samsung Galaxy S21 using the following version(s):

Brave	1.52.112 Chromium: 114.0.5735.35 (Official Build) (64-bit) 
Revision	2295354895fa3652ae47b651481831484f16d1ff-refs/branch-heads/5735@{#713}
OS	Android 13; Build/TP1A.220624.014; 33; REL

Android Localhost permission testing prerequisites:

  1. Install Simple HTTP server (by Phlox Development) from GPS on Android device.
  2. Launch the app, allow necessary app permissions and start the server with default values. Confirm status is running.
  3. Launch Brave app, open new tab and navigate to http://localhost:8000 in the url bar, confirm you are able to access localhost server.
  4. Open terminal window and make sure device is connected via adb. Confirm app data folder location for simple http server by using the following command: adb shell ls /storage/emulated/0/Android/data/com.phlox.simpleserver/files
  5. If simple http server is not found in this path, locate it in the device storage by searching in directories in /storage
  6. Download logo.png in the below images and cd into the directory containing the downloaded image. Use this adb command to push the png to the http server root directory in the android device: adb push ./logo.png /storage/emulated/0/Android/data/com.phlox.simpleserver/files/logo.png
  7. Update the tab where localhost is running in brave app and it should now show the logo.png in the root directory. Tap on the file in the list to open the logo image.
  8. Enable the feature flag #brave-localhost-access-permission in brave://flags, relaunch app
  9. Navigate to brave://adblock and enter this rule in the custom ad block field ||localhost^$domain=shivankaul.com
Step 1 Step 2 Step 3 Step 7 Step 7 Logo.png
step1 step2 step3 logo.png step7 step7

Note: Make sure to complete the steps above before moving on to test scenarios in https://shivankaul.com/brave/localhost/ in the test plan mentions below. When running through the test cases, make sure your http server port value / resource name corresponds to the localhost uri parameters in the page source for the tests in https://shivankaul.com/brave/localhost/ (example below).

Screenshot 2023-05-26 at 12 09 52 PM

Using test plan in brave/brave-core#17321 (comment)

  • Ensured loading subresource image test page will prompt user with permission dialog,
  • Ensured loading server worker test page will prompt user with permission dialog.
  • Ensured loading websockets test page will prompt user with permission dialog.
  • Ensured loading iframe test page will prompt user with permission dialog.
  • Ensured that allowing localhost permission on test pages will load the resource.
  • Ensured selecting localhost permission will set the appropriate exception for the domain under localhost in site settings.
  • Ensured changing exception from allow to block or vice versa will be applied on the test page.
  • Ensured manually enter exception site under site settings works.
Example Example Example Example Example Example
screenshot-1685033633798 screenshot-1685045733208 screenshot-1685045744692 screenshot-1685045754443 screenshot-1685047308430 screenshot-1685047340297

@Uni-verse
Copy link
Contributor

Uni-verse commented May 26, 2023

Verified on Samsung Galaxy Tab S7 using the following version(s):

Brave	1.52.112 Chromium: 114.0.5735.35 (Official Build) (64-bit) 
Revision	2295354895fa3652ae47b651481831484f16d1ff-refs/branch-heads/5735@{#713}
OS	Android 13; Build/TP1A.220624.014; 33; REL

Using test plan in brave/brave-core#17321 (comment)

  • Ensured loading subresource image test page will prompt user with permission dialog,
  • Ensured loading server worker test page will prompt user with permission dialog.
  • Ensured loading websockets test page will prompt user with permission dialog.
  • Ensured loading iframe test page will prompt user with permission dialog.
  • Ensured that allowing localhost permission on test pages will load the resource.
  • Ensured selecting localhost permission will set the appropriate exception for the domain under localhost in site settings.
  • Ensured changing exception from allow to block or vice versa will be applied on the test page.
  • Ensured manually enter exception site under site settings works.
Example Example Example Example Example
screenshot-1685118529982 screenshot-1685118541415 screenshot-1685118561549 screenshot-1685118574041 screenshot-1685118593043
screenshot-1685118610866 screenshot-1685118661683 screenshot-1685118684412 screenshot-1685118945514 screenshot-1685119051390

@Uni-verse Uni-verse added QA Pass - Android Tab and removed QA/In-Progress Indicates that QA is currently in progress for that particular issue labels May 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Android 8 - Test/Verification Checking on an older Android device to make sure everything is working as expected OS/Android Fixes related to Android browser functionality priority/P3 The next thing for us to work on. It'll ride the trains. privacy/localhost-permission privacy/permissions privacy features related to limiting, lifetime or other permissions QA Pass - Android ARM QA Pass - Android Tab QA/Test-All-Platforms QA/Yes release-notes/include
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants