Commit Graph

209 Commits

Author SHA1 Message Date
Boris Zbarsky
2b6097ae6d Bug 1455055 part 1. Convert nsIDOMEventListener to taking an Event, not an nsIDOMEvent. r=masayuki
This does no cleanup other than what's needed to compile.  Cleanup coming up in
later patches.

MozReview-Commit-ID: 3sOnkj71n09
2018-04-20 00:49:29 -04:00
Kris Maglione
219ed0cc06 Bug 1454813: Part 2b - Rename SpawnTask.js to AddTask.js. r=florian
The old name no longer makes sense, since it no longer exports an spawn_task
symbol, and add_task is what we really care about.

MozReview-Commit-ID: IE7B8Czv8DH

--HG--
rename : testing/mochitest/tests/SimpleTest/SpawnTask.js => testing/mochitest/tests/SimpleTest/AddTask.js
extra : rebase_source : 03bca5aa69a7625a49b4455a6c96ce4c59de3a5a
2018-04-18 11:43:45 -07:00
Andreea Pavel
7a4b9a3f56 Merge mozilla-inbound to mozilla-central. a=merge
--HG--
extra : rebase_source : 66bd87105d99036ada5008499ff0eaea579b531a
2018-04-06 13:20:21 +03:00
Boris Zbarsky
1dce94cf16 Bug 1449631 part 2. Remove nsIDOMEventTarget::RemoveEventListener. r=smaug
We can't have a null content in
ScrollbarActivity::StopListeningForScrollAreaEvents, because only viewport
frames have a null GetContent().

MozReview-Commit-ID: 9iAg0ivVqqG
2018-04-05 13:42:40 -04:00
Matt Brubeck
4aa522320e Bug 1451825 - Update to env_logger 0.5. r=ted
MozReview-Commit-ID: CqKdONY1NMT

--HG--
extra : rebase_source : 29f9c7a40cf71847a6f5e5e3f33e8695e9bd0b64
2018-04-05 10:08:05 -07:00
Matt Brubeck
61e9479fbb Bug 1449034 - Update Rust crates to use lazy_static 1.0. r=ted
MozReview-Commit-ID: 4u4OQFBaURV

--HG--
extra : rebase_source : f7a4f89d275777a036ca08dad42b0a17e9c7eb8e
2018-03-26 15:12:56 -07:00
Tooru Fujisawa
1adba8c1fc Bug 1442465 - Part 4.2: Stop unnecessarily awaiting on BrowserTestUtils.removeTab (simple part). r=dao 2018-03-19 11:16:45 +09:00
Tim Taubert
dd4d724d5b Bug 1444547 - Propagate proper error codes from u2f-hid-rs to WebAuthn r=jcj
Reviewers: jcj

Reviewed By: jcj

Bug #: 1444547

Differential Revision: https://phabricator.services.mozilla.com/D717
2018-03-14 14:09:02 +01:00
Tim Taubert
141cb3849c Bug 1444756 - Rewrite browser_webauthn_telemetry.js r=jcj
Reviewers: jcj

Reviewed By: jcj

Bug #: 1444756

Differential Revision: https://phabricator.services.mozilla.com/D703

--HG--
extra : amend_source : 991801bfb48a6e3262c1d2a77c8734defae2406d
2018-03-13 08:16:52 +01:00
Tim Taubert
2bd0ff9c93 Bug 1430150 - Disable browser_webauthn_telemetry.js on TV runs for now r=bustage 2018-03-11 20:23:07 +01:00
Tim Taubert
6ded2cf370 Bug 1430150 - Implement WebAuthentication permission prompts r=jcj,johannh
Reviewers: jcj, johannh

Reviewed By: jcj, johannh

Bug #: 1430150

Differential Revision: https://phabricator.services.mozilla.com/D638

--HG--
rename : dom/webauthn/tests/cbor/cbor.js => dom/webauthn/tests/cbor.js
extra : amend_source : f137c2aebea5797cd07d4500cb71c2b9be4e4844
2018-03-11 18:47:14 +01:00
Tim Taubert
afe259f21f Bug 1409202 - Web Authentication - Restrict to selected tabs in the active window r=jcj
Summary:
This patch restricts any calls to navigator.credentials.* methods to selected
tabs. Any active WebAuthn request will be aborted when the parent chrome
window loses focus, or the <browser> is backgrounded.

Reviewers: jcj

Reviewed By: jcj

Bug #: 1409202

Differential Revision: https://phabricator.services.mozilla.com/D688

--HG--
extra : amend_source : 112378a1ab2e883d7603e8a28ff3f8e944d57b5f
2018-03-10 06:43:20 +01:00
Matt Brubeck
1fbdfd78ef Bug 1444097 - Clean up env_logger dependencies. r=ted
For the "js" crate, disable the "regex" feature to reduce binary size.

For the "u2fhid" crate, it's used only in examples. Make it a dev-dependency
so it won't be part of the Firefox build.

MozReview-Commit-ID: DY9indMqrRw

--HG--
extra : rebase_source : aa66fe1effaeca0ae35ec5dd20b33724eb3fac48
2018-03-08 07:35:11 -08:00
Matt Brubeck
54c488c132 Bug 1443248 - Update u2fhid to core-foundation-sys 0.5. r=ttaubert
MozReview-Commit-ID: 4xTSQpvHHAV

--HG--
extra : rebase_source : 9f6234a05ab1b8a0bc47482a2a745edfa0bd2f68
2018-03-05 11:13:13 -08:00
Tim Taubert
789cd3bd6f Bug 1442557 - [u2f-hid-rs] Keep polling excluded devices when creating credentials r=jcj
Reviewers: jcj

Reviewed By: jcj

Bug #: 1442557

Differential Revision: https://phabricator.services.mozilla.com/D670

--HG--
extra : amend_source : 95eb9f67cd6308cb9be6be2b6f520a7d20fb2516
2018-03-02 16:03:33 +01:00
Tim Taubert
3879951466 Bug 1442562 - Sync u2f-hid-rs rustfmt changes r=jcj
Reviewers: jcj

Reviewed By: jcj

Bug #: 1442562

Differential Revision: https://phabricator.services.mozilla.com/D669
2018-03-02 16:00:58 +01:00
Tim Taubert
612a195ccf Bug 1439856 - U2FTokenTransport interface should use WebAuthn*Info types defined in the .pidl r=jcj
Reviewers: jcj

Reviewed By: jcj

Bug #: 1439856

Differential Revision: https://phabricator.services.mozilla.com/D625
2018-02-22 22:09:00 +01:00
Tim Taubert
0af61da4ec Bug 1406471 - Web Authentication - Implement FIDO AppID Extension r=jcj,smaug
Reviewers: jcj, smaug

Reviewed By: jcj

Bug #: 1406471

Differential Revision: https://phabricator.services.mozilla.com/D595
2018-02-22 10:53:49 +01:00
Tim Taubert
3e79498113 Bug 1439326 - Add U2FTokenTransport::Drop() to better handle U2FHIDTokenManager destruction r=jcj 2018-02-19 12:45:43 +01:00
Tim Taubert
8e5d9a4b24 Bug 1437616 - Fix more Windows bustage on a CLOSED TREE r=me 2018-02-12 22:09:38 +01:00
Tim Taubert
bc18da5fe7 Bug 1437616 - Use proper WebAuthn result types defined in the .pidl r=jcj
Reviewers: jcj

Reviewed By: jcj

Bug #: 1437616

Differential Revision: https://phabricator.services.mozilla.com/D582
2018-02-12 21:08:54 +01:00
Tim Taubert
7cd0f0b36c Bug 1437487 - [u2f-hid-rs] Allow passing an empty key handles list r=jcj
Reviewers: jcj

Reviewed By: jcj

Bug #: 1437487

Differential Revision: https://phabricator.services.mozilla.com/D580
2018-02-12 16:02:43 +01:00
Tim Taubert
4c6fab9bac Bug 1416056 - Web Authentication - Default to "None Attestation" r=jcj
Summary:
Always replace attestation statements with a "none" attestation.

Bug 1430150 will introduce a prompt that asks the user for permission whenever
the RP requests "direct" attestation. Only if the user opts in we will forward
the attestation statement with the token's certificate and signature.

Reviewers: jcj

Reviewed By: jcj

Bug #: 1416056

Differential Revision: https://phabricator.services.mozilla.com/D567
2018-02-09 16:34:39 +01:00
Tim Taubert
9170ed9f23 Bug 1436707 - Ensure the U2FSoftTokenManager is initialized in when creating an assertion r=jcj
Reviewers: jcj

Reviewed By: jcj

Bug #: 1436707

Differential Revision: https://phabricator.services.mozilla.com/D563
2018-02-08 16:50:26 +01:00
Tim Taubert
08931dd068 Bug 1435527 - Run to timeout from navigator.credentials.get() when PublicKeyCredentialRequestOptions.allowCredentials is empty r=jcj
Reviewers: jcj

Reviewed By: jcj

Bug #: 1435527

Differential Revision: https://phabricator.services.mozilla.com/D559
2018-02-08 12:45:21 +01:00
J.C. Jones
8ecfc436b4 Bug 1436473 - Rename WebAuthn dict to PublicKeyCredentialCreationOptions r=baku
Late-breaking rename pre-CR in Web Authentication [1] renamed a dictionary. It's
not an interop issue, really, which must be why it was let through. This is a
WebIDL and Web Platform Tests-only issue. (The WPT updates are happening at
Github [2])

[1] https://github.com/w3c/webauthn/pull/779/files
[2] https://github.com/w3c/web-platform-tests/pull/9237

MozReview-Commit-ID: KEIlqIYbzKp

--HG--
extra : rebase_source : 4204ea62a41f374a6731a9367552af122d354145
2018-02-07 12:01:51 -07:00
David Keeler
087f092867 bug 1421084 - part 4/4 - remove nsNSSShutDown.h and (hopefully) all references to it r=mt,ttaubert
MozReview-Commit-ID: 2mhvHsC5Nil

--HG--
extra : rebase_source : 651c2bcf8655f75756ea2bac788eb8c0781dc90a
2018-01-24 14:44:01 -08:00
David Keeler
ad5cec4768 bug 1421084 - part 3/4 - remove nsNSSShutDownObject::shutdown and virtualDestroyNSSReference r=mt,ttaubert
MozReview-Commit-ID: ErL7ZjAGVVC

--HG--
extra : rebase_source : 2869aafaef729f0ad190f957919e8b9c40700477
2018-01-24 14:29:08 -08:00
David Keeler
a0e34baf27 bug 1421084 - part 2/4 - remove nsNSSShutDownObject::isAlreadyShutDown() r=mt,ttaubert
MozReview-Commit-ID: DlS16pHE0Ik

--HG--
extra : rebase_source : d7596a3571478adefae4ffa5d446ff5234ba9ed7
2018-01-23 12:22:56 -08:00
David Keeler
e8cc0ba1ce bug 1421084 - part 1/4 - remove now-unnecessary nsNSSShutDownPreventionLock r=mt,ttaubert
As of bug 1417680, the NSS shutdown tracking infrastructure is unnecessary (and
does nothing anyway). This series of changesets removes the remaining pieces in
a way that is hopefully easy to confirm is correct.

MozReview-Commit-ID: 8Y5wpsyNlGc

--HG--
extra : rebase_source : ef6b481510d949e404a4ef5615097d66e566c947
2018-01-23 10:37:47 -08:00
J.C. Jones
c2ff67b667 Bug 1433525 - Web Authentication Client Data needs the "type" field r=keeler,smaug
The Web Authentication CollectedClientData is missing the type field, which
is just a simple string. (The editor's draft also removes hashAlgorithm, but
let's not get ahead of ourselves...)

Add in that simple string. This was found at interop testing.

MozReview-Commit-ID: DlawLyHTYhB

--HG--
extra : rebase_source : 6cdd8e14161dc4aea5bfd1baf60c7384219ba951
2018-01-26 10:41:37 -08:00
J.C. Jones
5685e93ac7 Bug 1428916 - WebAuthn: Draft Attestation Preference r=smaug,ttaubert
The WebAuthn spec lets RPs ask to specifically get direct attestation certificates
during credential creation using the "Attestation Conveyance Preference" [1].

This change adds that field into the WebIDL and ignores it for now. This is
pre-work to Bug #1430150 which will make this useful (which in turn requires
Bug #1416056's support for anonymizing those attestation certificates).

[1] https://www.w3.org/TR/webauthn/#attestation-convey

MozReview-Commit-ID: 763vaAMv48z

--HG--
extra : rebase_source : 7fb7c64a0ee3167032485378af6074a7366295a4
2018-01-23 12:21:15 -07:00
Chris Peterson
37efe4d0e6 Bug 1428535 - Add missing override specifiers to overridden virtual functions. r=froydnj
MozReview-Commit-ID: DCPTnyBooIe

--HG--
extra : rebase_source : cfec2d96faeb11656d86d760a34e0a04cacddb13
extra : intermediate-source : 6176724d63788b0fe8caa3f91607c2d93dbaa7ec
extra : source : eebbb0600447f9b64aae3bcd47b4be66c02a51ea
2017-11-05 19:37:28 -08:00
Tim Taubert
c3180f09e1 Bug 1406467 - Web Authentication - WD-07 Updates to Make Assertion r=jcj,smaug
Summary:
Add support for PublicKeyCredentialRequestOptions.userVerification. For now
this basically means that we'll abort the operation with NotAllowed, as we
don't support user verification yet.

Pass PublicKeyCredentialDescriptor.transports through to the token manager
implementations. The softoken will ignore those and pretend to support all
transports defined by the spec. The USB HID token will check for the "usb"
transport and either ignore credentials accordingly, or abort the operation.

Note: The `UserVerificationRequirement` in WebIDL is defined at https://w3c.github.io/webauthn/#assertion-options

Reviewers: jcj, smaug

Reviewed By: jcj, smaug

Bug #: 1406467

Differential Revision: https://phabricator.services.mozilla.com/D338

--HG--
extra : amend_source : 314cadb3bc40bbbee2a414bc5f13caed55f9d720
2018-01-09 07:27:35 +01:00
Adam Langley
c644b5ee10 Bug 1420763 - encode webauthn keys as a COSE key; r=keeler
webauthn says[1] that public keys are encoded as COSE keys.  I find the COSE
RFC quite circuitous in many respects and so any reviews should check whether
they agree with my understanding of what should be in a COSE key.

The webauthn spec says that the key:

    “MUST contain the "alg" parameter and MUST NOT contain
     any other optional parameters.”

I don't believe that any of the parameters included are optional but, again, I
don't think the RFC is completely clear.

[1] https://www.w3.org/TR/webauthn/#sec-attested-credential-data

MozReview-Commit-ID: 2023mW3yVWU

--HG--
extra : rebase_source : 21d84d67f19d1885b73473a4d77d15f6c4cd80c2
2018-01-04 14:05:14 -07:00
Coroiu Cristina
4eaabc3225 Backed out 1 changesets (bug 1420763) for failing dom/webauthn/tests/test_webauthn_loopback.html r=backout on a CLOSED TREE
Backed out changeset cd99a1f959ad (bug 1420763)
2018-01-05 22:11:26 +02:00
Adam Langley
de184adf52 Bug 1420763 - encode webauthn keys as a COSE key; r=keeler
webauthn says[1] that public keys are encoded as COSE keys.  I find the COSE
RFC quite circuitous in many respects and so any reviews should check whether
they agree with my understanding of what should be in a COSE key.

The webauthn spec says that the key:

    “MUST contain the "alg" parameter and MUST NOT contain
     any other optional parameters.”

I don't believe that any of the parameters included are optional but, again, I
don't think the RFC is completely clear.

[1] https://www.w3.org/TR/webauthn/#sec-attested-credential-data

MozReview-Commit-ID: 2023mW3yVWU

--HG--
extra : rebase_source : 2cc9df48ed1ba9f940f57a3148ec881c1b0630df
2018-01-04 14:05:14 -07:00
Adam Langley
e21203ee93 Bug 1420760 - Order webauthn CBOR map keys. r=jcj
MozReview-Commit-ID: 6BsiL45dxa3
2017-12-31 15:37:27 -08:00
Tim Taubert
43288c7d24 Bug 1407093 - Web Authentication - WD-07 updates for user handles r=jcj,smaug
Reviewers: jcj, smaug

Reviewed By: jcj, smaug

Bug #: 1407093

Differential Revision: https://phabricator.services.mozilla.com/D328
2017-12-13 11:15:16 +01:00
Tim Taubert
b5c19b9f90 Bug 1396907 - Abstract a BaseAuthManager for dom/u2f and dom/webauthn r=jcj
Summary: We can probably abstract more stuff in the future, but this seems like a good start.

Reviewers: jcj

Reviewed By: jcj

Bug #: 1396907

Differential Revision: https://phabricator.services.mozilla.com/D323
2017-12-06 18:41:58 +01:00
Tim Taubert
a3256fcae8 Bug 1421616 - Have one WebAuthnManager instance per CredentialsContainer r=jcj
Summary:
We currently have a single WebAuthnManager instance per process that's shared
between all CredentialContainers. That way the nsPIDOMWindowInner parent has
to be tracked by the transaction, as multiple containers could kick off
requests simultaneously.

This patch lets us we have one WebAuthnManager instance per each
CredentialsContainer and thus each nsPIDOMWindowInner. This matches the current
U2F implementation where there is one instance per parent window too.

This somewhat simplifies the communication diagram (at least in my head), as
each U2F/WebAuthnManager instance also has their own TransactionChild/Parent
pair for IPC protocol communication. The manager and child/parent pair are
destroyed when the window is.

Reviewers: jcj

Reviewed By: jcj

Bug #: 1421616

Differential Revision: https://phabricator.services.mozilla.com/D305
2017-12-05 19:05:06 +01:00
Tim Taubert
587ed9ddc7 Backed out changeset bb739695f566 (bug 1421616) 2017-12-05 19:24:22 +01:00
Tim Taubert
a0935f0ff1 Bug 1421616 - Have one WebAuthnManager instance per CredentialsContainer r=jcj
Summary:
We currently have a single WebAuthnManager instance per process that's shared
between all CredentialContainers. That way the nsPIDOMWindowInner parent has
to be tracked by the transaction, as multiple containers could kick off
requests simultaneously.

This patch lets us we have one WebAuthnManager instance per each
CredentialsContainer and thus each nsPIDOMWindowInner. This matches the current
U2F implementation where there is one instance per parent window too.

This somewhat simplifies the communication diagram (at least in my head), as
each U2F/WebAuthnManager instance also has their own TransactionChild/Parent
pair for IPC protocol communication. The manager and child/parent pair are
destroyed when the window is.

Reviewers: jcj

Reviewed By: jcj

Bug #: 1421616

Differential Revision: https://phabricator.services.mozilla.com/D305
2017-12-05 19:05:06 +01:00
Tim Taubert
c5eda6e272 Bug 1406462 - Web Authentication - Add support for authenticator selection criteria and attachment types r=jcj,smaug
Reviewers: jcj, smaug

Reviewed By: jcj, smaug

Bug #: 1406462

Differential Revision: https://phabricator.services.mozilla.com/D278
2017-11-29 13:58:33 +01:00
Tim Taubert
ed40d66fa6 Bug 1419907 - [u2f-hid-rs] Combine platform managers in a single state machine r=jcj
Now that all the platform managers basically have the same state machine code,
we should combine those, and not repeat ourselves.

Review: https://github.com/jcjones/u2f-hid-rs/pull/59

ed0728d259
2017-11-22 22:12:06 +01:00
Tim Taubert
1a3663cd99 Bug 1419685 - [u2f-hid-rs] Implement per-device threads on Windows, remove KeyHandleMatcher r=jcj
This patch rewrites the Windows backend to have one thread per device.
As a bonus we get to remove the KeyHandleMatcher.

Review: https://github.com/jcjones/u2f-hid-rs/pull/57

296f6707b3
2017-11-22 10:13:49 +01:00
Tim Taubert
2f4733f069 Bug 1419070 - [u2f-hid-rs] Implement per-device threads on Linux, don't use KeyHandleMatcher r=jcj
This patch rewrites the Linux backend to have a structure similar to the macOS
one [1]. We'll have one thread per device, which means that a device that is
stuck or unresponsive won't break other devices.

[1] https://github.com/jcjones/u2f-hid-rs/pull/52

Review: https://github.com/jcjones/u2f-hid-rs/pull/56

7d9f31a8a2
2017-11-20 18:25:54 +01:00
Tim Taubert
e3b5379696 Bug 1418242 - [u2f-hid-rs] Let stubs fail, instead of running until cancellation r=jcj
1b1d79e653
2017-11-16 21:22:04 +01:00
Tim Taubert
b7e7434f37 Bug 1418018 - [u2f-hid-rs] Use CFRetain() to ensure the CFRunLoop! is kept alive as long as we need it r=jcj
c02ac553ca
ceede2fd8e
2017-11-16 21:26:18 +01:00
Tim Taubert
12a6719462 Bug 1418234 - [u2f-hid-rs] Small cleanup in macos::Transaction::new() r=me
ef4332519a
2017-11-15 04:55:41 +01:00
Tim Taubert
73cfd2472a Bug 1415675 - Web Authentication - Support AbortSignal types r=jcj,smaug
Summary:
This patch adds support for aborting WebAuthn requests via AbortSignals.

https://w3c.github.io/webauthn/#abortoperation
https://w3c.github.io/webauthn/#sample-aborting
https://dom.spec.whatwg.org/#abortcontroller-api-integration

It also adds a variety of request abortion/cancellation tests.

To test request cancellation we can use USB tokens as those requests will
never complete without a token and/or user interaction. A bonus here is that
we'll have a little coverage for u2f-hid-rs.

Reviewers: jcj, smaug

Reviewed By: jcj, smaug

Bug #: 1415675

Differential Revision: https://phabricator.services.mozilla.com/D245

--HG--
extra : amend_source : bd779d5c4c6a11dd8ce34c0cc86675825b799031
2017-11-17 09:44:50 +01:00
Tim Taubert
fdbcf7df8e Bug 1417433 - Remove unused U2FSoftTokenManager::IsCompatibleVersion() r=jcj
Summary:
This check was replaced a while ago, by [1]

[1] https://searchfox.org/mozilla-central/search?q=kRequiredU2FVersion

Reviewers: jcj

Reviewed By: jcj

Bug #: 1417433

Differential Revision: https://phabricator.services.mozilla.com/D246
2017-11-16 10:45:22 +01:00
Tim Taubert
b350f42d65 Bug 1398268 - [u2f-hid-rs] Rewrite macOS IOHIDManager communication and state machine r=jcj
Review: https://github.com/jcjones/u2f-hid-rs/pull/52
2017-11-14 11:39:29 +01:00
Tim Taubert
ec80cf873c Bug 1406468 - Web Authentication - Implement isUserVerifyingPlatformAuthenticatorAvailable() method r=jcj,smaug
Summary:
We currently implement no platform authenticators, so this would always
resolve to false. For those cases, the spec recommends a resolve timeout
on the order of 10 minutes to avoid fingerprinting.

A simple solution is thus to never resolve the promise, otherwise we'd
have to track every single call to this method along with a promise
and timer to resolve it after exactly X minutes.

A Relying Party has to deal with a non-response in a timely fashion, so
we can keep this as-is (and not resolve) even when we support platform
authenticators but they're not available, or a user rejects a website's
request to use them.

Reviewers: jcj, smaug

Reviewed By: jcj, smaug

Bug #: 1406468

Differential Revision: https://phabricator.services.mozilla.com/D217
2017-11-14 11:44:46 +01:00
Tim Taubert
1d2e8ed150 Bug 1412408 - Fix content process leak of U2FTransactionChild instances r=jcj
Summary:
This patch fixes the reported leak of U2FTransactionChild instances in the
content process by introducing a WebAuthnTransactionChildBase class that both
WebAuthnTransactionChild and U2FTransactionChild inherit from.

This base class is responsible for proper refcounting. In
BackgroundChildImpl::DeallocPWebAuthnTransactionChild() we currently always
cast to WebAuthnTransactionChild, that will work only for the WebAuthn API. We
can now cast to WebAuthnTransactionChildBase to make this work for U2F as well.

Reviewers: jcj

Reviewed By: jcj

Bug #: 1412408

Differential Revision: https://phabricator.services.mozilla.com/D179
2017-11-02 12:18:19 +01:00
Tim Taubert
319a39de9f Bug 1413598 - Pull in latest changes from u2f-hid-rs git repository r=jcj
Reviewers: jcj

Reviewed By: jcj

Bug #: 1413598

Differential Revision: https://phabricator.services.mozilla.com/D181
2017-11-02 12:18:07 +01:00
Andrew McCreight
298aa82710 Bug 1412125, part 2 - Fix dom/ mode lines. r=qdot
This was automatically generated by the script modeline.py.

MozReview-Commit-ID: BgulzkGteAL

--HG--
extra : rebase_source : a4b9d16a4c06c4e85d7d85f485221b1e4ebdfede
2017-10-26 15:08:41 -07:00
Tim Taubert
c29f1dbeb7 Bug 1403818 - Fix WebAuthn IPC crashes by keeping the child actor alive until process shutdown r=jcj
Summary:
We currently call ChildActor.send__delete() when clearing an active transaction
and thereby destroy the child actor. If that happens, e.g. due to a tab switch,
while a message is in the IPC buffer waiting to be delivered, we crash.

This patch creates the child actor lazily as before, but keeps it around until
the WebAuthnManager goes away, which will be at process shutdown.

Each transaction now has a unique id, that the parent process will include in
any of the ConfirmRegister, ConfirmSign, or Abort messages. That way we can
easily ignore stale messages that were in the buffer while we started a new
transaction or cancelled the current one.

Reviewers: jcj

Reviewed By: jcj

Bug #: 1403818

Differential Revision: https://phabricator.services.mozilla.com/D149
2017-10-25 15:59:53 +02:00
Andrea Marchesini
07adf4b348 Bug 1411257 - No MOZ_CRASH if BackgroundChild::GetOrCreateForCurrentThread() fails - part 8 - WebAuthn API, r=asuth 2017-10-25 08:45:53 +02:00
Andrea Marchesini
f03a80287c Bug 1408333 Get rid of nsIIPCBackgroundChildCreateCallback - part 11 - WebAuthn, r=asuth 2017-10-24 12:02:40 +02:00
Tim Taubert
ce066246b7 Bug 1410428 - Handle stales messages in {WebAuthn,U2F}Manager r=jcj
Summary:
With both managers storing transaction infos in `Maybe<Info> mTransaction` now,
it occurred to me that we can't actually assert that
`mTransaction.isSome() == true` when we receive a message.

At least with the U2F API the request could be cancelled (and mTransaction
cleared) while there's a pending completion message. For WebAuthn it probably
doesn't hurt to handle this properly either.

(As a bonus, I snuck in the removal of an unused enum.)

Reviewers: jcj

Reviewed By: jcj

Bug #: 1410428

Differential Revision: https://phabricator.services.mozilla.com/D145
2017-10-21 11:34:44 +02:00
Tim Taubert
2dcbb53d85 Bug 1409434 - Fix merge bustage r=me 2017-10-18 15:23:58 +02:00
Tim Taubert
82783caf59 Bug 1409434 - Rework WebAuthnManager state machine r=jcj
Summary:
This patch aims to clean up the WebAuthnManager's state machine, especially
to make cancellation of transactions clearer. To fix bug 1403818, we'll have to
later introduce a unique id that is forwarded to the U2FTokenManager.

There are multiple stages of cancellation/cleanup after a transaction was
started. All of the places where we previously called Cancel() or
MaybeClearTransaction() are listed below:

[stage 1] ClearTransaction

This is the most basic stage, we only clean up what information we have about
the current transaction. This means that the request was completed successfully.
It is used at the end of FinishMakeCredential() and FinishGetAssertion().

[stage 2] RejectTransaction

The second stage will reject the transaction promise we returned to the caller.
Then it will call ClearTransaction, i.e. stage 1. It is used when one of the
two Finish*() functions aborts before completion, or when the parent process
sends a RequestAborted message.

[stage 2b] MaybeRejectTransaction

This is the same as stage 2, but will only run if there's an active transaction.
It is used by ~WebAuthnManager() to reject and clean up when we the manager
goes away.

[stage 3] CancelTransaction

The third stage sends a "Cancel" message to the parent process before rejecting
the transaction promise (stage 2) and cleaning up (stage 1). It's used by
HandleEvent(), i.e. the document becomes inactive.

[stage 3b] MaybeCancelTransaction

This is the same as stage 3, but will only run if there's an active transaction.
it is used at the top of MakeCredential() and GetAssertion() so that any
active transaction is cancelled before we handle a new request.

Reviewers: jcj

Reviewed By: jcj

Bug #: 1409434

Differential Revision: https://phabricator.services.mozilla.com/D132
2017-10-18 15:04:56 +02:00
Sebastian Hengst
fea24c0daf merge mozilla-central to autoland. r=merge a=merge
--HG--
extra : rebase_source : 819bdfcc5e3f50cb5a3d8d76ce1f88ceeb0dd5a9
2017-10-17 23:54:52 +02:00
Tim Taubert
23f8be23e6 Bug 1409357 - Remove {WebAuthn,U2F}Manager::Start{Register,Sign,Cancel} methods r=jcj
Summary:
We can simplify and reduce the {WebAuthn,U2F}Manager code by removing these
methods and sending messages directly from closures.

Reviewers: jcj

Reviewed By: jcj

Bug #: 1409357

Differential Revision: https://phabricator.services.mozilla.com/D131
2017-10-17 17:11:12 +02:00
Tim Taubert
da7df09470 Bug 1407829 - Fix merge bustage in WebAuthnManager.h on a CLOSED TREE r=me 2017-10-17 12:50:13 +02:00
J.C. Jones
c3de84620b Bug 1381190 - Change to COSE Algorithm identifiers for WebAuthn r=qdot,ttaubert
The WD-06 (and later) WebAuthn specs choose to move to integer algorithm
identifiers for the signatures [1], with a handful of algorithms identified [2].
U2F devices only support ES256 (e.g., COSE ID "-7"), so that's all that is
implemented here.

Note that the spec also now requires that we accept empty lists of parameters,
and in that case, the RP says they aren't picky, so this changes what happens
when the parameter list is empty (but still aborts when the list is non-empty
but doesn't have anything we can use) [3].

There's a follow-on to move parameter-validation logic into the U2FTokenManager
in Bug 1409220.

[1] https://w3c.github.io/webauthn/#dictdef-publickeycredentialparameters
[2] https://w3c.github.io/webauthn/#alg-identifier
[3] https://w3c.github.io/webauthn/#createCredential bullet #12

MozReview-Commit-ID: KgL7mQ9u1uq

--HG--
extra : rebase_source : 2a1767805779a9f8049102723011193f113f0713
2017-10-12 15:21:06 -07:00
J.C. Jones
f05cfb1125 Bug 1381190 - Remove WebAuthnRequest dead code r=ttaubert
The WebAuthnRequest.h file is no longer used, and it appears we forgot to
clean it up.

MozReview-Commit-ID: 8Cgh40YxGiY

--HG--
extra : rebase_source : 81b84d0365f8a0766d84962a2f628b6025c135e2
2017-10-12 15:17:51 -07:00
J.C. Jones
cffad01a4b Bug 1407829 - WebAuthn: Implement CredMan's Store method r=qdot,ttaubert
Credential Management defines a Store operation [1], which needs to be
implemented for WebAuthn's spec compliance. It only returns a NotSupportedError
for WebAuthn [2], so it's pretty simple.

[1] https://w3c.github.io/webappsec-credential-management/#dom-credentialscontainer-store
[2] https://w3c.github.io/webauthn/#storeCredential

MozReview-Commit-ID: KDEB8r5feQt

--HG--
extra : rebase_source : b3e2a270a2ea7c1689ef9991c1345bcc20368c9e
2017-10-12 17:02:22 -07:00
Tim Taubert
cafdee7c62 Bug 1407565 - Add NS_IsMainThread() assertions to WebAuthnManager r=jcj
Bug #: 1407565

Differential Revision: https://phabricator.services.mozilla.com/D116

--HG--
extra : amend_source : 264a25a0343042fe7dfa9f5cc22c05c9b908f93a
2017-10-12 13:16:29 +02:00
J.C. Jones
8622a9216c Bug 1406456 - WebAuthn WebIDL Updates for WD-07 (part 2) r=qdot,ttaubert
This covers these renames:

* In CollectedClientData, hashAlg => hashAlgorithm
* In CollectedClientData, tokenBinding => tokenBindingId
* In MakePublicKeyCredentialOptions, parameters => pubKeyCredParams
* In MakePublicKeyCredentialOptions, excludeList => excludeCredentials
* In PublicKeyCredentialRequestOptions, allowList => allowCredentials
* Transport (WebAuthnTransport in Gecko) => AuthenticatorTransport

MozReview-Commit-ID: 3FdRnkosy83

--HG--
extra : rebase_source : 22f124c781b03837ad0cd4be4edf34527e3b9d38
2017-10-09 16:28:13 -07:00
J.C. Jones
24696391df Bug 1406456 - WebAuthn WebIDL Updates for WD-07 (part 1) r=keeler,qdot
This covers these renames:
* In PublicKeyCredentialParameters, algorithm => alg
* MakeCredentialOptions => MakePublicKeyCredentialOptions
* PublicKeyCredentialEntity => PublicKeyCredentialRpEntity
* Attachment => AuthenticatorAttachment

It sets a default excludeList and allowList for the make / get options.

It adds the method isPlatformAuthenticatorAvailable which is incomplete and
not callable, to be completed in Bug 1406468.

Adds type PublicKeyCredentialRpEntity.

Adds "userId" to AuthenticatorAssertionResponse.

Adds "id" as a buffer source to PublicKeyCredentialUserEntity and as a
DOMString to PublicKeyCredentialRpEntity, refactoring out the "id" field
from the parent PublicKeyCredentialEntity.

It also adds a simple enforcement per spec 4.4.3 "User Account Parameters for
Credential Generation" that the new user ID buffer, if set, be no more than
64 bytes long. I mostly added it here so I could adjust the tests all at once
in this commit.

MozReview-Commit-ID: IHUdGVoWocq

--HG--
extra : rebase_source : bc1793f74700b2785d2bf2099c0dba068f717a59
2017-10-06 16:10:57 -07:00
J.C. Jones
c202064379 Bug 1406469 - Handle the WebAuthn "User Verified" flag r=ttaubert
WebAuthn has added a flag UV to indicate the user was biometrically verified. We
have to make sure not to set that flag for U2F. Turns out we already do that,
but let's add the constant and such.

Ref: https://w3c.github.io/webauthn/#authenticator-data

MozReview-Commit-ID: 6Qtjdkverls

--HG--
extra : rebase_source : 660348596b917d8f461b19298e01dbe19410b63f
2017-10-09 18:10:31 -07:00
Tim Taubert
3e13f9c368 Bug 1407179 - Use AssertIsOnBackgroundThread() in U2F and WebAuthn BackgroundParentImpls r=jcj
Summary: It seems like a good idea to call AssertIsOnBackgroundThread() in the WebAuthnTransactionParent and U2FTransactionParent methods. They should never be called on any other thread. (Other BPImpls are doing the same.)

Reviewers: jcj

Reviewed By: jcj

Bug #: 1407179

Differential Revision: https://phabricator.services.mozilla.com/D105
2017-10-10 18:31:30 +02:00
J.C. Jones
9f45608ca1 Bug 1405431 - Be more precise in WebAuthn signature verification assertion r=keeler
There's an intermittent which might be spurious because ASN.1 signatures might
sometimes be less than 70 bytes, but the actual floor is probably 68 (32 + 32
+ 4).

It's a sanity check, so I've adjusted it down and also am now emitting the
offending key bytes if this triggers again.

MozReview-Commit-ID: 1wwU9Q3BUPF

--HG--
extra : rebase_source : 2877deb770f8bf4bcf31dae40f75016892dc9d53
2017-10-04 11:21:18 -07:00
Tim Taubert
b811958ed2 Bug 1404556 - Support libc::ioctl() call on musl libc
Differential Revision: https://phabricator.services.mozilla.com/D96

--HG--
extra : amend_source : 7f7bd7003aa4f9f2dea4c00b67b5a1aaa7c8bd4f
2017-10-04 16:53:17 +02:00
J.C. Jones
cdb5d484f9 Bug 1401803 - WebAuthn types need to return ArrayBuffers r=keeler
The Web Authentication types, by spec, return ArrayBuffer objects, while we
were returning a concrete Uint8Array. This is a fairly straightforward change
to add functionality to CryptoBuffer and the WebIDL types, however it's a
substantial change to the tests.

Frankly, the tests just could use another pass of clean-up now, since this is
a lot of relative ugliness added in. I refactored tab_webauthn_success.html
pretty heavily -- since it was also fairly ugly to start -- but I decided to go
with a lighter touch on the other tests.

MozReview-Commit-ID: 9vb1wdLo3SI

--HG--
rename : dom/webauthn/tests/browser/frame_webauthn_success.html => dom/webauthn/tests/browser/tab_webauthn_success.html
extra : rebase_source : bd2bc326c6bb5e00929b14c7aae66eba335c0605
2017-09-20 07:32:07 -07:00
Chris Peterson
210c7f9690 Bug 870698 - Part 9: Replace Assign(NS_LITERAL_STRING("")) with AssignLiteral(u""). r=erahm
The NS_LITERAL_STRING macro creates a temporary nsLiteralString to encapsulate the char16_t string literal and its length, but AssignLiteral() can determine the char16_t string literal's length at compile-time without nsLiteralString.

MozReview-Commit-ID: 6vgQiU8zN3o

--HG--
extra : rebase_source : 1b536b92ef43f610db057ace6f108620e8d8b4d5
extra : source : 336e21386d5eeb16f1c9893c29377f23b67cc4b0
2017-09-06 01:43:13 -07:00
Tim Taubert
09acff8375 Bug 1400668 - Fix Android builds on a CLOSED TREE by adding the key_handles arg to the stub PlatformManager r=bustage 2017-09-21 16:24:44 +02:00
Tim Taubert
3d449e1af3 Bug 1400668 - Process key handle exclusion list when registering a token r=jcj 2017-09-21 16:09:53 +02:00
Tim Taubert
a7712cd24a Bug 1400940 - Fix WebAuthn deadlock when cancelling a request on tab switch r=jcj
This should be an easy solution. We can't stop the sign() or register()
runloop from calling the callback, so we need the callback to simply return
early when the U2FHIDTokenManager shuts down.

Bug #: 1400940

Differential Revision: https://phabricator.services.mozilla.com/D67
2017-09-19 18:00:39 +02:00
Tim Taubert
0ab9d21338 Bug 1400559 - [u2f-hid-rs] rustfmt followup r=me 2017-09-19 16:45:07 +02:00
Tim Taubert
076af4a6e0 Bug 1400559 - Move runloop code into its own crate r=jcj
The runloop seems like a good candidate for moving into its own crate.

I wasn't sure whether we want it under the Mozilla org on GitHub, so I pushed
it to ttaubert/rust-runloop for a start. Moving the repository to mozilla/*
is easy, and we'd just need to bump the crate version with the updated
repository, if you think we should.

Bug #: 1400559

Differential Revision: https://phabricator.services.mozilla.com/D62

--HG--
rename : dom/webauthn/u2f-hid-rs/src/runloop.rs => third_party/rust/runloop/src/lib.rs
2017-09-19 15:46:55 +02:00
Sebastian Hengst
18a3ca206d merge mozilla-central to mozilla-inbound. r=merge a=merge 2017-09-19 11:15:12 +02:00
Ralph Giles
d0ed1d24c4 Bug 1400927 - Fix u2f-hid-rs cross-compilation on macOS r=jcj
One cannot use #[cfg(target_os)] checks in build.rs.
Build scripts can be used to generate code so the target
is set to the host platform when they are compiled.

Having this setting exported an unconditional link
depencency whenever the host was macOS, which broke
cross-compiling, in particular for fennec builds
targetting Android.

Instead, declare the IOKit dependency on the `extern`
block which imports the symbol inside macOS-specific
code. That way final link still works, but the extra
dependency is only enabled when appropriate for the
final target, like the other platform-dependent code.
2017-09-18 17:29:24 -07:00
Tim Taubert
cd9cddcc94 Bug 1400513 - u2f-hid-rs: fuzzers should use a deterministic cmd byte r=jcj
Summary: We're currently using the thread_rng to derive a cmd byte for the U2F protocol fuzzers. That of course should rather be derived deterministically from the input handed to the fuzzing target.

Bug #: 1400513

Differential Revision: https://phabricator.services.mozilla.com/D61
2017-09-17 20:07:32 +02:00
Tim Taubert
efb7d369f2 Bug 1400662 - Prefer the USB token if the softtoken is enabled as well r=jcj
Bug #: 1400662

Differential Revision: https://phabricator.services.mozilla.com/D63
2017-09-17 20:14:54 +02:00
J.C. Jones
8b00bef83f Bug 1400019 - Don't assert on illegal WebAuthn algo names r=keeler
The algorithm names provided to the WebAuthn methods have to either be a
string, or (potentially) a WebCrypto object. Right now we only work with
strings, but there's no good reason to assert that, we can just let the
action fail.

This patch removes the assert to help out the fuzzing team.

MozReview-Commit-ID: 9dc8m0a2gZK

--HG--
extra : rebase_source : 649a7f4928679405fe445ac533eee2cfccaedd25
2017-09-14 18:37:34 -07:00
J.C. Jones
f699a8f77b Bug 1400066 - Gracefully handle unsupported platforms for U2F HID support r=ttaubert
FreeBSD isn't currently support for FIDO U2F support, similar to Android, so
this patch [1] from Jan Beich <jbeich@FreeBSD.org> treats Android and FreeBSD
the same. With luck, someone will add in the platform support for both, soon!

[1] https://github.com/jcjones/u2f-hid-rs/pull/44

MozReview-Commit-ID: DU7Rco2NLb3

--HG--
rename : dom/webauthn/u2f-hid-rs/src/android/mod.rs => dom/webauthn/u2f-hid-rs/src/stub/mod.rs
2017-09-14 18:11:47 -07:00
J.C. Jones
29d179c6cf Bug 1400080 - Remove impossible telemetry test from WebAuthn r=ttaubert
Now that there are actual hardware devices, this test can't be run: it
depended on there being a deliberately-erroring implementation of WebAuthn
which would instantly reject promises. Fortunately, this test was really more
a test that telemetry scalars work properly than really the functionality
of WebAuthn.

Sadly, I don't see any way to re-enable this test without adding a new test-
only pref to the tree, which doesn't seem worth it for the telemetry.

So this patch removes the offending test completely which was backed out in
https://hg.mozilla.org/integration/mozilla-inbound/rev/c115eec567a6 .

MozReview-Commit-ID: LiLuQHbPU1z
2017-09-14 19:17:52 -07:00
Tim Taubert
62ee484a0d Bug 1388851 - Follow-up to disable parts of browser_webauthn_telemetry.js r=bustage 2017-09-14 23:12:13 +02:00
Tim Taubert
e773e24ae5 Bug 1388851 - Implement U2FHIDTokenManager r=jcj,qdot,keeler 2017-08-09 21:24:50 +02:00
Tim Taubert
dd24dc77e0 Bug 1388843 - Part 1: Copy u2f-hid-rs into dom/webauthn/ r=gerv,qdot 2017-08-09 21:16:49 +02:00
J.C. Jones
554acaea86 Bug 1245527 - Remove NSS U2F SoftToken. r=ttaubert, r=jed
The nsIU2FToken and its implementors are no longer needed; the soft token was
re-implemented into dom/webauthn/U2FSoftTokenManager.cpp during the WebAuthn
implementation. When the dom/u2f/ code changed to the implementation from
WebAuthn, the old synchronous version became dead code.

This patch removes the dead code.

MozReview-Commit-ID: 2yDD0tccgZr

--HG--
extra : rebase_source : 0f14d8de8f62599a41c13aa4d8fc9cdbc1fd79c7
2017-09-05 12:32:42 -07:00
J.C. Jones
2afc1ad18b Bug 1245527 - Rewrite U2F.cpp to use U2FTokenManager. r=keeler, r=ttaubert
- This patch reworks the U2F module to asynchronously call U2FManager,
  which in turn handles constructing and managing the U2FTokenManager
  via IPC.
- Add U2FTransaction{Parent,Child} implementations to mirror similar ones for
  WebAuthn
- Rewrite all tests to compensate for U2F executing asynchronously now.
  - Used async tasks, used the manifest parameters for scheme, and generally
    made these cleaner.
- The mochitest "pref =" functionality from Bug 1328830 doesn't support Android
  yet, causing breakage on Android. Rework the tests to go back to the old way
  of using iframes to test U2F.


NOTE TO REVIEWERS:
 Since this is huge, I recommend the following:

 keeler - please review U2F.cpp/h, the tests, and the security-prefs.js. Most
          of the U2F logic is still in U2F.cpp like before, but there's been
          some reworking of how it is called.

 ttaubert - please review U2FManager, the Transaction classes, build changes,
            and the changes to nsGlobalWindow. All of these should be very
            similar to the WebAuthn code it's patterned off.


MozReview-Commit-ID: C1ZN2ch66Rm

--HG--
extra : rebase_source : 5a2c52b0340c13f471af5040b998eb7e661b1981
2017-09-11 12:56:59 -07:00
J.C. Jones
334836b1e7 Bug 1245527 - Use PWebAuthnTransactionParent superclass for U2FTokenManager. r=keeler
This is a change to permit interacting with the U2FTokenManager from
the dom/U2F context in addition to the dom/WebAuthn one.

MozReview-Commit-ID: BvP5BY2wVYi

--HG--
extra : rebase_source : 0ca9cb1e72cb688b901484ec6bf2602d15131478
2017-08-25 18:37:17 -07:00
J.C. Jones
7b1ab1a9a0 Bug 1381126: Resume requiring WebAuthn RP ID to be a Domain String r=keeler
In Bug 1380421 we reverted some behavior that required Web Authentication's
RP ID to be domain string to permit it to be an origin, too, for interop
testing. That is no longer needed, so this patch resumes enforcement that
RP ID be a domain string.

It also adds a needed test that the RP ID hash is calculated correctly.

MozReview-Commit-ID: 8dDjzo5kQKP

--HG--
extra : rebase_source : 65cd7b9f3a6ecfc58805daf102f33966c9b19b98
2017-09-11 09:06:28 -07:00
J.C. Jones
b3996e4339 Bug 1384623 - WebAuthn [SameObject] attributes must cache those objects r=qdot
Peter points out [1] that I made assumptions that [SameObject] would handle
caching at the JS-layer, but it does not. This bug is to cache those objects [2]
on the heap, and add tests that they are indeed the same.

[1] https://bugzilla.mozilla.org/show_bug.cgi?id=1382888#c6
[2] https://hg.mozilla.org/mozilla-central/rev/811510fdb51a

MozReview-Commit-ID: KQySNAOnyeE

--HG--
extra : rebase_source : 8422e9e8eafacc1071191a00d49bc85797571ebe
2017-07-26 10:03:17 -07:00
Tim Taubert
dbe7586a18 Bug 1380270 - Add dlopen() version of libudev-sys r=qdot,ted 2017-08-31 19:11:27 +02:00
Andrew McCreight
78807d8776 Bug 1391005 - Eliminate NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED. r=peterv
Replace it with NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION, because it
has been the same for a while.

MozReview-Commit-ID: 5agRGFyUry1

--HG--
extra : rebase_source : 5388c56b2f6905c6ef969150f0c5b77bf247624d
2017-08-29 16:02:48 -07:00