Commit Graph

89 Commits

Author SHA1 Message Date
Simon Giesecke
d509701ccb Bug 1613985 - Use default for equivalent-to-default constructors/destructors in security. r=rrelyea
Differential Revision: https://phabricator.services.mozilla.com/D65499
2020-03-16 10:56:56 +00:00
Bogdan Tara
22b0fa7e80 Backed out 4 changesets (bug 1613985) for causing build bustages CLOSED TREE
Backed out changeset fba0caac746c (bug 1613985)
Backed out changeset 8605d7a19107 (bug 1613985)
Backed out changeset 41e858fbf235 (bug 1613985)
Backed out changeset 847433cf1e0a (bug 1613985)
2020-03-16 12:41:41 +02:00
Simon Giesecke
85538cb7b0 Bug 1613985 - Use default for equivalent-to-default constructors/destructors in security. r=rrelyea
Differential Revision: https://phabricator.services.mozilla.com/D65499
2020-03-16 09:57:45 +00:00
Kershaw Chang
e8dd95e27f Bug 1512471 - Introduce PVerifySSLServerCert for the certificate verification r=keeler,jld
Differential Revision: https://phabricator.services.mozilla.com/D50834
2020-02-28 10:58:56 +00:00
Dana Keeler
5fcd294814 bug 1412438 - add preference to disable HPKP by default r=jcj
As Chrome has removed support for the HPKP (HTTP Public Key Pinning) header,
continuing to support it in Firefox is a compatibility risk. This patch adds
the preference "security.cert_pinning.hpkp.enabled" and sets it to false by
default. As such, the platform will no longer process the HPKP header nor
consult any cached HPKP information for certificate pins.
Preloaded (statically-compiled) pins are still enabled in Firefox by default.
This patch also disables dynamically setting pins via our remote security
settings infrastructure, as it uses the same backend and represents similar
compatibility risk.

Differential Revision: https://phabricator.services.mozilla.com/D52773
2019-11-13 18:35:35 +00:00
Kevin Jacobs
77a40d0cff Bug 1575735 - Explicitly check key strength of TLS channel by setting authKeyBits earlier in SSL_AuthCertificate r=keeler
This patch provides Delegated Credential information (authKeyBits and signature scheme) to CertVerifier such that we can enforce a policy check and disallow weak keys in the Delegated Credential.

This information is not passed from http3 - adding this will be done in a separate bug.

Differential Revision: https://phabricator.services.mozilla.com/D47181
2019-11-07 22:13:43 +00:00
Sean Feng
175344503c Bug 1592355 - Convert certList to raw array for Pins verification r=keeler
Differential Revision: https://phabricator.services.mozilla.com/D50967
2019-10-31 23:56:32 +00:00
Dana Keeler
2206d67b1d bug 1063276 - include the peer cert chain from the TLS handshake when verifying server certificates r=kjacobs
Differential Revision: https://phabricator.services.mozilla.com/D50129
2019-10-24 22:48:40 +00:00
Kershaw Chang
8a51fe6d28 Bug 1560354 - Transform some nss types into gecko types. r=keeler,dragana
Differential Revision: https://phabricator.services.mozilla.com/D35566
2019-09-05 15:49:35 +00:00
arthur.iakab
4812983d4c Backed out changeset 5d42edca79d4 (bug 1560354) for causing mass failures on mozilla/Maybe.h:488 CLOSED TREE 2019-08-15 03:01:50 +03:00
Dragana Damjanovic
8167fae77d Bug 1560354 - Transform some nss types into gecko types. r=keeler
Differential Revision: https://phabricator.services.mozilla.com/D35566
2019-07-02 21:26:36 +00:00
Dana Keeler
46dcbaab8b bug 1564481 - reset HSTS/HPKP state to factory settings rather than storing knockout entries for preloaded sites r=jcj r=KevinJacobs
As originally implemented, nsISiteSecurityService.removeState allowed direct
access to remove HSTS state. It also provided the implementation for when the
browser encountered an HSTS header with "max-age=0". In bug 775370, it was
updated to store an entry that would override preloaded information when
processing such headers. However, this meant that the semantics of the direct
access API had changed. Preloaded information could be overridden if a user
invoked the "forget about this site" feature. This change fixes the public API
(and renames it to "resetState") so it actually behaves as its consumers expect.

Reviewers: jcj!, KevinJacobs!

Tags: #secure-revision

Bug #: 1564481

Differential Revision: https://phabricator.services.mozilla.com/D38108
2019-07-11 13:48:28 -07:00
Barret Rennie
d90b9bbfd1 Bug 1289211 - Rename InfallibleTArray to nsTArray in security/manager/ r=keeler
Differential Revision: https://phabricator.services.mozilla.com/D36967
2019-07-10 03:33:22 +00:00
Boris Zbarsky
ee739bd612 Bug 1558569. Stop using [array] in nsISiteSecurityService. r=keeler
Differential Revision: https://phabricator.services.mozilla.com/D34568
2019-06-11 21:23:21 +00:00
Dana Keeler
1d0f9a6c02 bug 1439002 - remove useless debug spew from nsSiteSecurityService r=erahm
Differential Revision: https://phabricator.services.mozilla.com/D25489
2019-04-01 17:07:20 +00:00
Sylvestre Ledru
e5a134f73a Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
# ignore-this-changeset
2018-11-30 11:46:48 +01:00
Dana Keeler
0b25db014f bug 1499882 - remove HSTS holepunch for chart.apis.google.com because it now has a valid certificate r=franziskus
Differential Revision: https://phabricator.services.mozilla.com/D11695
2018-11-13 08:14:06 +00:00
Dipen Patel
fbf2d8d5d9 Bug 1468222 Consolidate nsISSLStatus info nsITransportSecurityInfo r=Gijs,snorp,jcj,mcmanus,sfraser,keeler,baku,ato
Move all fields of nsISSLStatus to nsITransportSecurityProvider
Remove nsISSLStatus interface and definition
Update all code and test references to nsISSLStatus
Maintain ability to read in older version of serialized nsISSLStatus.  This
is verified with psm_DeserializeCert gtest.

Differential Revision: https://phabricator.services.mozilla.com/D3704
2018-09-11 00:07:30 +00:00
Csoregi Natalia
4c04e1f45b Backed out changeset bd8baf88f373 (bug 1468222) for test_security-info-parser.js failures. CLOSED TREE 2018-09-08 03:16:25 +03:00
Dipen Patel
8e9fd08fb5 Bug 1468222 Consolidate nsISSLStatus info nsITransportSecurityInfo r=snorp,ato,sfraser,keeler,baku,mcmanus,Gijs
Move all fields of nsISSLStatus to nsITransportSecurityProvider
Remove nsISSLStatus interface and definition
Update all code and test references to nsISSLStatus
Maintain ability to read in older version of serialized nsISSLStatus.  This
is verified with psm_DeserializeCert gtest.

Differential Revision: https://phabricator.services.mozilla.com/D3704
2018-09-07 22:50:17 +00:00
Kris Maglione
015e3a6c02 Bug 1484496: Part 4b - Add intrinsic type information to most nsSimpleEnumerators. r=froydnj
This allows JS callers to automatically get the correct types during
interation, without having to explicitly specify them.

Differential Revision: https://phabricator.services.mozilla.com/D3728
2018-08-18 21:06:32 -07:00
Emilio Cobos Álvarez
4b8b5e1717 Bug 1465585: Switch from mozilla::Move to std::move. r=froydnj
This was done automatically replacing:

  s/mozilla::Move/std::move/
  s/ Move(/ std::move(/
  s/(Move(/(std::move(/

Removing the 'using mozilla::Move;' lines.

And then with a few manual fixups, see the bug for the split series..

MozReview-Commit-ID: Jxze3adipUh
2018-06-01 10:45:27 +02:00
J.C. Jones
2ec376f4ef Bug 1434936 - Rework ChainHasValidPins to use nsNSSCertList r=keeler r=fkiefer
This commit reworks PublicKeyPinningService::ChainHasValidPins and
PublicKeyPinningService::EvalChain to use nsNSSCertList directly.  It also
updates nsSiteSecurityService::ProcessPKPHeader. This will be made more
efficient in Bug 1406854, where the call to VerifySSLServerCert gets replaced
with one to GetSucceededCertChain. (Such a change is premeature now because
before Bug 731478 lands this would lead to a session resumption regression
causing pins to not be set properly, which is triggered repeatedly in the
xpcshell tests.)

MozReview-Commit-ID: 1l186n1lXLH
2018-01-31 18:50:29 -07:00
Kate McKinley
400d720dc9 Bug 1424917 - Remove support for HSTS Priming. r=mayhemer, r=ckerschb
This patch removes support and tests for HSTS priming from the tree.
2018-01-10 11:07:00 -05:00
Tristan Bourvon
01cf3d8a39 Bug 1412646 - Initialize some uninitialized fields in security/manager/ r=keeler
MozReview-Commit-ID: HGj8xw5Uq6j
2017-10-31 11:04:40 +01:00
David Keeler
e53b8eabd4 bug 1400913 - back out the functionality changes from bug 1364159 (but keep the test) r=jcj
Bug 1364159 introduced an optimization that attempted to avoid reading from the
user's cached certificate database as much as possible when building a verified
certificate chain. Unfortunately this had the side-effect of not preferring root
certificates in path building, which can result in unnecessarily long chains
(which rather defeats the purpose, since it means more signature verifications).
This patch reverts the functionality changes from that bug but keeps the test
that was added (the test didn't directly test the functionality changes - it's
more of a check that path building will query the cached certificate db when
necessary).

MozReview-Commit-ID: I56THTLUytH
2017-09-18 10:28:58 -07:00
Eric Rahm
ff56fd077d Bug 1382001 - Part 2: Use a DAFSA for kSTSPreloadList. r=keeler
This switches the STS preload list over to a more compact representation by
using a DAFSA. `getHSTSPreloadList.js` is updated to output data in the gperf
format expected by `make_dafsa.py`. We then add a generated file that gets
created by pumping `nsSTSPreloadList.inc` through `make_dafsa.py`.

`nsSiteSecurityService` is updated to use the DAFSA which either returns -1
(kNotFound) if an entry is not present or (0, 1) indicating whether or not to
use subdomains.

`nsSTSPreloadList.inc` is an automated conversion to the new gperf-like format.
2017-08-11 14:12:04 -07:00
Wes Kocher
5662a0562f Backed out 3 changesets (bug 1382001) at developer's request a=backout
Backed out changeset 1fe47b777980 (bug 1382001)
Backed out changeset bd6770fadff3 (bug 1382001)
Backed out changeset 29353fb6613b (bug 1382001)

MozReview-Commit-ID: F4S2q5WAxe4
2017-08-10 18:03:05 -07:00
Eric Rahm
7c42f46fb4 Bug 1382001 - Part 2: Use a DAFSA for kSTSPreloadList. r=keeler
This switches the STS preload list over to a more compact representation by
using a DAFSA. `getHSTSPreloadList.js` is updated to output data in the gperf
format expected by `make_dafsa.py`. We then add a generated file that gets
created by pumping `nsSTSPreloadList.inc` through `make_dafsa.py`.

`nsSiteSecurityService` is updated to use the DAFSA which either returns -1
(kNotFound) if an entry is not present or (0, 1) indicating whether or not to
use subdomains.

`nsSTSPreloadList.inc` is an automated conversion to the new gperf-like format.
2017-08-10 17:29:11 -07:00
Kate McKinley
8335b9a82e Bug 1363546 - Store and report HSTS upgrade source r=francois,keeler,mayhemer p=francois
Add a field to the HSTS cache which indicates the source of the HSTS
entry if known, from the preload list, organically seen header, or HSTS
priming, or unknown otherwise. Also adds telemetry to collect the source
when upgrading in NS_ShouldSecureUpgrade.

MozReview-Commit-ID: 3IwyYe3Cn73
2017-05-23 15:31:37 -07:00
Cykesiopka
916e07dbb0 Bug 1368107 - Remove TransportSecurityInfo::GetHostNameRaw(). r=keeler
GetHostNameRaw() returns a char* string, which is less safe and ergonomic
compared to the Mozilla string classes. GetHostName() can be used instead.

MozReview-Commit-ID: GYvTnISNN35
2017-06-03 13:35:51 +08:00
David Keeler
91fd4bf7e6 bug 1364159 - potentially avoid calling CERT_CreateSubjectCertList in NSSCertDBTrustDomain::FindIssuer r=Cykesiopka,jcj
CERT_CreateSubjectCertList is not an inexpensive function call, since it
enumerates the certificate database (i.e. reads from disk a lot). If we're
verifying for a TLS handshake, however, we should already have in memory a
certificate chain sent by the peer (there are some cases where we won't, such as
session resumption (see bug 731478)). If we can, we should use those
certificates before falling back to calling CERT_CreateSubjectCertList.

MozReview-Commit-ID: ASjVGsELb1O
2017-05-11 16:41:12 -07:00
Cykesiopka
c5d04ff715 Bug 1174555 - Stop using PR_sscanf() in nsSiteSecurityService.cpp. r=keeler
While the uses of PR_sscanf() in PSM are safe, the function in general is
vulnerable to format string attacks, and so should be avoided.

This change removes the only uses of the function in PSM and moves to the more
obviously safe mozilla::Tokenizer.

MozReview-Commit-ID: J4BP6JTE1zI
2017-05-21 10:43:18 +08:00
Ehsan Akhgari
ca86a94c9f Bug 1347461 - Part 1: Add a C++ API for the list of DataStorage classes; r=keeler 2017-04-10 22:44:32 -04:00
Kate McKinley
5a9e9c0de4 Bug 1322044 - Only mark a subdomain cached when includeSubDomains is true r=ckerschb,keeler
MozReview-Commit-ID: 3lFkuLauyGg
2017-02-13 13:36:01 +09:00
Cykesiopka
16c5e5a31f Bug 1342737 - Avoid using nsCRT.h and nsCRTGlue.h in PSM. r=keeler
There are a few places where we can use the safer functionality provided by the
Mozilla string classes instead.

Also fixes Bug 1268657 (remove vestigial
TransportSecurityInfo::SetShortSecurityDescription declaration).

MozReview-Commit-ID: Cxv5B4bsDua
2017-03-28 22:57:15 +08:00
Cykesiopka
08d7df48c9 Bug 1338897 - Avoid using NSS Base64 functions in PSM. r=keeler
The NSS Base64 functions are less safe and convenient to use than the XPCOM ones.
They're also an unnecessary dependency on NSS.

The NSS Base64 functions behave slightly differently than the XPCOM ones:
1. ATOB_ConvertAsciiToItem() / NSSBase64_DecodeBuffer() silently ignore invalid
   characters like CRLF, space and so on. Base64Decode() will return an error
   if these characters are encountered.
2. BTOA_DataToAscii() will produce output that has CRLF inserted every 64
   characters. Base64Encode() doesn't do this.

For the reasons listed below, no unexpected compatibility issues should arise:
1. AppSignatureVerification.cpp already filters out CRLF and spaces for Manifest
   and Signature values before decoding.
2. ExtendedValidation.cpp is only given what should be valid hard-coded input to
   decode.
3. ContentSignatureVerifier.cpp already splits on CRLF for when it needs to
   decode PEM certs. Spaces shouldn't be likely.
   For Content-Signature header verification, examination of real input to a
   running instance of Firefox suggests CRLF and spaces will not be present in
   the header to decode.
4. nsCryptoHash.cpp encode is affected, but we actually don't want the CRLF
   behaviour.
5. nsDataSignatureVerifier.cpp decode is affected, but we add whitespace
   stripping to maintain backwards compatibility.
6. nsKeygenHandler.cpp encode is affected, but the previous CRLF behaviour was
   arguably a bug, since neither WHATWG or W3C specs specified this.

MozReview-Commit-ID: IWMFxqVZMeX
2017-03-17 23:31:40 +08:00
Jonathan Hao
b00c3630c6 Bug 1323644 - Isolate the HSTS and HPKP storage by first party domain (PSM) r=Cykesiopka,keeler
MozReview-Commit-ID: HhFFqtpBNjO
2017-02-14 10:29:10 +08:00
Tom Tromey
a4b717ab39 Bug 1060419 - make log_print use Printf.h, r=froydnj
MozReview-Commit-ID: BIZ1GQEZ1vs
2016-12-15 20:16:31 -07:00
Jonathan Hao
ad6b0a5da2 Bug 1336867 - Remove unsafeProcessHeader and isSecureHost in nsISiteSecurityService r=keeler,mgoodwin,past 2017-02-08 11:17:29 +08:00
Phil Ringnalda
aa86a2ebe8 Backed out 2 changesets (bug 1336867) for (at least) eslint failures
CLOSED TREE

Backed out changeset 0a4f283638cb (bug 1336867)
Backed out changeset 837766805d75 (bug 1336867)
2017-02-09 19:02:32 -08:00
Jonathan Hao
e2b3d6ff9d Bug 1336867 - Remove unsafeProcessHeader and isSecureHost in nsISiteSecurityService r=keeler,mgoodwin,past 2017-02-08 11:17:29 +08:00
Jonathan Hao
93c01bcfa3 Bug 1115712 - make DataStorage for HPKP and HSTS enumerable via xpcom. r=Cykesiopka,keeler
MozReview-Commit-ID: GEOtuTAiPIX
2017-01-12 14:58:04 +08:00
Cykesiopka
d59b8b6b39 Bug 1329237 - Avoid non-smart string IDL types in nsISiteSecurityService.idl. r=keeler
Smart string IDL types give us nsA[C]String in C++ code, which is safer than
raw char strings.

MozReview-Commit-ID: KJ3Z4qK9i61
2017-01-14 13:10:06 +08:00
Cykesiopka
c29834836b Bug 1325107 - Stop using NS_NOTREACHED() in PSM. r=mgoodwin
MOZ_ASSERT_UNREACHABLE() is basically equivalent to NS_NOTREACHED().
PSM already uses MOZ_ASSERT_UNREACHABLE() for new code, so there's no need to use
NS_NOTREACHED() as well.

MozReview-Commit-ID: 9k2z9a1oIqe
2017-01-02 14:11:51 +08:00
Cykesiopka
2ea082a548 Bug 1325107 - Stop using NS_ASSERTION() in PSM. r=mgoodwin
MOZ_ASSERT() is basically equivalent to NS_ASSERTION().
PSM already uses MOZ_ASSERT() for new code, so there's no need to use
NS_ASSERTION() as well.

MozReview-Commit-ID: JHDsbDkYvHf
2017-01-02 14:11:39 +08:00
Mark Goodwin
1060ddf643 Bug 1321780 - Modify SiteSecurityService to allow dynamic STS preloads rr=?keeler r=keeler
MozReview-Commit-ID: 2a75179pIH4
2016-12-20 07:16:41 +00:00
Kate McKinley
de1ba42221 Bug 1310955 - Fix nsSiteSecurityService cache retrieval r=ckerschb,keeler
MozReview-Commit-ID: 55DpKrqcL1x
2016-10-18 20:09:15 +09:00
Cykesiopka
1eefbe0772 Bug 1296317 - Stop calling PR_SetError() in VerifyCert() and VerifySSLServerCert(). r=keeler
The PR_SetError() + PR_GetError() pattern currently used is error prone and
unnecessary. The functions involved can instead return mozilla::pkix::Result,
which is equally expressive and more robust.

MozReview-Commit-ID: Hkd39eqTvds
2016-10-10 15:44:41 +08:00
Mark Goodwin
86a7158f5b Bug 1306471 - Modify the SiteSecurityService to allow dynamic pin preloads r=keeler
MozReview-Commit-ID: JLbJcMuvcyI
2016-10-06 11:00:43 +01:00