"JWK export of a symmetric key" test uses a malformed JsonWebKey object

RESOLVED FIXED in mozilla36

Status

()

Core
DOM: Security
RESOLVED FIXED
3 years ago
3 years ago

People

(Reporter: ggp, Assigned: ggp)

Tracking

unspecified
mozilla36
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment, 1 obsolete attachment)

(Assignee)

Description

3 years ago
It's missing the required kty field. This caused the binding layer to reject the object [1] when importing the key, and |mDataIsJwk| to be used uninitialized later in ImportSymmetricKeyTask::BeforeCrypto.

1- http://dxr.mozilla.org/mozilla-central/source/dom/crypto/WebCryptoTask.cpp#1282
(Assignee)

Comment 1

3 years ago
Created attachment 8510318 [details] [diff] [review]
Fix JsonWebKey object in test_WebCrypto_JWK

This patch properly initializes mDataIsJwk and fixes the JsonWebKey object. However,
a proper solution to this probably involves propagating the error from the binding
layer instead of swallowing it inside SetKeyData.
(Assignee)

Comment 2

3 years ago
Created attachment 8510391 [details] [diff] [review]
Fix JsonWebKey object in test_WebCrypto_JWK.

This updated version will also abort early when SetKeyData fails in the constructors
for Import*KeyTask.

Since SetKeyData(const CryptoBuffer &) was already setting mEarlyRv implicitly through
SetJwkFromKeyData, I made SetKeyData(JSContext*, JSHandle<JSObject*>) also set mEarlyRv
and the ctors return early when it indicates failure.
Attachment #8510318 - Attachment is obsolete: true
Attachment #8510391 - Flags: review?(rlb)
(Assignee)

Updated

3 years ago
Blocks: 762448
Attachment #8510391 - Flags: review?(rlb) → review+
(Assignee)

Comment 3

3 years ago
https://treeherder.mozilla.org/ui/#/jobs?repo=try&revision=345d0197ea50
Assignee: nobody → ggoncalves
(Assignee)

Updated

3 years ago
Keywords: checkin-needed
https://hg.mozilla.org/integration/mozilla-inbound/rev/299ebc930b9c
Keywords: checkin-needed
https://hg.mozilla.org/mozilla-central/rev/299ebc930b9c
Status: NEW → RESOLVED
Last Resolved: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla36
You need to log in before you can comment on or make changes to this bug.