Commit Graph
58 Commits
Author SHA1 Message Date
John M. Schanck 541f2db91a Bug 2008597 - remove mechanism for retrying failed connections without ML-KEM. r=keeler,necko-reviewers,valentin
Differential Revision: https://phabricator.services.mozilla.com/D291349
2026-04-01 20:39:21 +00:00
Alexandru Marc 90c25fd2fd Revert "Bug 2008597 - remove mechanism for retrying failed connections without ML-KEM. r=keeler,necko-reviewers,valentin" for causing xpcshell failures @ test_http3_kyber.js
This reverts commit cca7a0c7b0.
2026-04-01 17:52:22 +00:00
John M. Schanck cca7a0c7b0 Bug 2008597 - remove mechanism for retrying failed connections without ML-KEM. r=keeler,necko-reviewers,valentin
Differential Revision: https://phabricator.services.mozilla.com/D291349
2026-04-01 16:07:08 +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
Kershaw Chang f59666fc4f Bug 2012485 - Increase ssl_tokens_cache_records_per_entry and allow selecting a token from the pool until NSS finds a usable one, r=necko-reviewers,valentin
Differential Revision: https://phabricator.services.mozilla.com/D282342
2026-02-18 02:11:20 +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
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
Valentin Gosu 53aba3edf2 Bug 1983426 - Initialize UsedPrivateDNS in CommonSocketControl constructor r=keeler
The race here is caused by the fact that CommonSocketControl::mUsedPrivateDNS was
initialized to false in the constructor, and then set to
`SetUsedPrivateDNS(GetProviderFlags() & nsISocketProvider::USED_PRIVATE_DNS);`
in SetCertVerificationResult.

However, these flags don't change, so we can just initialize it in the constructor.

Differential Revision: https://phabricator.services.mozilla.com/D267401
2025-10-06 09:12:59 +00:00
Dana Keeler 0fde5344f9 Bug 1971027 - avoid token dialogs for speculative connections with remembered client auth cert decisions r=jschanck
This patch reworks client auth certificate selection somewhat in that PSM will
now do basically no work to look for, select, or ask the user to select a
certificate until the server's certificate has been verified and the connection
has been claimed.

Differential Revision: https://phabricator.services.mozilla.com/D258082
2025-07-24 19:29:42 +00:00
Dana Keeler b1e99b2e7e Bug 1945985 - rsclientcerts: only search for new objects when the platform is actually looking for client auth certs r=jschanck
Previously, rsclientcerts would have to heuristically determine when the
platform was searching for client auth certificates in order to avoid
re-querying the underlying certificate and key sources every time any part of
NSS looked for PKCS#11 objects. This heuristic was imprecise and constrained
the rest of the implementation that handles client auth certificates.

Now that osclientcerts and ipcclientcerts (the consumers of rsclientcerts) are
part of libxul, they can directly check if gecko is searching for client auth
certificates and update their list of known certificates and keys accordingly.

In theory, multiple simultaneous connections could cause multiple updates of
the known list of certificates and keys, so to prevent unnecessary costly work,
rsclientcerts will still only refresh its list of objects every 2 seconds (down
from 3 seconds previously).

Differential Revision: https://phabricator.services.mozilla.com/D237108
2025-02-18 19:26:59 +00:00
Goloman Adrian 6401a3359e Backed out changeset a33ba0f8cc24 (bug 1945985) for causing build bustages @NSSSocketControl.cpp. 2025-02-15 03:25:24 +02:00
Dana Keeler c9b55d61a6 Bug 1945985 - rsclientcerts: only search for new objects when the platform is actually looking for client auth certs r=jschanck
Previously, rsclientcerts would have to heuristically determine when the
platform was searching for client auth certificates in order to avoid
re-querying the underlying certificate and key sources every time any part of
NSS looked for PKCS#11 objects. This heuristic was imprecise and constrained
the rest of the implementation that handles client auth certificates.

Now that osclientcerts and ipcclientcerts (the consumers of rsclientcerts) are
part of libxul, they can directly check if gecko is searching for client auth
certificates and update their list of known certificates and keys accordingly.

In theory, multiple simultaneous connections could cause multiple updates of
the known list of certificates and keys, so to prevent unnecessary costly work,
rsclientcerts will still only refresh its list of objects every 2 seconds (down
from 3 seconds previously).

Differential Revision: https://phabricator.services.mozilla.com/D237108
2025-02-15 00:56:00 +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 ddcce47833 Bug 1944631 - Migrate histograms to use Glean APIs for SSL_HANDSHAKE_*, r=chutten.
Differential Revision: https://phabricator.services.mozilla.com/D235665
2025-02-03 19:01:06 +00:00
Florian Quèze 6203c6c238 Bug 1879329 - add the missing includes, r=chutten,necko-reviewers,cookie-reviewers,valentin.
Differential Revision: https://phabricator.services.mozilla.com/D234757
2025-01-21 11:21:45 +00:00
serge-sans-paille 262f78c07f Bug 1922838 - Replace ArrayLength, ArrayEnd and MOZ_ARRAY_LENGTH by standard alternative r=glandium,necko-reviewers,jgilbert,application-update-reviewers,media-playback-reviewers,credential-management-reviewers,anti-tracking-reviewers,places-reviewers,profiler-reviewers,win-reviewers,dom-storage-reviewers,bytesized,janv,dimi,daisuke,karlt,gstoll,canaltinova,timhuang
Namely std::size, std::end and std::size. This drops C support for
MOZ_ARRAY_LENGTH but it wasn't used anyway.

Differential Revision: https://phabricator.services.mozilla.com/D224611
2024-10-28 08:21:19 +00:00
Alexandru Marc a5eb905bf4 Backed out changeset d92f391b3b0c (bug 1922838) for backing out bug 1915351 2024-10-25 16:42:33 +03:00
serge-sans-paille 07101ac24d Bug 1922838 - Replace ArrayLength, ArrayEnd and MOZ_ARRAY_LENGTH by standard alternative r=glandium,necko-reviewers,jgilbert,application-update-reviewers,media-playback-reviewers,credential-management-reviewers,anti-tracking-reviewers,places-reviewers,profiler-reviewers,win-reviewers,dom-storage-reviewers,bytesized,janv,dimi,daisuke,karlt,gstoll,canaltinova,timhuang
Namely std::size, std::end and std::size. This drops C support for
MOZ_ARRAY_LENGTH but it wasn't used anyway.

Differential Revision: https://phabricator.services.mozilla.com/D224611
2024-10-24 09:06:01 +00:00
Alexandru Marc 004e704b22 Backed out changeset 448597bce69d (bug 1922838) for causing build bustages. CLOSED TREE 2024-10-24 11:37:49 +03:00
serge-sans-paille 2c916d4973 Bug 1922838 - Replace ArrayLength, ArrayEnd and MOZ_ARRAY_LENGTH by standard alternative r=glandium,necko-reviewers,jgilbert,application-update-reviewers,media-playback-reviewers,credential-management-reviewers,anti-tracking-reviewers,places-reviewers,profiler-reviewers,win-reviewers,dom-storage-reviewers,bytesized,janv,dimi,daisuke,karlt,gstoll,canaltinova,timhuang
Namely std::size, std::end and std::size. This drops C support for
MOZ_ARRAY_LENGTH but it wasn't used anyway.

Differential Revision: https://phabricator.services.mozilla.com/D224611
2024-10-24 07:38:30 +00:00
Florian Quèze bd54777825 Bug 1923028 - Migrate scalars to use Glean APIs in security/manager/ssl/, r=chutten.
Differential Revision: https://phabricator.services.mozilla.com/D225979
2024-10-19 07:54:50 +00:00
Norisz Fay aee1a52659 Backed out 4 changesets (bug 1923028) for causing bc failures on browser_glean_metrics_exist.js CLOSED TREE
Backed out changeset 6f41dbd872e2 (bug 1923028)
Backed out changeset b6774d5247f5 (bug 1923028)
Backed out changeset 6db21856f4de (bug 1923028)
Backed out changeset 0de824b926d6 (bug 1923028)
2024-10-19 02:25:49 +03:00
Florian Quèze b421df3584 Bug 1923028 - Migrate scalars to use Glean APIs in security/manager/ssl/, r=chutten.
Differential Revision: https://phabricator.services.mozilla.com/D225979
2024-10-18 20:24:28 +00:00
John Schanck 56140b882f Bug 1918484 - replace xyber768d00 with mlkem768x25519 in PSM. r=keeler,necko-reviewers,kershaw
Differential Revision: https://phabricator.services.mozilla.com/D222019
2024-09-13 00:34:44 +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
Valentin Gosu d2a84b09f8 Bug 1851294 - Use nsMainThreadPtrHolder<Promise> to avoid assertion r=necko-reviewers,kershaw
Differential Revision: https://phabricator.services.mozilla.com/D208015
2024-04-22 08:04:35 +00:00
Valentin Gosu c3dde813f4 Bug 1851294 - Add nsITLSSocketControl.asyncStartTLS r=jschanck,necko-reviewers,kershaw
Thunderbird uses nsITLSSocketControl.startTLS to drive the XMPP
connection, but since we started enforcing proper thread safety in
bug 1847260, it's asserting when called on the main thread.

This patch marks StartTLS and proxyStartTLS as [noscript] and adds
asyncStartTLS. This new method dispatches a runnable to the socket thread
to call startTLS, then resolves (or rejects with the nsresult as an arg)
on the main thread.

Differential Revision: https://phabricator.services.mozilla.com/D207692
2024-04-19 09:42:41 +00:00
John Schanck 2a1010d1f4 Bug 1879954 - exempt errors after Server Hello from Xyber retry logic. r=keeler
Differential Revision: https://phabricator.services.mozilla.com/D201638
2024-02-15 21:01:33 +00:00
Sandor Molnar 691733fa97 Backed out changeset 451c7a03c400 (bug 1879954) for causing build bustages at security/manager/ssl/nsNSSCallbacks.h CLOSED TREE 2024-02-15 20:58:56 +02:00
John Schanck 4c1158a583 Bug 1879954 - exempt errors after Server Hello from Xyber retry logic. r=keeler
Differential Revision: https://phabricator.services.mozilla.com/D201638
2024-02-15 16:59:56 +00:00
John Schanck 58c892707b Bug 1878385 - add xyber768d00 retry logic. r=keeler
Differential Revision: https://phabricator.services.mozilla.com/D200494
2024-02-08 23:37:56 +00:00
Kershaw Chang ed4b7110c9 Bug 1851570 - Allow necko to know when client auth is selected to drive TLS handshake, r=necko-reviewers,keeler,valentin
Differential Revision: https://phabricator.services.mozilla.com/D194242
2023-11-22 09:15:39 +00:00
Dana Keeler 8f7101d02e Bug 1840144 - clean up some TLS socket creation error handling r=jschanck
Differential Revision: https://phabricator.services.mozilla.com/D193722
2023-11-21 16:41:25 +00:00
Dana Keeler 63db05ab9d Bug 1401466 - make the client auth certificate selection dialog tab modal r=jschanck,necko-reviewers,bolsson,kershaw,valentin
Previously, the client authentication certificate selection dialog could show
up unexpectedly. Because it was modal, it would prevent user interaction with
the browser. It could even get in a state where the dialog couldn't be
interacted with, and neither could anything else, so the entire browser would
be locked and the user would have to quit and restart.

This patch associates a top-level outer content window ID (called "browserId"
in networking code) with each NSSSocketControl. When a peer asks for a client
authentication certificate, the NSSSocketControl can use the ID to find the
relevant tab and open a tab-modal dialog, which allows other browser UI to be
interacted with.

Some loads cannot be associated with browser tabs, and so the implementation
falls back to opening a window-modal dialog on the most recently active window.
This is still better than the previous implementation, since the dialog is
connected to a window rather than being its own separate dialog.

Differential Revision: https://phabricator.services.mozilla.com/D183775
2023-08-30 03:05:35 +00:00
Cosmin Sabou 816e584379 Backed out changeset 16c71fac6426 (bug 1401466) for causing SocketControl related fuzzing build bustages. CLOSED TREE 2023-08-30 00:37:21 +03:00
Dana Keeler 709eefb9c7 Bug 1401466 - make the client auth certificate selection dialog tab modal r=jschanck,necko-reviewers,bolsson,kershaw,valentin
Previously, the client authentication certificate selection dialog could show
up unexpectedly. Because it was modal, it would prevent user interaction with
the browser. It could even get in a state where the dialog couldn't be
interacted with, and neither could anything else, so the entire browser would
be locked and the user would have to quit and restart.

This patch associates a top-level outer content window ID (called "browserId"
in networking code) with each NSSSocketControl. When a peer asks for a client
authentication certificate, the NSSSocketControl can use the ID to find the
relevant tab and open a tab-modal dialog, which allows other browser UI to be
interacted with.

Some loads cannot be associated with browser tabs, and so the implementation
falls back to opening a window-modal dialog on the most recently active window.
This is still better than the previous implementation, since the dialog is
connected to a window rather than being its own separate dialog.

Differential Revision: https://phabricator.services.mozilla.com/D183775
2023-08-29 20:47:45 +00:00
Dana Keeler 90ad9a5099 Bug 1835103 - reset speculative connections where the peer asks for a client authentication certificate r=jschanck,kershaw
Speculative connections to servers that request a client authentication
certificate can't make progress, because PSM buffers the "select a client
authentication certificate" dialog (otherwise, the dialog would show up
unexpectedly), but Necko won't claim the connection until the TLS handshake has
completed (which it won't, because the user needs to select a client
authentication certificate first). So, the only option is to cancel the
connection and have Necko make a new non-speculative connection.

Differential Revision: https://phabricator.services.mozilla.com/D180134
2023-06-09 22:49:16 +00:00
Dana Keeler 94dc5b9ec4 Bug 1813618 - buffer client auth certificate selection UI for speculative connections r=valentin,jschanck,necko-reviewers,kershaw
When necko makes a speculative connection, the peer may ask for a client
authentication certificate. This patch makes it so that when this happens,
no certificate selection UI will be shown until the connection is claimed (as
in, it is no longer merely speculative).

Differential Revision: https://phabricator.services.mozilla.com/D175528
2023-04-18 17:52:49 +00:00
Dana Keeler b89de3d236 Bug 1289186 - wait for the server certificate to verify successfully before asking for a client auth certificate r=jschanck
If a TLS server asks for a client authentication certificate, no dialog asking
the user to select one should be shown until the server's certificate verifies
successfully.

Differential Revision: https://phabricator.services.mozilla.com/D175170
2023-04-13 18:52:18 +00:00
Narcis Beleuzu 21de333bb3 Backed out changeset a5064c22d601 (bug 1289186) for Bp-hybrid bustages on NSSSocketControl.h . CLOSED TREE 2023-04-12 22:03:22 +03:00
Dana Keeler ac7086f903 Bug 1289186 - wait for the server certificate to verify successfully before asking for a client auth certificate r=jschanck
If a TLS server asks for a client authentication certificate, no dialog asking
the user to select one should be shown until the server's certificate verifies
successfully.

Differential Revision: https://phabricator.services.mozilla.com/D175170
2023-04-12 16:21:38 +00:00
serge-sans-paille a5bc7d11e9 Bug 1820573 - Make security/ buildable outside of a unified build environment r=andi,keeler
Differential Revision: https://phabricator.services.mozilla.com/D171732
2023-03-15 07:30:36 +00:00
Dana Keeler a9bcca7130 Bug 1791633 - separate nsITLSSocketControl from nsITransportSecurityInfo r=necko-reviewers,kershaw,jschanck
Depends on D160311

Differential Revision: https://phabricator.services.mozilla.com/D160313
2022-11-16 16:37:29 +00:00
Dana Keeler 41b8e4ba29 Bug 1791633 - rename nsISSLSocketControl to nsITLSSocketControl and move it and nsITransportSecurityInfo to PSM r=necko-reviewers,kershaw
Depends on D160310

Differential Revision: https://phabricator.services.mozilla.com/D160311
2022-11-16 16:37:29 +00:00
Dana Keeler b51c8a10df Bug 1791633 - rename nsNSSSocketInfo to NSSSocketControl and move to its own file r=jschanck
Differential Revision: https://phabricator.services.mozilla.com/D160310
2022-11-16 16:37:28 +00:00