Only prompt to save logins if a field in a login form was modified (off-by-default)
Categories
(Toolkit :: Password Manager, defect, P2)
Tracking
()
People
(Reporter: jukka.lindgren, Assigned: sfoster)
References
(Depends on 1 open bug, Blocks 3 open bugs, Regressed 1 open bug)
Details
(Keywords: perf-alert, Whiteboard: [passwords:heuristics])
User Story
Preference: signon.userInputRequiredToCapture.enabled * Use a one-time `input` event listener on the detected un/pw fields to update `fieldModified` below. Check isTrusted. * Ensure that an autofill by Firefox doesn't count as a user modification. * Check event.isTrusted * Since LoginManagerContent._getFormFields can return different field depending on whether we're submitting (`isSubmission`), check if the event listener was added to the field upon submission and if it wasn't tracked then prompt anyways (see `trackedFields` below). ```js stateForDocument(doc).fieldModificationsByRootElement.set(formLike.rootElement, { fieldModified: false, // true if one of the tracked fields was modified trackedFields: new WeakSet(), }); ```
Attachments
(8 files, 4 obsolete files)
47 bytes,
text/x-phabricator-request
|
Details | Review | |
317 bytes,
text/html
|
Details | |
11.37 KB,
text/plain
|
Details | |
6.94 KB,
text/plain
|
Details | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
10.78 KB,
text/plain
|
Details | |
678 bytes,
text/html
|
Details |
Comment 1•8 years ago
|
||
Reporter | ||
Comment 2•8 years ago
|
||
Comment 3•8 years ago
|
||
Reporter | ||
Comment 4•8 years ago
|
||
Comment 5•8 years ago
|
||
Updated•7 years ago
|
Updated•6 years ago
|
Updated•6 years ago
|
Updated•6 years ago
|
Updated•6 years ago
|
Updated•6 years ago
|
Comment 6•6 years ago
|
||
Only prompt to save logins if a login field was modified by the user.
Updated•6 years ago
|
Comment 7•6 years ago
|
||
Comment 8•6 years ago
|
||
Another test case is attachment 9063653 [details] from bug 1298952 which this bug will probably address.
Updated•6 years ago
|
Comment 10•6 years ago
|
||
Updated•6 years ago
|
Updated•6 years ago
|
Updated•6 years ago
|
Assignee | ||
Updated•6 years ago
|
Assignee | ||
Comment 13•6 years ago
|
||
- Lots of tests updated to use setUserInput so we get the input event, so the message is sent to the parent to create the doorhanger
- TODO: perhaps the observer.handleEvent input handling could be consolidated with these new input handlers?
Assignee | ||
Comment 14•6 years ago
|
||
I've run all the tests at some point, but here's a windows try run to shake out any more issues.
I'm not entirely clear why it was necessary to import WrapPrivileged.jsm in contentSubmitForm, but not for other functions in the same suite that also run in the content process?
As I noted in the commit message, it seems like we are sprouting event listeners left and right and these could probably be consolidated at some point - perhaps but not necessarily in this bug.
I've got that try run and more manual testing to do and going back over the patch before its ready for review. I may split out all those test changes into their own patch as they should pass with or without the functional changes in LoginManagerChild.
Assignee | ||
Comment 15•6 years ago
|
||
Updated•6 years ago
|
Updated•6 years ago
|
Assignee | ||
Comment 16•6 years ago
|
||
The changes for this bug have implications for how we test form interactions and login capture. To ensure we aren't missing something via false positives or gaps in test coverage, I've done an audit of all the passwordmgr tests, looking at what data is used and if it will cross paths with the new user-modification requirements being implemented here. In most cases where we would previously assign to an input's value property, we just need to use setUserInput(). In some cases, forms with declarative field values would be submitted, expecting a formsubmit message to be sent to the parent process.
Assignee | ||
Comment 17•6 years ago
|
||
A list of the changes to toolkit/components/passwordmgr/test/browser-chrome tests, and notes on what was changed/not changed and potential gotchas.
Assignee | ||
Comment 18•6 years ago
|
||
Comment 19•6 years ago
|
||
Comment 20•6 years ago
|
||
Backed out 3 changesets (bug 1388674) for mochitest failures e.g browser_doorhanger_toggles.js on a CLOSED TREE.
Backout link: https://hg.mozilla.org/integration/autoland/rev/dbb0fff9e65ce321b9bf2a7df7edb78cdc4288e2
Push with failures: https://treeherder.mozilla.org/#/jobs?repo=autoland&resultStatus=testfailed%2Cbusted%2Cexception&revision=09e3e82fb4396ae250cc5e92c7af8447ff5a5683&selectedJob=276890294
Log link: https://treeherder.mozilla.org/logviewer.html#/jobs?job_id=276890294&repo=autoland&lineNumber=21965
Log snippet:
[task 2019-11-19T01:31:48.050Z] 01:31:48 INFO - TEST-START | toolkit/components/passwordmgr/test/browser/browser_doorhanger_toggles.js
[task 2019-11-19T01:31:48.086Z] 01:31:48 INFO - GECKO(1966) | ++DOCSHELL 0x114545800 == 2 [pid = 1970] [id = {67554b95-6129-bf41-934a-625981fe02f3}]
[task 2019-11-19T01:31:48.087Z] 01:31:48 INFO - GECKO(1966) | ++DOMWINDOW == 19 (0x11b67d200) [pid = 1970] [serial = 201] [outer = 0x0]
[task 2019-11-19T01:31:48.087Z] 01:31:48 INFO - GECKO(1966) | ++DOMWINDOW == 20 (0x114e39c00) [pid = 1970] [serial = 202] [outer = 0x11b67d200]
[task 2019-11-19T01:31:48.160Z] 01:31:48 INFO - GECKO(1966) | ++DOMWINDOW == 21 (0x11b51dc00) [pid = 1970] [serial = 203] [outer = 0x11b67d200]
[task 2019-11-19T01:31:48.235Z] 01:31:48 INFO - GECKO(1966) | console.warn: LoginManager: "searchLogins: formActionOrigin
or httpRealm
is recommended"
[task 2019-11-19T01:31:48.451Z] 01:31:48 INFO - GECKO(1966) | [Child 1970, Main Thread] WARNING: NS_ENSURE_SUCCESS(rv, rv) failed with result 0xC1F30001: file /builds/worker/workspace/build/src/layout/forms/nsTextControlFrame.cpp, line 300
[task 2019-11-19T01:31:48.451Z] 01:31:48 INFO - GECKO(1966) | [Child 1970, Main Thread] WARNING: NS_ENSURE_SUCCESS(rv, rv) failed with result 0xC1F30001: file /builds/worker/workspace/build/src/layout/forms/nsTextControlFrame.cpp, line 300
[task 2019-11-19T01:31:48.565Z] 01:31:48 INFO - GECKO(1966) | ++DOMWINDOW == 22 (0x11b52ac00) [pid = 1970] [serial = 204] [outer = 0x11b67d200]
[task 2019-11-19T01:31:48.632Z] 01:31:48 INFO - GECKO(1966) | console.warn: LoginManager: "searchLogins: formActionOrigin
or httpRealm
is recommended"
[task 2019-11-19T01:31:48.656Z] 01:31:48 INFO - TEST-INFO | started process screencapture
[task 2019-11-19T01:31:48.819Z] 01:31:48 INFO - TEST-INFO | screencapture: exit 0
[task 2019-11-19T01:31:48.819Z] 01:31:48 INFO - Buffered messages logged at 01:31:48
[task 2019-11-19T01:31:48.819Z] 01:31:48 INFO - Entering test bound common_initialize
[task 2019-11-19T01:31:48.819Z] 01:31:48 INFO - Leaving test bound common_initialize
[task 2019-11-19T01:31:48.819Z] 01:31:48 INFO - Entering test bound setup
[task 2019-11-19T01:31:48.819Z] 01:31:48 INFO - Leaving test bound setup
[task 2019-11-19T01:31:48.820Z] 01:31:48 INFO - Entering test bound test_toggle_password
[task 2019-11-19T01:31:48.820Z] 01:31:48 INFO - TEST-PASS | toolkit/components/passwordmgr/test/browser/browser_doorhanger_toggles.js | Check doorhanger username -
[task 2019-11-19T01:31:48.820Z] 01:31:48 INFO - TEST-PASS | toolkit/components/passwordmgr/test/browser/browser_doorhanger_toggles.js | Check doorhanger password -
[task 2019-11-19T01:31:48.820Z] 01:31:48 INFO - Buffered messages finished
[task 2019-11-19T01:31:48.820Z] 01:31:48 INFO - TEST-UNEXPECTED-FAIL | toolkit/components/passwordmgr/test/browser/browser_doorhanger_toggles.js | false == true - JS frame :: chrome://mochitests/content/browser/toolkit/components/passwordmgr/test/browser/browser_doorhanger_toggles.js :: test_toggle_password/< :: line 39
[task 2019-11-19T01:31:48.821Z] 01:31:48 INFO - Stack trace:
[task 2019-11-19T01:31:48.821Z] 01:31:48 INFO - chrome://mochitests/content/browser/toolkit/components/passwordmgr/test/browser/browser_doorhanger_toggles.js:test_toggle_password/<:39
[task 2019-11-19T01:31:48.821Z] 01:31:48 INFO - resource://testing-common/BrowserTestUtils.jsm:withNewTab:151
[task 2019-11-19T01:31:48.821Z] 01:31:48 INFO - chrome://mochitests/content/browser/toolkit/components/passwordmgr/test/browser/browser_doorhanger_toggles.js:test_toggle_password:12
[task 2019-11-19T01:31:48.821Z] 01:31:48 INFO - chrome://mochikit/content/browser-test.js:Tester_execTest/<:1069
[task 2019-11-19T01:31:48.821Z] 01:31:48 INFO - chrome://mochikit/content/browser-test.js:Tester_execTest:1104
[task 2019-11-19T01:31:48.821Z] 01:31:48 INFO - chrome://mochikit/content/browser-test.js:nextTest/<:932
[task 2019-11-19T01:31:48.821Z] 01:31:48 INFO - chrome://mochikit/content/tests/SimpleTest/SimpleTest.js:SimpleTest.waitForFocus/waitForFocusInner/focusedOrLoaded/<:805
[task 2019-11-19T01:31:48.821Z] 01:31:48 INFO - Not taking screenshot here: see the one that was previously logged
Assignee | ||
Comment 21•6 years ago
|
||
Thanks :RaulG, looks like it only failed on OSX. I'll investigate.
Assignee | ||
Comment 22•6 years ago
|
||
Looks like I exacerbated an existing problem with browser_doorhanger_toggles.js. The updated patch should fix this and reduce the intermittents this test sees.
Try: https://treeherder.mozilla.org/#/jobs?repo=try&revision=7a68132a0780e246379bc8366445c207435d09b8&selectedJob=277091331
Comment 23•6 years ago
|
||
Comment 24•6 years ago
•
|
||
Failure log: https://treeherder.mozilla.org/logviewer.html#?job_id=277127623&repo=autoland
Backout link: https://hg.mozilla.org/integration/autoland/rev/fcd9570d85ee3a11d687d28ca871dddad9bc565d
[task 2019-11-20T07:22:06.191Z] 07:22:06 INFO - TEST-PASS | toolkit/components/passwordmgr/test/mochitest/test_submit_without_field_modifications.html | Reason cannot be empty
[task 2019-11-20T07:22:06.192Z] 07:22:06 INFO - add_task | Entering test test_init
[task 2019-11-20T07:22:06.193Z] 07:22:06 INFO - add_task | Leaving test test_init
[task 2019-11-20T07:22:06.195Z] 07:22:06 INFO - add_task | Entering test test_no_message_on_navigation
[task 2019-11-20T07:22:06.195Z] 07:22:06 INFO - Buffered messages finished
[task 2019-11-20T07:22:06.196Z] 07:22:06 INFO - TEST-UNEXPECTED-FAIL | toolkit/components/passwordmgr/test/mochitest/test_submit_without_field_modifications.html | SecurityError: Permission denied to access property "document" on cross-origin object - Should not throw any errors
[task 2019-11-20T07:22:06.197Z] 07:22:06 INFO - get@resource://specialpowers/WrapPrivileged.jsm:228:23
[task 2019-11-20T07:22:06.198Z] 07:22:06 INFO - setup@http://mochi.test:8888/tests/toolkit/components/passwordmgr/test/mochitest/test_submit_without_field_modifications.html:42:19
[task 2019-11-20T07:22:06.198Z] 07:22:06 INFO - asynctest_no_message_on_navigation@http://mochi.test:8888/tests/toolkit/components/passwordmgr/test/mochitest/test_submit_without_field_modifications.html:66:24
[task 2019-11-20T07:22:06.199Z] 07:22:06 INFO - nextTick/<@http://mochi.test:8888/tests/SimpleTest/SimpleTest.js:1797:34
[task 2019-11-20T07:22:06.200Z] 07:22:06 INFO - asyncnextTick@http://mochi.test:8888/tests/SimpleTest/SimpleTest.js:1813:11
[task 2019-11-20T07:22:06.200Z] 07:22:06 INFO - setTimeout handler*SimpleTest_setTimeoutShim@http://mochi.test:8888/tests/SimpleTest/SimpleTest.js:686:43
[task 2019-11-20T07:22:06.202Z] 07:22:06 INFO - add_task@http://mochi.test:8888/tests/SimpleTest/SimpleTest.js:1757:17
[task 2019-11-20T07:22:06.202Z] 07:22:06 INFO - @http://mochi.test:8888/tests/toolkit/components/passwordmgr/test/mochitest/test_submit_without_field_modifications.html:57:9
[task 2019-11-20T07:22:06.203Z] 07:22:06 INFO - GECKO(6676) | console.warn: LoginManager: "searchLogins: formActionOrigin
or httpRealm
is recommended"
[task 2019-11-20T07:22:06.204Z] 07:22:06 INFO - GECKO(6676) | MEMORY STAT | vsize 2574MB | residentFast 172MB | heapAllocated 23MB
[task 2019-11-20T07:22:06.204Z] 07:22:06 INFO - GECKO(6676) | Removing 1 popup notifications.
[task 2019-11-20T07:22:06.208Z] 07:22:06 INFO - TEST-OK | toolkit/components/passwordmgr/test/mochitest/test_submit_without_field_modifications.html | took 1166ms
https://treeherder.mozilla.org/logviewer.html#?job_id=277135351&repo=autoland
Comment 25•6 years ago
|
||
Assignee | ||
Comment 26•6 years ago
|
||
(In reply to Cosmin Sabou [:CosminS] from comment #24)
Not sure if I missed this Fission test failure in the previous landing attempt, but this is fixed now and fingers crossed that 3rd time is a charm.
Comment 27•6 years ago
|
||
Backed out for ss failures on browser_permissionPrompts.js
Backout link: https://hg.mozilla.org/integration/autoland/rev/1bb5d0983d4667410619529af7f99504fa7a3d5e
Log link: https://treeherder.mozilla.org/logviewer.html#/jobs?job_id=277341908&repo=autoland&lineNumber=2821
Comment 28•6 years ago
|
||
This test will need updating to cause the doorhanger to appear:
https://searchfox.org/mozilla-central/source/browser/tools/mozscreenshots/mozscreenshots/extension/configurations/PermissionPrompts.jsm#84
https://searchfox.org/mozilla-central/rev/652014ca1183c56bc5f04daf01af180d4e50a91c/browser/tools/mozscreenshots/mozscreenshots/extension/lib/permissionPrompts.html#20-24
I guess a setUserInput
would be best.
Comment 29•6 years ago
|
||
Comment 30•6 years ago
|
||
Backed out 3 changesets (bug 1388674) for causing test_formless_submit.html to permafail
push that caused the backout: https://treeherder.mozilla.org/#/jobs?repo=autoland&selectedJob=277677351&searchStr=os%2Cx%2C10.14%2Cshippable%2Copt%2Cmochitests%2Ctest-macosx1014-64-shippable%2Fopt-mochitest-e10s-5%2Cm%285%29&revision=d9b1730b8cb3dc48601abcd6c768a3c18aa62da0
backout: https://hg.mozilla.org/integration/autoland/rev/fcefdbe73a81c965abfa721260a39ff46d287800
Updated•6 years ago
|
Comment 31•6 years ago
|
||
Comment on attachment 9106340 [details]
Bug 1388674 - Update tests to use setUserInput, ensuring we get an input event for field modifications. r?MattN
Revision D51718 was moved to bug 1599315. Setting attachment 9106340 [details] to obsolete.
Comment 32•6 years ago
|
||
Assignee | ||
Updated•6 years ago
|
Updated•6 years ago
|
Updated•6 years ago
|
Comment 33•6 years ago
|
||
Comment 34•6 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/4a8165f1e03c
https://hg.mozilla.org/mozilla-central/rev/2a5b202965c5
Updated•6 years ago
|
Comment 35•6 years ago
|
||
Comment 36•6 years ago
|
||
bugherder |
Comment 37•6 years ago
|
||
Updating summary to reflect what we enabled in bug 1603226. Any edit in the LoginForm allows a capture still, in the future we can look specifically for login fields being edited.
Comment 38•6 years ago
•
|
||
Hey Matt and Sam,
On latest Nightly 73.0a1 (2020-01-03) (64-bit) with "signon.userInputRequiredToCapture.enabled" enabled by default:
- Both pre-filled (in a form and outside) fields from Testcase 1: Username and password fields filled by JS will toggle the save prompt once the user hits submit without editing the field. -> doesn't work
- The save prompt will not be toggled upon clicking the link from Testcase 2: From bug 1568940 without JS -> this is fixed
Attached Log for "In a form" case.
Also mentioned this in Bug 1603226 where the pref was enabled by default.
Comment 39•6 years ago
|
||
Assignee | ||
Comment 40•6 years ago
|
||
(In reply to Timea Cernea [:tbabos] from comment #38)
Hey Matt and Sam,
On latest Nightly 73.0a1 (2020-01-03) (64-bit) with "signon.userInputRequiredToCapture.enabled" enabled by default:
- Both pre-filled (in a form and outside) fields from Testcase 1: Username and password fields filled by JS will toggle the save prompt once the user hits submit without editing the field. -> doesn't work
I think by "doesnt work" you mean that if the field values were filled by JS and fields in the form had no actual user input, the test case expects there will not be a prompt to save/update the login. We ended up getting not enforcing that, and treat a form with a JS-modified value as being modified and allow the save/update doorhanger to show. We were concerned we didn't really understand the impact not prompting for js-modified fields would have, so elected for the more incremental, conservative implementation. I'll update the bug title to clarify, and file a follow-up to revisit this decision in the future.
Assignee | ||
Updated•6 years ago
|
Comment 41•6 years ago
|
||
Thanks for the explaining Sam! In this case, we can mark it as verified-fixed on Windows 10, MacOS 10.14 and Ubuntu 18.04 given its expected for the save prompt to appear for fields pre-filled by JS.
Comment 43•6 years ago
|
||
Just updated to Firefox 73 excited to finally have this fixed but it's still broken. :-( Do I need to change a setting or something? To be 100% clear:
a) visit a form with a password field
b) do nothing
c) navigate away from page
Firefox still prompts me if I want to save password.
OSX 10.11.6
Firefox 73.0
Assignee | ||
Comment 44•6 years ago
|
||
(In reply to billynoah from comment #43)
Just updated to Firefox 73 excited to finally have this fixed but it's still broken. :-( Do I need to change a setting or something? To be 100% clear:
a) visit a form with a password field
b) do nothing
c) navigate away from pageFirefox still prompts me if I want to save password.
If javascript on the page sets/changes form field values, it will still treat that as modified and offer to save the password. Do you have an example form? I can look to verify that is what is going on.
Comment 45•6 years ago
|
||
(In reply to Sam Foster [:sfoster] (he/him) from comment #44)
(In reply to billynoah from comment #43)
Just updated to Firefox 73 excited to finally have this fixed but it's still broken. :-( Do I need to change a setting or something? To be 100% clear:
a) visit a form with a password field
b) do nothing
c) navigate away from pageFirefox still prompts me if I want to save password.
If javascript on the page sets/changes form field values, it will still treat that as modified and offer to save the password. Do you have an example form? I can look to verify that is what is going on.
Thanks Sam,
No, no javascript here. I've created a simple page to demonstrate here:
http://mozilla-1388674.dev.zuma-design.com/
There is nothing there other than a form with some values populated and some buttons. When I click the "Cancel" link, I get the prompted to save my password.
Comment 46•5 years ago
|
||
Since this bug doesn't appear to be fixed and I've provided a reproducible example, what is the protocol here? Open a new bug or change status and re-open this one?
Comment 47•5 years ago
|
||
Sam, how do you best want to handle this potentially new issue?
Comment 48•5 years ago
|
||
(In reply to billynoah from comment #46)
Since this bug doesn't appear to be fixed and I've provided a reproducible example, what is the protocol here? Open a new bug or change status and re-open this one?
Thank you very much for the test case and report. We never re-open bugs unless the code gets reverted so I filed bug 1616945 for you.
Updated•5 years ago
|
Updated•5 years ago
|
Comment 49•5 years ago
|
||
Updated•5 years ago
|
Updated•5 years ago
|
Comment 50•5 years ago
|
||
Updated•5 years ago
|
Description
•