Commit Graph

152 Commits

Author SHA1 Message Date
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
J.C. Jones
e5ca3874f4 Bug 1392366 - WebAuthn must use the WebCrypto SHA-256 algorithm identifier r=keeler
WD-05 changed the "hashAlg" parameter of the CollectedClientData definition
from using an internally-defined "S256" string to identify the sha256 digest
to the definition in WebCrypto [1]. This only appears once, hard-coded in
WebAuthn (since U2F only supports SHA-256), so we need to change that one
instance.

[1] https://www.w3.org/TR/WebCryptoAPI/#sha-registration

MozReview-Commit-ID: 8de2CIGBBGA

--HG--
extra : rebase_source : e54c0d1f3f9551be48c3a72444edf62c45c647c4
2017-08-21 12:06:15 -07:00
J.C. Jones
95d83ac876 Bug 1387820 - WebAuthn WD-05 Get Assertion Data Fix r=keeler
The WebAuthn WD-05 specification's Get Assertion method defines the returned
AuthenticatorAssertionResponse as providing ClientData, AuthenticatorData, and
the Signature from the Authenticator. Our implementation is incorrectly setting
AuthenticatorData and Signature:

AuthenticatorData as a structure is intended to mirror the structure from
the AuthenticatorData [1] section of the Attestation CBOR Object [2] in the
MakeCredential method, which we weren't doing _at all_. This is clarified in
the editor's draft of the specification, soon to be WD-06.

Signature for U2F Authenticators is defined as the "attestation signature", [3]
which is under-specified and we assumed would be the raw output from the U2F
Authenticator [4]. This should instead be the raw ANSI X9.62 signature with no
additional bytes. [5]

[1] https://www.w3.org/TR/2017/WD-webauthn-20170505/#sec-authenticator-data
[2] https://www.w3.org/TR/2017/WD-webauthn-20170505/#sec-attestation-data
[3] https://www.w3.org/TR/2017/WD-webauthn-20170505/#fido-u2f-attestation
[4] https://lists.w3.org/Archives/Public/public-webauthn/2017Aug/0078.html
[5] https://bugzilla.mozilla.org/show_bug.cgi?id=1387820#c4

MozReview-Commit-ID: DTIOILfS4pK

--HG--
extra : rebase_source : 996c10b2f0359b34f45cf370bb8483c2dc9d3b6e
2017-08-09 20:05:23 -07:00
Wes Kocher
cff9e9b197 Merge m-c to autoland, a=merge
MozReview-Commit-ID: 2YvHbITn9w3
2017-08-10 18:25:34 -07:00
Tim Taubert
72cca79ea8 Bug 1388853 - Fix timeouts in WebAuthnManager::MakeCredential() r=jcj 2017-08-09 21:26:49 +02:00
J.C. Jones
b491193ac3 Bug 1383799 - Cancel WebAuthn operations on tab-switch r=ttaubert
WebAuthn operations that are in-flight with authenticators must be cancelled
when switching tabs.

There's an Issue [1] opened with the WebAuthn spec for this already, but the
language is _not_ in spec. Still, it's necessary for security, spec or not.

This also matches how Chromium handles U2F operations during a tab switch.

[1] https://github.com/w3c/webauthn/issues/316

MozReview-Commit-ID: 6Qh9oC4pqys

--HG--
extra : rebase_source : ad1665b8140f74b1291f17994285e6146c4ec468
2017-08-04 12:34:18 -07:00
J.C. Jones
28cc1969ee Bug 1265472 - Add Telemetry to Web Authentication r=francois,keeler datareview=francois
This patch intends to obtain a 1) rough sense of the percentage of telemetry
population using Web Authentication over time, and 2) whether or not the
Authentication request was successful or errored out as a scalar. It also tracks
3) how long it takes for requests to complete as a histogram.

It counts Register (enrollment) and Sign (login) separately as we would
anticipate there being far, far more Sign uses than Register.

MozReview-Commit-ID: 8DFyKAG8XJw

--HG--
extra : rebase_source : 0c168b32b995ffffda804538d2b92009d4dc38c5
2017-08-09 12:22:48 -07:00
Tim Taubert
9dfa878543 Bug 1385313 - Use MozPromiseRequestHolders in U2FTokenManager r=jcj 2017-07-28 17:11:03 +02:00
Tim Taubert
0aee684c17 Bug 1385274 - Don't try to resolve WebAuthnManager::mPBackgroundCreationPromise twice r=jcj 2017-07-28 15:53:42 +02:00
J.C. Jones
b24d631e4c Bug 1385008: WebAuthn CollectedClientData.Origin must be RP ID r=keeler
The WebAuthn WD-05 version of the specification defines the Origin field [1]
of the CollectedClientData as being set to the RP ID [2][3].

Note there is some ambiguity in the specification, as [1] says
CollectedClientData.Origin is the document's origin, while the
algorithms [2] and [3] set it to RP ID.

I'm going to stick with the algorithm's definition for this patch; it's
simple to revert when we move to WD-06 (Bug 1384776).

[1] https://www.w3.org/TR/webauthn/#dom-collectedclientdata-origin
[2] https://www.w3.org/TR/webauthn/#createCredential
[3] https://www.w3.org/TR/webauthn/#getAssertion

MozReview-Commit-ID: LW918sIg5wH

--HG--
extra : rebase_source : 799f5fa8878614c45d0def07d01d6c1c0c6e9824
2017-07-27 10:27:53 -07:00
Carsten "Tomcat" Book
cad2e55095 Backed out changeset 674770e65a4f (bug 1265472) for memory leaks in browser_webauthn_telemetry.js 2017-07-26 07:56:38 +02:00
J.C. Jones
1b29ab6da2 Bug 1265472 - Add Telemetry to Web Authentication r=francois,keeler datareview=francois
This patch intends to obtain a 1) rough sense of the percentage of telemetry
population using Web Authentication over time, and 2) whether or not the
Authentication request was successful or errored out as a scalar. It also tracks
3) how long it takes for requests to complete as a histogram.

It counts Register (enrollment) and Sign (login) separately as we would
anticipate there being far, far more Sign uses than Register.

MozReview-Commit-ID: 8DFyKAG8XJw

--HG--
extra : rebase_source : c93eeac7a978a1d1c4b08ff1e18e2548b1045ced
2017-07-21 15:23:09 -07:00
J.C. Jones
860e263cc7 Bug 1384307 - Set WebAuthn PublicKeyCredential's "id" and "type" fields r=keeler
The Web Authentication PublicKeyCredential object has two fields currently
unpopulated which, to be spec-compliant, must be set. These fields duplicate
available data.

  [PublicKeyCredential.id] must be set to the base64url encoding with omitted
  padding of whatever data is in "rawId".

  [PublicKeyCredential.type] must be the literal "public-key".

MozReview-Commit-ID: L6wPYpZdD8A

--HG--
extra : rebase_source : 3ca83598b70f99f4d60f303d113e875046268669
2017-07-25 15:03:59 -07:00
J.C. Jones
7a3ee03404 Bug 1380529 - Only permit "ES256" as pubkey type for WebAuthn (3/3) r=ttaubert
Web Authentication uses JWK algorithm names (ES256) instead of WebCrypto names
(such as P-256). There are other JWK algorithm names, but our current U2F-backed
implementation only can support ES256 anyway, as that's all that FIDO U2F
devices understand. This patch limits us to the name ES256 for the "alg"
parameter.

MozReview-Commit-ID: 3V5DMzVzPad

--HG--
extra : rebase_source : 4fcf797ca0edc49f143333cc24aa51071cf719f5
2017-07-14 09:57:52 -07:00
J.C. Jones
3987ef311b Bug 1380529 - Use CBOR for the Create Credential WebAuthn call (2/3) r=ttaubert
The WebAuthn Create Credential method should encode its results using CBOR;
this patch changes to that format.

The CBOR formats for the U2F data are specified in [1][2]

The attestation data format is in [3]

The high-level layout is in [4]

[1] https://w3c.github.io/webauthn/#generating-an-attestation-object
[2] https://w3c.github.io/webauthn/#fido-u2f-attestation
[3] https://w3c.github.io/webauthn/#sec-attestation-data
[4] https://w3c.github.io/webauthn/#sctn-attestation

MozReview-Commit-ID: BYoFCJSxlLt

--HG--
extra : rebase_source : 190cb5f128659c7a947645abbc172c8aa39e4d40
2017-07-13 18:12:50 -07:00
J.C. Jones
91d5522630 Bug 1380529 - Add a CBOR library for WebAuthn (1/3) r=ttaubert
Web Authentication's WD-05 specification moves to using (CBOR) Concise Binary
Object Representation to transmit the binary data... most of it. This lands a
subset of the Apache 2-licensed "CBOR C++" serialization library [1] into
webauthn's path.

It does not add any code to use this library; see patch 2/3.

[1] https://github.com/naphaso/cbor-cpp/

MozReview-Commit-ID: Ktj9TgdqElk

--HG--
extra : rebase_source : e36c956ef62be3ea1a3b6cbc8e3d6df2626c15b1
2017-07-13 18:12:57 -07:00
Wes Kocher
ee45f814bb Merge m-c to autoland, a=merge
MozReview-Commit-ID: GOb2bgdUd36
2017-07-14 17:27:36 -07:00
Tim Taubert
4d50b6bd73 Bug 1380954 - Forward WebAuthnTransactionInfo::TimeoutMS() to U2F*TokenManagers r=jcj
The U2FSoftTokenManager is a synchronous implementation and thus didn't need a
timeout so far. We need it for the U2FHIDTokenManager though to let user
interaction timeout properly.

Thus, add a timeout argument to the methods required by the U2FTokenTransport
interface and forward that to the token manager implementations.
2017-07-14 19:27:53 +02:00
J.C. Jones
de0d023921 Bug 1380421 - Update test to handle origin RP IDs, too (2/2) r=keeler
This adjusts tests to also check origin-based RP IDs, for interop
purposes. When we officially move up to WD-06, we'll want to remove these.


MozReview-Commit-ID: FJRg7vxZIcN

--HG--
extra : rebase_source : 6b89ef1ec5f8f6312bc00740b171540dd2a111cf
2017-07-14 13:49:45 -07:00
J.C. Jones
b7eeb68241 Bug 1380421 - Handle URIs for RP IDs (1/2) r=keeler
A recent fixup commit [1] changed "RP ID" fields in WebAuthn to be domain
strings rather than origins, which matches the current editor's draft of
Web Authentication. Unfortunately, this is contrary to the interop WD-05,
which requires they be origins.

We should be tolerant of origins for now, and in the follow-on Bug 1381126
we'll remove this tolerance once we get past initial WD-05 interop.

[1] https://hg.mozilla.org/mozilla-central/rev/e173fd86d931

MozReview-Commit-ID: Cz2KaHvOIHz

--HG--
extra : rebase_source : eafac0cbab324c566a7ae64004f85258ca3ba805
2017-07-14 13:44:00 -07:00
Sebastian Hengst
6cab3753eb merge mozilla-central to mozilla-inbound. r=merge a=merge 2017-10-17 11:48:30 +02:00
Tim Taubert
382ba57162 Bug 1409135 - Cleanup and rearrange {WebAuthn,U2F}Manager.h r=jcj
Summary:
Both files declare a few methods as public that we can make private. Let's
seize the chance to rearrange declarations such that they reflect the message
model better.

Reviewers: jcj

Reviewed By: jcj

Bug #: 1409135

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

--HG--
extra : amend_source : 8f7a9d92ec81253847c44d92c71ea00cc8753bd1
2017-10-17 11:31:30 +02:00
Tim Taubert
f7e1c16e21 Bug 1409116 - Rename {WebAuthn,U2F}TransactionParent::Cancel message to Abort r=jcj
Summary:
We currently allow sending a "Cancel" message from the child to abort a running
transaction, e.g. when the user switches away from the currently active tab.

We have a message with the same name "Cancel" sent by the parent when the
transaction is aborted due to failure somewhere in the token manager.

This patch renames abort messages from the parent to "Abort" to clarify the
purpose of the message.

Reviewers: jcj

Reviewed By: jcj

Bug #: 1409116

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

--HG--
extra : amend_source : ee6767965ad928033eb23b258aacf54bbaf57d2d
2017-10-17 11:30:55 +02:00
Tim Taubert
aac46d1b3e Bug 1379580 - U2FTokenTransport promises should resolve to U2F data buffers r=qDot 2017-07-11 11:09:08 +02:00
J.C. Jones
8440e22c50 Bug 1329764 - Call IsRegistrableDomainSuffixOfOrEqualTo for WebAuthn r=keeler
nsHTMLDocument included IsRegistrableDomainSuffixOfOrEqualTo() to facilitate
some use cases in Web Authentication, and this patch adds support to our
implementation. The general idea is to permit relaxing some of the same-origin
policy for single-sign-on type approaches, while restricting other uses. [1]

[1] https://w3c.github.io/webauthn/#rp-id

MozReview-Commit-ID: BP74OYvcwBJ

--HG--
extra : rebase_source : 94b62f9063de129dc30c4457578b50088a3c92e0
2017-07-07 13:32:31 -07:00
J.C. Jones
ce493e08c1 Bug 1329764 - WebAuthn's RP IDs must be domain strings r=keeler
The spec for WebAuthn defines "RP ID" as a "valid domain string" [1], whereas we
were using an origin string (with the scheme and whatnot). This patch corrects
the default rpId strings (when not overriden) to be domain strings.

[1] https://w3c.github.io/webauthn/#rp-id

MozReview-Commit-ID: 2p1cEQDa2FV

--HG--
extra : rebase_source : 8be13b8e88abb409e15c1bf9142f18d786699504
2017-07-07 13:30:57 -07:00
Tim Taubert
daf6324bec Bug 1378762 - Remove 'aSignature' argument from U2FTokenTransport::Register() r=qDot,jcj 2017-07-06 14:44:56 +02:00
Tim Taubert
c3833cf06b Bug 1375847 - Add skeleton U2FHIDTokenManager r=qDot
This patch adds a skeleton U2FHIDTokenManager that returns
NS_ERROR_NOT_IMPLEMENTED for ::Register() and ::Sign().

This will help test calling into the Rust library and make it easier to
implement the full USB HID transport.
2017-06-23 15:48:50 +02:00
Tim Taubert
fa3483fd1d Bug 1375828 - U2FTokenTransport::Register() and ::Sign() should return promises r=qDot 2017-06-23 12:36:32 +02:00
Bill McCloskey
f115503a0b Bug 1372405 - Provide names for all runnables in the tree (r=froydnj)
MozReview-Commit-ID: DKR6ROiHRS7
2017-06-26 14:19:58 -07:00
Tim Taubert
907f818103 Bug 1375744 - Add U2FTokenTransport::Cancel() to abort requests on HW devices r=qDot
This patch adds a Cancel() method to the U2FTokenTransport interface so that
we can forward request cancellations to the actual token manager implementation.
The current softtoken doesn't need that as it processes API calls synchronously,
USB HID tokens however need a cancellation mechanism.

The SendRequestCancel() call has been removed from WebAuthnManager::Cancel() as
we're currently only calling this method either when the chrome process
cancels the request (and then we don't need to send it back again) or the
content process fails to process the data after a request was fulfilled and
thus there's nothing to cancel. We will touch this again later when the UI
cancels requests on tab switch and similar user actions.
2017-06-23 21:04:38 +02:00
Tim Taubert
237ab99f6b Bug 1375512 - Don't require a U2F*TokenManager to expose IsRegistered() r=qDot 2017-06-23 04:50:31 +02:00
Tim Taubert
d22430064c Bug 1375450 - Remove unused U2FTokenManager::PrefPromise r=qDot 2017-06-23 04:49:44 +02:00
Carsten "Tomcat" Book
8a1350b5a6 Backed out changeset 4f6302a98ae4 (bug 1372405)
--HG--
extra : rebase_source : 41632f3158e88e692809731394a683d065a73dfb
2017-06-21 13:59:26 +02:00
Bill McCloskey
6b3e84ed5f Bug 1372405 - Provide names for all runnables in the tree (r=froydnj)
MozReview-Commit-ID: DKR6ROiHRS7
2017-06-20 21:44:11 -07:00
Carsten "Tomcat" Book
ea1b86680c Backed out changeset 9846de3bd954 (bug 1372405)
--HG--
extra : rebase_source : 5d4a48e8ec394c329994689d938d2a6e9b2752b0
2017-06-20 08:27:02 +02:00
Bill McCloskey
4592152411 Bug 1372405 - Provide names for all runnables in the tree (r=froydnj)
MozReview-Commit-ID: DKR6ROiHRS7
2017-06-19 22:25:47 -07:00
Bill McCloskey
0767e31489 Bug 1372736 - Avoid using AbstractThread for non-media MozPromises (r=bkelly)
MozReview-Commit-ID: BBi0pK4DXxf
2017-06-15 20:16:25 -07:00
Bill McCloskey
c85ab6308c Bug 1366072 - Change promises to take nsISerialEventTarget instead of AbstractThread (r=jwwang)
MozReview-Commit-ID: 4azUhSB6whu
2017-06-13 14:51:01 -07:00
David Keeler
838ea1425f bug 1332681 - part 4/4 - convert authentication.getAssertion to credentials.get r=jcj,qdot
MozReview-Commit-ID: 13EqlQVQApx

--HG--
extra : rebase_source : 5790d61619e4d4a0d4039b9379bcf06169bd762f
2017-05-23 14:55:10 -07:00
David Keeler
abac00aea3 bug 1332681 - part 3/4 - convert authentication.makeCredential to credentials.create r=jcj,qdot
MozReview-Commit-ID: 1xfsQqGCEcl

--HG--
rename : dom/webauthn/WebAuthentication.cpp => dom/credentialmanagement/CredentialsContainer.cpp
rename : dom/webauthn/WebAuthentication.h => dom/credentialmanagement/CredentialsContainer.h
extra : rebase_source : d92546a7f6a3780c6ec8790dfabb23a9ea29efbe
2017-05-22 17:09:49 -07:00
David Keeler
0ecb59e4a9 bug 1332681 - part 2/4 - authentication.getAssertion: return a PublicKeyCredential instead of a WebAuthnAssertion r=jcj,qdot
MozReview-Commit-ID: 72p9lvhQISe

--HG--
rename : dom/webauthn/WebAuthnAssertion.cpp => dom/webauthn/AuthenticatorAssertionResponse.cpp
rename : dom/webauthn/WebAuthnAssertion.h => dom/webauthn/AuthenticatorAssertionResponse.h
extra : rebase_source : f5e77b0a71556764b58ba7822a5716bee5c47d99
2017-05-22 13:03:58 -07:00
David Keeler
07f967118b bug 1332681 - part 1/4 - authentication.makeCredential: return a PublicKeyCredential instead of a ScopedCredentialInfo r=jcj,qdot
(This is part of updating WebAuthn to Working Draft 5.)

MozReview-Commit-ID: 7o5yvtijo1P

--HG--
rename : dom/webauthn/WebAuthnAttestation.cpp => dom/webauthn/AuthenticatorResponse.cpp
rename : dom/webauthn/WebAuthnAttestation.h => dom/webauthn/AuthenticatorResponse.h
rename : dom/webauthn/ScopedCredentialInfo.cpp => dom/webauthn/PublicKeyCredential.cpp
rename : dom/webauthn/ScopedCredentialInfo.h => dom/webauthn/PublicKeyCredential.h
extra : rebase_source : 89633847ed85c75f1f277d040f6a6c86b73687a3
2017-05-16 17:07:01 -07:00
Axel Nennker
9738486c01 Bug 1364991 - Make U2FTokenManager use const where possible r=qdot
The U2F Soft Token, due to its usage of NSS, has to have const values be
marked non-const - but no such limitation should exist for other implementations
of U2F, so this patch moves the const_cast-ing from the U2FTokenManager-level
down to the U2FSoftTokenManager, where it is actually necessary.

Credit to Axel Nennker for this patch.

MozReview-Commit-ID: Kw6zfTDI3GL

--HG--
extra : rebase_source : 90e31e2da9e021043509653a476ddaae03078e55
2017-05-22 16:40:29 -07:00
Kyle Machulis
a3738835c9 Bug 1323339 - Modify WebAuthn mochitests to work with IPC API; r=jcj r=baku
Change tests to run serially with async API, since order is no longer
enforced by the IPC protocol being synchronous.

MozReview-Commit-ID: 9BtnsVhDvPS
2017-05-09 13:21:24 -07:00
Kyle Machulis
00a81563a5 Bug 1323339 - Add U2FSoftToken Manager; r=baku r=jcj
Takes functionality from NSSU2FToken/NSSU2FTokenRemote classes, and
moves it into a U2FSoftToken class. Leaves
NSSU2FToken/NSSU2FTokenRemote classes intact so as not to break U2F
API code (to be ported to async IPC in bug 1354330).

MozReview-Commit-ID: El2MCcYUrtE
2017-05-09 13:21:23 -07:00
Kyle Machulis
4f61492d32 Bug 1323339 - Add U2FTokenManager class and support IPC Parent classes; r=jcj r=baku
Takes functionality that was in the WebAuthentication class that now
needs to be handled by the parent process, and moves it to the
U2FTokenManager singleton class. U2FTokenManager is created on the
PBackground thread during the first WebAuthn transaction, and manages
hardware access and transaction management for the lifetime of the
browser session. Patch also adds parent classes for WebAuthn IPC
protocol.

MozReview-Commit-ID: EnhgUTPdlMZ
2017-05-09 13:21:23 -07:00
Kyle Machulis
e0c24a5abd Bug 1323339 - Add WebAuthnManager and support IPC Child classes; r=jcj r=baku
Takes functionality once in the WebAuthentication DOM class that needs
to be handled by the content process, and moves it to a
singleton (per-content-process) manager class. This allows the
WebAuthn API to centralize management of transactions and IPC
channels. Patch also creates the child (content-process) classes for
WebAuthn IPC channels.

MozReview-Commit-ID: 6ju2LK8lvNR
2017-05-09 13:21:23 -07:00
Kyle Machulis
b0260e8176 Bug 1323339 - Turn WebAuthenication into a simple DOM class that passes to WebAuthnManager; r=jcj r=baku
Before the patch set for bug 1323339, WebAuthentication was managing
almost all content-side functionality for the WebAuthn API. This
would've made it difficult to support IPC, transaction interruption,
etc... This patch strips most of the functionality out of
WebAuthentication. The functionality will be moved to the
WebAuthnManager class in the next patch, for sake of review coherence.

MozReview-Commit-ID: 9Uup8NhLVBj
2017-05-09 13:21:23 -07:00
Kyle Machulis
8ad053f05d Bug 1323339 - Cleanup of WebAuthn DOM classes; r=jcj r=baku
Changes WebAuthn DOM classes to take nsPIDOMInnerWindow* as parent
pointer, instead of WebAuthentication* pointer.

MozReview-Commit-ID: aK3k9Cc7hv
2017-05-09 13:21:23 -07:00
Kyle Machulis
2945d52cd5 Bug 1323339 - IPDL for WebAuthn Protocol and PBackground additions; r=jcj r=baku
MozReview-Commit-ID: 3WzTVZEdjia
2017-05-09 13:21:23 -07:00
J.C. Jones
a51561a1c4 Bug 1260318 - Scope U2F Soft Tokens to a single AppID r=qdot,rbarnes
This change includes the FIDO "App ID" as part of the function used to generate
the wrapping key used in the NSS-based U2F soft token, cryptographically binding
the "Key Handle" to the site that Key Handle is intended for.

This is a breaking change with existing registered U2F keys, but since our soft
token is hidden behind a pref, it does not attempt to be backward-compatible.

- Updated for rbarnes' and qdot's reviews comments. Thanks!
- Made more strict in size restrictions, and added a version field
  to help us be this strict.
- Bugfix for an early unprotected buffer use (Thanks again rbarnes!)
- Fix a sneaky memory leak re: CryptoBuffer.ToSECItem

MozReview-Commit-ID: Jf6gNPauT4Y

--HG--
extra : rebase_source : 4ff5898e93e4a0a75576e5e54035a1cb6dd952d7
2017-02-01 15:21:04 -07:00
Iris Hsiao
940ee4003b Backed out changeset 713c0a78c2c1 (bug 1260318) for leak issue 2017-03-08 14:01:56 +08:00
J.C. Jones
8effd5c124 Bug 1260318 - Scope U2F Soft Tokens to a single AppID r=qdot,rbarnes
This change includes the FIDO "App ID" as part of the function used to generate
the wrapping key used in the NSS-based U2F soft token, cryptographically binding
the "Key Handle" to the site that Key Handle is intended for.

This is a breaking change with existing registered U2F keys, but since our soft
token is hidden behind a pref, it does not attempt to be backward-compatible.

- Updated for rbarnes' and qdot's reviews comments. Thanks!
- Made more strict in size restrictions, and added a version field
  to help us be this strict.
- Bugfix for an early unprotected buffer use (Thanks again rbarnes!)

MozReview-Commit-ID: Jf6gNPauT4Y

--HG--
extra : rebase_source : 52d10287d10698292e1480e04f580f6f8b4847cb
2017-02-01 15:21:04 -07:00
Joel Maher
c203f27827 Bug 1335099 - add BUG_COMPONENT to many dom/* subdir files. r=overholt
MozReview-Commit-ID: CyIIs98hnUI
2017-02-06 09:45:55 -05:00
Sebastian Hengst
7225ec6170 Backed out changeset 9a332af74af5 (bug 1335099) for build bustage (moz.build rule matches no files). r=backout on a CLOSED TREE 2017-02-06 16:21:20 +01:00
Joel Maher
60e61eed48 Bug 1335099 - add BUG_COMPONENT to many dom/* subdir files. r=overholt
MozReview-Commit-ID: CyIIs98hnUI
2017-02-06 09:45:55 -05:00
Bevis Tseng
07d4b0dc79 Bug 1314833 - Part 4: Factor out AbstractThread::MainThread() used in U2F. r=billm
MozReview-Commit-ID: 7TcbTE9wab0

--HG--
extra : rebase_source : b2c090e6e154d170f185d0f59ecfb456c074d94c
2016-11-22 14:19:06 +08:00