Commit Graph
263 Commits
Author SHA1 Message Date
Daniel Holbert a0b8609dc7 Bug 2043111: Use MakeRefPtr to do allocation for various RefPtr variables in security/. r=nss-reviewers,jschanck
Differential Revision: https://phabricator.services.mozilla.com/D302965
2026-05-28 21:20:32 +00:00
serge-sans-paille c7033d0d67 Bug 2030936 - Activate clang-tidy's performance-for-range-copy check r=sylvestre,tschuster,media-playback-reviewers,webrtc-reviewers,firefox-style-system-reviewers,layout-reviewers,janerik,padenot,bwc,emilio,alwu
And apply the auto-fix from the linter. Note that we exclude RefPtr from
the check as it plays badly with our CanRunScriptChecker's linter.

We also explicitly silent warning for loops on nsTObserverArray, as their
iterator is designed to support invalidation.

Differential Revision: https://phabricator.services.mozilla.com/D293497
2026-05-20 06:51:32 +00:00
Sylvestre Ledru aadbb1de55 Bug 2036400 - Initialize uninitialized scalar fields in security to fix Coverity uninitialized-scalar defects r=firefox-static-analysis-reviewers,keeler,sergesanspaille
Differential Revision: https://phabricator.services.mozilla.com/D298155
2026-05-11 16:04:17 +00:00
Dana Keeler 8f4ea8c986 Bug 2028728 - remove extraneous psm::SyncRunnableBase implementation r=jschanck
Differential Revision: https://phabricator.services.mozilla.com/D291873
2026-04-06 17:46:34 +00:00
Sylvestre Ledru 5db00ce70c Bug 2023419 - Remove Emacs/Vim modelines from security/ r=emilio
replaced by .editorconfig
# ignore-this-changeset

Differential Revision: https://phabricator.services.mozilla.com/D287866
2026-03-17 12:10:18 +00:00
serge-sans-paille c1ab9b472a Bug 1996908 - Remove unused mfbt inclusion in security/** r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D270365
2025-10-29 07:59:57 +00:00
serge-sans-paille 7662b3abdc Bug 1994397 - Remove obsolete Unused.h header r=emilio,tschuster,geckoview-reviewers,extension-reviewers,application-update-reviewers,media-playback-reviewers,webrtc-reviewers,cookie-reviewers,places-reviewers,profiler-reviewers,win-reviewers,dom-storage-reviewers,permissions-reviewers,profiles-reviewers,toolkit-telemetry-reviewers,firefox-style-system-reviewers,firefox-svg-reviewers,layout-reviewers,timhuang,gstoll,TravisLong,bytesized,mstange,karlt,robwu,pehrsons,m_kato,jari,jhirsch
It is replaced by a standard-conforming cast to (void) which is
understood the same by the compiler.

In some cases this could be replaced by `[[maybe_unused]]` but for
expression whose value is ignored, this requires storing to a temporary
variable first, so not going that way.

One notable change is that marking an object of type already_AddRefed as
unused used to implicitly leak memory. This is now made explicit.

Most of the heavy lifting was done through:

    $ git grep -l '\<Unused\> <<' | xargs sed -i -e 's/Unused << /(void)/g'
    $ git grep -l mozilla/Unused.h | xargs sed -i -e '/mozilla\/Unused.h/ d'

Differential Revision: https://phabricator.services.mozilla.com/D268706
2025-10-21 19:36:01 +00:00
Dana Keeler 71a99f8c27 Bug 1994034 - make TLS handshake certificates always available r=jschanck,necko-reviewers,extension-reviewers,kershaw,robwu,dom-worker-reviewers,edenchuang
This patch renames nsITransportSecurityInfo.failedCertChain to
handshakeCertificates and makes the property always available (after the
handshake has completed, that is).

Differential Revision: https://phabricator.services.mozilla.com/D268467
2025-10-21 17:05:01 +00:00
Cristina Horotan 8a1b1970b7 Revert "Bug 1994397 - Remove obsolete Unused.h header r=emilio,tschuster,geckoview-reviewers,extension-reviewers,application-update-reviewers,media-playback-reviewers,webrtc-reviewers,cookie-reviewers,places-reviewers,profiler-reviewers,win-reviewers,dom-storage-reviewers,permissions-reviewers,profiles-reviewers,toolkit-telemetry-reviewers,firefox-style-system-reviewers,firefox-svg-reviewers,layout-reviewers,timhuang,gstoll,TravisLong,bytesized,mstange,karlt,robwu,pehrsons,m_kato,jari,jhirsch" for causing Gtest failures on AlreadyAddRefed.h
This reverts commit e98adca292.
2025-10-21 16:16:29 +00:00
serge-sans-paille e98adca292 Bug 1994397 - Remove obsolete Unused.h header r=emilio,tschuster,geckoview-reviewers,extension-reviewers,application-update-reviewers,media-playback-reviewers,webrtc-reviewers,cookie-reviewers,places-reviewers,profiler-reviewers,win-reviewers,dom-storage-reviewers,permissions-reviewers,profiles-reviewers,toolkit-telemetry-reviewers,firefox-style-system-reviewers,firefox-svg-reviewers,layout-reviewers,timhuang,gstoll,TravisLong,bytesized,mstange,karlt,robwu,pehrsons,m_kato,jari,jhirsch
It is replaced by a standard-conforming cast to (void) which is
understood the same by the compiler.

In some cases this could be replaced by `[[maybe_unused]]` but for
expression whose value is ignored, this requires storing to a temporary
variable first, so not going that way.

One notable change is that marking an object of type already_AddRefed as
unused used to implicitly leak memory. This is now made explicit.

Most of the heavy lifting was done through:

    $ git grep -l '\<Unused\> <<' | xargs sed -i -e 's/Unused << /(void)/g'
    $ git grep -l mozilla/Unused.h | xargs sed -i -e '/mozilla\/Unused.h/ d'

Differential Revision: https://phabricator.services.mozilla.com/D268706
2025-10-21 15:05:17 +00:00
Cristina Horotan aab924e90d Revert "Bug 1994397 - Remove obsolete Unused.h header r=emilio,tschuster,geckoview-reviewers,extension-reviewers,application-update-reviewers,media-playback-reviewers,webrtc-reviewers,cookie-reviewers,places-reviewers,profiler-reviewers,win-reviewers,dom-storage-reviewers,permissions-reviewers,profiles-reviewers,toolkit-telemetry-reviewers,firefox-style-system-reviewers,firefox-svg-reviewers,layout-reviewers,timhuang,gstoll,TravisLong,bytesized,mstange,karlt,robwu,pehrsons,m_kato,jari,jhirsch" for causing build bustage at nsBrowserApp.cpp
This reverts commit fd0ffa193c.
2025-10-21 10:44:13 +00:00
serge-sans-paille fd0ffa193c Bug 1994397 - Remove obsolete Unused.h header r=emilio,tschuster,geckoview-reviewers,extension-reviewers,application-update-reviewers,media-playback-reviewers,webrtc-reviewers,cookie-reviewers,places-reviewers,profiler-reviewers,win-reviewers,dom-storage-reviewers,permissions-reviewers,profiles-reviewers,toolkit-telemetry-reviewers,firefox-style-system-reviewers,firefox-svg-reviewers,layout-reviewers,timhuang,gstoll,TravisLong,bytesized,mstange,karlt,robwu,pehrsons,m_kato,jari,jhirsch
It is replaced by a standard-conforming cast to (void) which is
understood the same by the compiler.

In some cases this could be replaced by `[[maybe_unused]]` but for
expression whose value is ignored, this requires storing to a temporary
variable first, so not going that way.

One notable change is that marking an object of type already_AddRefed as
unused used to implicitly leak memory. This is now made explicit.

Most of the heavy lifting was done through:

    $ git grep -l '\<Unused\> <<' | xargs sed -i -e 's/Unused << /(void)/g'
    $ git grep -l mozilla/Unused.h | xargs sed -i -e '/mozilla\/Unused.h/ d'

Differential Revision: https://phabricator.services.mozilla.com/D268706
2025-10-21 09:44:11 +00:00
Narcis Beleuzu e1e6bbb1c9 Revert "Bug 1994397 - Remove obsolete Unused.h header r=emilio,tschuster,geckoview-reviewers,extension-reviewers,application-update-reviewers,media-playback-reviewers,webrtc-reviewers,cookie-reviewers,places-reviewers,profiler-reviewers,win-reviewers,dom-storage-reviewers,permissions-reviewers,profiles-reviewers,toolkit-telemetry-reviewers,firefox-style-system-reviewers,firefox-svg-reviewers,layout-reviewers,timhuang,gstoll,TravisLong,bytesized,mstange,karlt,robwu,pehrsons,m_kato,jari,jhirsch" for causing bustages on Document.cpp
This reverts commit b23c15e927.
2025-10-21 06:34:58 +00:00
serge-sans-paille b23c15e927 Bug 1994397 - Remove obsolete Unused.h header r=emilio,tschuster,geckoview-reviewers,extension-reviewers,application-update-reviewers,media-playback-reviewers,webrtc-reviewers,cookie-reviewers,places-reviewers,profiler-reviewers,win-reviewers,dom-storage-reviewers,permissions-reviewers,profiles-reviewers,toolkit-telemetry-reviewers,firefox-style-system-reviewers,firefox-svg-reviewers,layout-reviewers,timhuang,gstoll,TravisLong,bytesized,mstange,karlt,robwu,pehrsons,m_kato,jari,jhirsch
It is replaced by a standard-conforming cast to (void) which is
understood the same by the compiler.

In some cases this could be replaced by `[[maybe_unused]]` but for
expression whose value is ignored, this requires storing to a temporary
variable first, so not going that way.

One notable change is that marking an object of type already_AddRefed as
unused used to implicitly leak memory. This is now made explicit.

Most of the heavy lifting was done through:

    $ git grep -l '\<Unused\> <<' | xargs sed -i -e 's/Unused << /(void)/g'
    $ git grep -l mozilla/Unused.h | xargs sed -i -e '/mozilla\/Unused.h/ d'

Differential Revision: https://phabricator.services.mozilla.com/D268706
2025-10-21 06:01:36 +00:00
Cristina Horotan ea45be222f Revert "Bug 1994034 - make TLS handshake certificates always available r=jschanck,necko-reviewers,extension-reviewers,kershaw,robwu" for causing mochitest failures on test_cache_padding.html
This reverts commit ed038d6760.
2025-10-14 23:25:55 +00:00
Dana Keeler ed038d6760 Bug 1994034 - make TLS handshake certificates always available r=jschanck,necko-reviewers,extension-reviewers,kershaw,robwu
This patch renames nsITransportSecurityInfo.failedCertChain to
handshakeCertificates and makes the property always available (after the
handshake has completed, that is).

Differential Revision: https://phabricator.services.mozilla.com/D268467
2025-10-14 21:46:05 +00:00
John M. Schanck 52d1756fb8 Bug 1985598 - add a metric for the number of SCTs from tiled logs per connection. r=keeler
Differential Revision: https://phabricator.services.mozilla.com/D262838
2025-08-27 20:18:47 +00:00
Dana Keeler 8f1371ad9d Bug 1977473 - remove remnants of Symantec distrust machinery r=jschanck
The last remaining Symantec roots affected by the distrust plan were removed in
bug 1855318 and bug 1618402, so the rest of the machinery can go as well now.

Differential Revision: https://phabricator.services.mozilla.com/D257736
2025-07-18 21:41:22 +00:00
Dana Keeler 6038cd1311 Bug 1953221 - don't accept SCTs with a timestamp after the distrustAfter date for the root r=jschanck
Differential Revision: https://phabricator.services.mozilla.com/D256720
2025-07-11 04:54:11 +00:00
Dana Keeler 6fb22513f4 Bug 1972339 - convert CA telemetry ID generation to python script r=jschanck,frontend-codestyle-reviewers
This patch replaces the xpcshell script that generated CA telemetry IDs with
an implementation in python that directly reads the certdata.txt file that
provides the data for the builtin roots module.

This patch also revs the telemetry metrics cert.validation_success_by_ca,
cert_pinning.failures_by_ca, and ssl.ct_policy_non_compliant_connections_by_ca,
replacing them each with ..._by_ca_2 versions.

Additionally, this patch retires the legacy histograms previously mirrored by
the replaced metrics.

Differential Revision: https://phabricator.services.mozilla.com/D254758
2025-06-26 19:40:15 +00:00
Dana Keeler b107e8a71f Bug 1951494 - ensure socket control is released on the socket thread r=jschanck
Differential Revision: https://phabricator.services.mozilla.com/D240234
2025-03-05 21:26:23 +00:00
Dana Keeler 5e3c261ad8 Bug 1486551 - turn cert revocation error pages into (non-overridable) certificate error pages r=jschanck,fluent-reviewers,webidl,bolsson,smaug
SEC_ERROR_REVOKED_CERTIFICATE is a certificate error, not a TLS protocol error.
This patch updates the categorization of this error while maintaining the
property that it cannot be overridden. This has the benefit of making it
possible to show more diagnostic information in the error page, which this
patch also adds.

Differential Revision: https://phabricator.services.mozilla.com/D239220
2025-02-27 22:12:46 +00:00
Florian Quèze 8783ebc2dd Bug 1944631 - Migrate histograms to use Glean APIs for remaining SSL_* histograms, r=chutten.
Differential Revision: https://phabricator.services.mozilla.com/D235673
2025-02-03 19:01:07 +00:00
Florian Quèze fb6c19a946 Bug 1944631 - Migrate histograms to use Glean APIs for CERT_*, r=chutten.
Differential Revision: https://phabricator.services.mozilla.com/D235664
2025-02-03 19:01:06 +00:00
Florian Quèze 9609e47f62 Bug 1879329 - script generated replacement of the GleanMetrics.h includes, r=chutten,valentin,media-playback-reviewers,cookie-reviewers,anti-tracking-reviewers,profiler-reviewers,win-reviewers,rkraesig,emz,aabh,padenot.
Differential Revision: https://phabricator.services.mozilla.com/D234744
2025-01-21 11:21:45 +00:00
Dana Keeler db7f45c160 Bug 1921525 - enforce certificate transparency in nightly r=jschanck,fluent-reviewers,bolsson,Gijs
Differential Revision: https://phabricator.services.mozilla.com/D224530
2024-10-15 22:11:05 +00:00
Dana Keeler c554bb14cd Bug 1915008 - leak mResultTask if dispatch fails in certificate verification r=jschanck
Differential Revision: https://phabricator.services.mozilla.com/D221381
2024-09-09 20:55:21 +00:00
Dana Keeler c1bb34fb95 Bug 1913794 - migrate some PSM timing telemetry histograms to glean timing distributions r=jschanck
This migrates SSL_SUCCESFUL_CERT_VALIDATION_TIME_MOZILLAPKIX,
SSL_INITIAL_FAILED_CERT_VALIDATION_TIME_MOZILLAPKIX, and
CERT_VALIDATION_HTTP_REQUEST_{CANCELED,SUCCEEDED,FAILED}_TIME to glean timing
distributions.

The certificate validation time metrics have had their precision increased from
milliseconds to microseconds.

Differential Revision: https://phabricator.services.mozilla.com/D219535
2024-08-19 22:03:24 +00:00
Dana Keeler fe7cd39cc1 Bug 1912120 - implement updated certificate transparency policy r=jschanck
This updates the certificate transparency policy based on Chrome's policy,
found at https://googlechrome.github.io/CertificateTransparency/ct_policy.html.
Both it and the Chrome policy are similar to the Apple policy, found at
https://support.apple.com/en-us/103214.

Essentially, the policy can be satisfied in two ways, depending on the source
of the collected SCTs.
For embedded SCTs, at least one must be from a log that was Admissible
(Qualified, Usable, or ReadOnly) at the time of the check. There must be SCTs
from N distinct logs that were Admissible or Retired at the time of the check,
where N depends on the lifetime of the certificate. If the certificate lifetime
is less than or equal to 180 days, N is 2. Otherwise, N is 3. Among these SCTs,
at least two must be issued from distinct log operators.
For SCTs delivered via the TLS handshake or an OCSP response, at least two must
be from a log that was Admissible at the time of the check. Among these SCTs,
at least two must be issued from distinct log operators.

Differential Revision: https://phabricator.services.mozilla.com/D218800
2024-08-12 19:41:58 +00:00
Dana Keeler e9d3686298 Bug 1911005 - certificate transparency: note log states and timestamps r=jschanck
This patch uses the log state information in the known CT log list to
differentiate qualified, usable, and readonly (collectively now referred to as
"admissible") logs from retired logs. This patch also takes the opportunity to
update the language in the implementation from "disqualified" to "retired" to
match the current terminology from the source data.

Differential Revision: https://phabricator.services.mozilla.com/D218266
2024-08-05 18:36:23 +00:00
Noemi Erli 7478e8c57c Backed out changeset 3026b1b62d03 (bug 1911005) for causing bustages in CTPolicyEnforcer.cpp CLOSED TREE 2024-08-03 03:18:16 +03:00
Dana Keeler 87db63d458 Bug 1911005 - certificate transparency: note log states and timestamps r=jschanck
This patch uses the log state information in the known CT log list to
differentiate qualified, usable, and readonly (collectively now referred to as
"admissible") logs from retired logs. This patch also takes the opportunity to
update the language in the implementation from "disqualified" to "retired" to
match the current terminology from the source data.

Differential Revision: https://phabricator.services.mozilla.com/D218266
2024-08-02 23:13:18 +00:00
Noemi Erli c6e790d73f Backed out changeset 25bb41b1999f (bug 1911005) for causing build bustage in CTPolicyEnforcer.cpp CLOSED TREE 2024-08-03 00:50:01 +03:00
Dana Keeler f6095d90a7 Bug 1911005 - certificate transparency: note log states and timestamps r=jschanck
This patch uses the log state information in the known CT log list to
differentiate qualified, usable, and readonly (collectively now referred to as
"admissible") logs from retired logs. This patch also takes the opportunity to
update the language in the implementation from "disqualified" to "retired" to
match the current terminology from the source data.

Differential Revision: https://phabricator.services.mozilla.com/D218266
2024-08-02 20:31:27 +00:00
Dana Keeler 81ad6ed345 Bug 1909978 - rev root CA telemetry probes and regenerate CA telemetry IDs r=jschanck
To ensure all root CA telemetry IDs fit in the buckets allocated to each
histogram, this patch removes and replaces the following probes:

CERT_VALIDATION_SUCCESS_BY_CA
CERT_PINNING_FAILURES_BY_CA
SSL_CT_POLICY_NON_COMPLIANT_CONNECTIONS_BY_CA

with

CERT_VALIDATION_SUCCESS_BY_CA_2
CERT_PINNING_FAILURES_BY_CA_2
SSL_CT_POLICY_NON_COMPLIANT_CONNECTIONS_BY_CA_2

while re-generating CA IDs from scratch (which will now not exceed the number
of allocated buckets due to CA removals).

This takes the opportunity to remove SSL_CT_POLICY_COMPLIANT_CONNECTIONS_BY_CA
because it is essentially the difference between CERT_VALIDATION_SUCCESS_BY_CA
and SSL_CT_POLICY_NON_COMPLIANT_CONNECTIONS_BY_CA, and provides no additional
insight.

Differential Revision: https://phabricator.services.mozilla.com/D217768
2024-07-26 00:02:55 +00:00
John Schanck eb46843f81 Bug 1899431 - Use SSL_PeerCertificateChainDER in SSLServerCertVerification. r=keeler
Differential Revision: https://phabricator.services.mozilla.com/D211944
2024-07-18 16:53:57 +00:00
Dana Keeler 18dfb975cf Bug 1905955 - remove SharedSSLState r=jschanck
Differential Revision: https://phabricator.services.mozilla.com/D215533
2024-07-18 00:56:21 +00:00
Dana Keeler ca58819efa Bug 1905955 - remove some unnecessary OCSP/SCT pref state from SharedSSLState r=jschanck,necko-reviewers,kershaw
Differential Revision: https://phabricator.services.mozilla.com/D215526
2024-07-18 00:56:19 +00:00
Stanca Serban 20105841d9 Backed out changeset 23e9c0a1cf66 (bug 1899431) for causing build bustages. CLOSED TREE 2024-07-18 02:24:22 +03:00
John Schanck 6a1b78549d Bug 1899431 - Use SSL_PeerCertificateChainDER in SSLServerCertVerification. r=keeler
Differential Revision: https://phabricator.services.mozilla.com/D211944
2024-07-17 22:02:24 +00:00
Dana Keeler 6287dcea34 Bug 1842872 - stop caching intermediate certificates from TLS connections r=djackson
Differential Revision: https://phabricator.services.mozilla.com/D216341
2024-07-12 16:13:52 +00:00
Dana Keeler 455f7ff49b Bug 1900132 - note when a certificate with a domain mismatch error came from a built-in root r=jschanck
Differential Revision: https://phabricator.services.mozilla.com/D212485
2024-06-05 23:58:02 +00:00
Dana Keeler a5814edff6 Bug 1900132 - streamline PVerifySSLServerCert protocol r=jschanck
Previously the PVerifySSLServerCert protocol consisted of two functions: one to
call when certificate verification succeeded, and another to call upon failure.
This was unnecessary, as the code before and after this protocol didn't have
the same split. This patch unifies the protocol to better match the surrounding
code. It also takes the opportunity to make use of some IPC helpers to
serialize enums rather than manually casting to and from basic integer types.

Differential Revision: https://phabricator.services.mozilla.com/D212594
2024-06-05 23:58:02 +00:00
Jens Stutte b2219166ec Bug 1891936 - Have explicit grace timeout settings for the SSL Cert thread pool. r=jschanck
Differential Revision: https://phabricator.services.mozilla.com/D209196
2024-06-01 09:05:55 +00:00
Jens Stutte 53e1705e16 Bug 1891664 - Have a grace timeout before shutting down excess idle threads. r=xpcom-reviewers,necko-reviewers,dom-storage-reviewers,nika,janv,jesup#!xpcom-reviewers
Have idleThreadGraceTimeout and idleThreadMaximumTimeout instead of just idleThreadTimeout.
Clarify that idleThreadMaximumTimeout is only affecting allowed idle threads.
Make idle threads end only after at minimum idleThreadGraceTimeout even if they are in excess.
Remove the idleThreadTimeoutRegressive setting.

Introduce a "most recently used" priority for notifying idle threads to
avoid excessive round-robin through all available idle threads.
The management of the linked list has constant time, adding thus only
minimal overhead wrt to the previous wasIdle flags we had.

As a side effect (and coming from the investigations in bug 1891732) to
some extent this can help to improve the "logical thread affinity",
together with trying to keep events dispatched with NS_DISPATCH_AT_END
on the dispatching thread as much as possible, which should help
TaskQueue a lot with affinity.

Differential Revision: https://phabricator.services.mozilla.com/D209884
2024-06-01 09:05:53 +00:00
Randell Jesup 38265e615a Bug 1894047: Error handling for SSLServerCertVerification r=jschanck
Differential Revision: https://phabricator.services.mozilla.com/D209263
2024-05-16 13:40:49 +00:00
Dana Keeler 5943c7322e Bug 1876435 - gather telemetry on the sources of issuer certificates r=jschanck
Differential Revision: https://phabricator.services.mozilla.com/D199599
2024-01-29 18:28:00 +00:00
Dana Keeler b9e81fc08c Bug 1862062 - remove expired SSL_CT_POLICY_COMPLIANCE_OF_EV_CERTS telemetry probe r=jschanck
Differential Revision: https://phabricator.services.mozilla.com/D192399
2023-11-08 21:37:55 +00:00
Cosmin Sabou 827327e6b9 Backed out 5 changesets (bug 1862062) for causing xpcshell failures on test_content_signing.js. CLOSED TREE
Backed out changeset dcc224a798ba (bug 1862062)
Backed out changeset 8d2222109dd9 (bug 1862062)
Backed out changeset 13e730e6e684 (bug 1862062)
Backed out changeset 8c73f748ca55 (bug 1862062)
Backed out changeset 2a321dff5c82 (bug 1862062)
2023-11-02 23:22:42 +02:00
Dana Keeler 4c8126dcb9 Bug 1862062 - remove expired SSL_CT_POLICY_COMPLIANCE_OF_EV_CERTS telemetry probe r=jschanck
Differential Revision: https://phabricator.services.mozilla.com/D192399
2023-11-02 19:43:34 +00:00