Skip to content
This repository has been archived by the owner on May 10, 2024. It is now read-only.

Improve LoginsHelper to solve iFrame and Cross-Site-Scripting problem #4113

Closed
soner-yuksel opened this issue Aug 31, 2021 · 1 comment · Fixed by #4124
Closed

Improve LoginsHelper to solve iFrame and Cross-Site-Scripting problem #4113

soner-yuksel opened this issue Aug 31, 2021 · 1 comment · Fixed by #4124

Comments

@soner-yuksel
Copy link
Member

Problem Description

Actual LoginsHelper script that enables us to save and auto-fill login information needs a refinement so it will enable us to save and auto-fill login information properly on some sites.

For the improvements in the login script changes have to be made towards supporting login suggestions where window can be iframe.contentWindow and injecting into iFrame will be needed, in addition XSS (Cross-Site-Scripting) problem should be solved so it will inject autofill credentials.

Implementation Details

First problems are websites like facebook uses form only for CSS styling. So It never calls form.submit it has no input type=submit or button type=submit. It’s all done through a socket.In this case it is better to just check in our LoginHelper.swift if the URL of the tab changed and then do suggestion to add to login suggest after.

Second problem is related with iFrame + Cross-Site-Scripting. Right now we can’t autofill on reddit because it injects into window. But it doesn’t consider that the window can be iframe.contentWindow and so it ignores injecting into iFrame.

Then it has XSS (Cross-Site-Scripting) problem where it won’t inject autofill credentials into any page that doesn’t have login on wkMessage.frameInfo.isMainFrame

QA test plan

  1. Try login to facebook and save login (m.facebook.com) and check If password and username field is filled.
  2. Try login to reddit and save login and check if username field is filled.
@soner-yuksel soner-yuksel added this to the 1.32 milestone Aug 31, 2021
@iccub iccub modified the milestones: 1.32, 1.33 Sep 1, 2021
@iccub iccub modified the milestones: 1.33-old, 1.32.5 Oct 17, 2021
iccub pushed a commit that referenced this issue Oct 26, 2021
… logic (#4124)

Co-authored-by: Brandon T <JustBrandonT@gmail.com>
@iccub iccub modified the milestones: 1.32.5, 1.33 Dec 1, 2021
@kjozwiak
Copy link
Member

kjozwiak commented Dec 9, 2021

Went through the following STR/Cases on the various devices/iOS versions mentioned below:

Test Case #1 - Reddit

  • ensure that you can login into reddit without any issues
  • once logged in, click on the Save Login on the modal that Brave displays
  • logout and ensure that the username is filled in but not the password via the login screen

Also ensured that 1Password can be used to fill both username & password and login without any issues

Test Case #1 - FB

  • ensure that you can login into reddit without any issues
  • once logged in, click on the Save Login on the modal that Brave displays
  • logout and ensure that the both the username & password are automatically auto-filled

Also ensured that 1Password can be used to fill both username & password and login without any issues

Devices/iOS versions used during verification:

  • Verification PASSED on iPhone 12 running iOS 15.1.1 using 1.33 (21.12.8.23)
  • Verification PASSED on iPhone 6+ running iOS 14.6 using 1.33 (21.12.8.23)
  • Verification PASSED on iPad Air (3rd Gen) running iOS 15.1 using 1.33 (21.12.8.23)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.