Closed
Bug 686149
Opened 15 years ago
Closed 8 years ago
have consumers pass the certificate chain to export to exportAsCMS (instead of attempting to build it itself)
Categories
(Core :: Security: PSM, defect, P1)
Core
Security: PSM
Tracking
()
RESOLVED
FIXED
mozilla62
| Tracking | Status | |
|---|---|---|
| firefox62 | --- | fixed |
People
(Reporter: briansmith, Assigned: keeler)
References
(Blocks 1 open bug)
Details
(Keywords: main-thread-io, Whiteboard: [psm-arch][psm-assigned])
Attachments
(1 file)
These methods on nsNSSCertificate cause certificate path validation to be done, so they must not be called on the main thread. I propose that we remove these methods from the scriptable nsIX509Cert* interfaces, so that JS code does not call them on the main thread. Also, all these functions should fail when called on the main thread.
GetUsagesArray
GetUsagesString
FormatUIStrings (calls GetUsagesString)
GetIsExtendedValidation
GetValidEVPolicyOid
VerifyForUsage
| Assignee | ||
Updated•10 years ago
|
Whiteboard: [psm-arch] → [psm-arch][psm-backlog]
| Assignee | ||
Updated•10 years ago
|
| Assignee | ||
Comment 1•8 years ago
|
||
I think as of bug 867473 the only problematic API here is exportAsCMS, which should be easy to fix. The only caller of it already has a certificate chain, so there's no sense in re-building it.
Assignee: nobody → dkeeler
Priority: P3 → P1
Summary: nsNSSCertificate does certificate path validation on the main thread, causing the main thread to block on IO → have consumers pass the certificate chain to export to exportAsCMS (instead of attempting to build it itself)
Whiteboard: [psm-arch][psm-backlog] → [psm-arch][psm-assigned]
| Comment hidden (mozreview-request) |
Comment 3•8 years ago
|
||
| mozreview-review | ||
Comment on attachment 8972682 [details]
bug 686149 - improve PKCS7 certificate export to not use legacy path building
https://reviewboard.mozilla.org/r/241222/#review247180
Looks good but another test would be great.
::: security/manager/ssl/nsIX509CertList.idl:50
(Diff revision 1)
> [notxpcom, noscript, must_use]
> nsNSSCertListPtr getCertList();
> +
> + /**
> + * Convert the list of certificates to a PKCS#7 SignedData structure.
> + * This is a misleading name, as the data is not actually signed.
Don't you want to chose another name if it's misleading? :) Maybe `asPKCS7SignedDataStructure`? Not sure if that's any better...
::: security/manager/ssl/nsNSSCertificate.cpp:958
(Diff revision 1)
> + != SECSuccess) {
> + MOZ_LOG(gPIPNSSLog, LogLevel::Debug,
> + ("nsNSSCertList::ToPKCS7SignedData - can't add cert"));
> + return NS_ERROR_FAILURE;
> + }
> + aContinue = true;
If I'm reading this right, `aContinue` is `true` when called from `ForEachCertificateInChain`. Since we stop on error that's fine but setting it to `true` seems unnecessary.
::: security/manager/ssl/nsNSSCertificate.cpp:983
(Diff revision 1)
> + ("nsNSSCertList::ToPKCS7SignedData - out of memory"));
> + return NS_ERROR_OUT_OF_MEMORY;
> + }
> +
> + SECItem certP7 = { siBuffer, nullptr, 0 };
> + NSSCMSEncoderContext* ecx = NSS_CMSEncoder_Start(cmsg.get(), nullptr, nullptr,
:( If only we wouldn't have to call this function...
::: security/manager/ssl/tests/unit/test_cert_chains.js:74
(Diff revision 1)
> + "PSpJVeFuSeiesvGMxk0O4ZEihPxSM4uR4xpCnPzz7LoFIzMELJv5i+cgLw4+6cINPkLjoCU" +
> + "db+AXSTur7THJaO75B44I2JjJfMfzgW1FwoWgXL/PQWRw+VY6OY1glqZOXzP+vfSja1Sogg" +
> + "piCzdPx7h1/SEEZov7zhCZXv1Cenx1njlpcj9wWEJMsyZczMNtiz5GkRrLaqCz9F8ah3Nvk" +
> + "vPAZ0oOqtxuQgMXK/c0OXJVKi0SCJsWqZDoZhCrS/dE9guxlseZqhSIMQAAAAAAAAA=";
> +
> + let certList = build_cert_chain(["default-ee", "test-ca"]);
I think we should have at least one other test that has only one cert in the chain. Maybe another one with a longer chain?
Attachment #8972682 -
Flags: review?(franziskuskiefer)
| Assignee | ||
Comment 4•8 years ago
|
||
| mozreview-review-reply | ||
Comment on attachment 8972682 [details]
bug 686149 - improve PKCS7 certificate export to not use legacy path building
https://reviewboard.mozilla.org/r/241222/#review247180
> Don't you want to chose another name if it's misleading? :) Maybe `asPKCS7SignedDataStructure`? Not sure if that's any better...
I changed it to `asPKCS7Blob` - thoughts?
> If I'm reading this right, `aContinue` is `true` when called from `ForEachCertificateInChain`. Since we stop on error that's fine but setting it to `true` seems unnecessary.
Ok - sounds good. I hadn't checked the documentation, and it seems to be phrased as a way to stop looping rather than a necessary thing to set to enable continuing looping.
> I think we should have at least one other test that has only one cert in the chain. Maybe another one with a longer chain?
Sounds good.
| Comment hidden (mozreview-request) |
Comment 6•8 years ago
|
||
| mozreview-review | ||
Comment on attachment 8972682 [details]
bug 686149 - improve PKCS7 certificate export to not use legacy path building
https://reviewboard.mozilla.org/r/241222/#review248124
Sorry for the delay.
Thanks for adding more tests :)
::: security/manager/ssl/nsIX509CertList.idl:54
(Diff revisions 1 - 2)
> - * Convert the list of certificates to a PKCS#7 SignedData structure.
> - * This is a misleading name, as the data is not actually signed.
> + * Encode the list of certificates as a PKCS#7 SignedData structure. No data
> + * is actually signed - this is merely a way of exporting a collection of
> + * certificates.
> */
> [must_use]
> - ACString asPKCS7SignedData();
> + ACString asPKCS7Blob();
Sounds better thanks! :)
Attachment #8972682 -
Flags: review?(franziskuskiefer) → review+
| Assignee | ||
Comment 7•8 years ago
|
||
Thanks! Try looks good: https://treeherder.mozilla.org/#/jobs?repo=try&revision=b14f2f9b1ea9d444c15a0928fdab9501c2d3cbd3
Pushed by dkeeler@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/3c65a2197ead
improve PKCS7 certificate export to not use legacy path building r=fkiefer
Comment 9•8 years ago
|
||
| bugherder | ||
Status: NEW → RESOLVED
Closed: 8 years ago
status-firefox62:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla62
You need to log in
before you can comment on or make changes to this bug.
Description
•