Commit graph

79 commits

Author SHA1 Message Date
Josh Matthews
96b0973037
Upgrade tungstenite, webpki-roots, and hyper-rustls dependencies. (#37333)
This change upgrades some dependencies that required some manual
intervention due to duplicate packages and breaking API changes. These
changes also allow us to upgrade to ipc-channel 0.20
(https://github.com/servo/ipc-channel/pull/390#discussion_r2070677101),
and allow us to upgrade other dependencies that have migrated to rand
0.9 while the ecosystem remains split.

Testing: Existing WPT tests.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>
2025-06-08 22:55:44 +00:00
Tim van der Lippe
f710e2cab4
net: Perform CSP checks on fetch responses. (#37154)
Also add clarifying comments to the SRI WPT tests with
regards to the `www.` domain and how that interacts with
the integrity checks.

Lastly, adjust the casing for `Strict-Dynamic`, as in
the post-request check that should also be case-insensitive.

Closes servo/servo#37200
Closes servo/servo#36760
Fixes servo/servo#36499
Part of w3c/webappsec-csp#727
Fixes w3c/webappsec-csp#728
Part of servo/servo#4577

Signed-off-by: Josh Matthews <josh@joshmatthews.net>
Signed-off-by: Tim van der Lippe <tvanderlippe@gmail.com>
Co-authored-by: Josh Matthews <josh@joshmatthews.net>
2025-06-01 17:25:13 +00:00
Jonathan Schwender
c46402e222
Remove lock around tokio-rt handle (#36762)
It seems sub-optimal to to sequentialise execution by grabbing a lock,
each time we want to spawn a task onto the tokio runtime. We don't need
the lock either, so it makes sense to just remove it, which also
simplifies a bunch of the using code.

Testing: Covered by existing tests

Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com>
2025-04-30 07:09:38 +00:00
Tim van der Lippe
85e4a2b5c7
Update FetchTaskTarget to propagate CSP violations. (#36409)
It also updates the FetchResponseListener to process CSP violations to
ensure that iframe elements (amongst others) properly generate the CSP
events. These iframe elements are used in the Trusted Types tests
themselves and weren't propagating the violations before.

However, the tests themselves are still not passing since they also use
Websockets, which currently aren't using the fetch machinery itself.
That is fixed as part of [1].

[1]: https://github.com/servo/servo/issues/35028

---------

Signed-off-by: Tim van der Lippe <tvanderlippe@gmail.com>
Signed-off-by: Josh Matthews <josh@joshmatthews.net>
Co-authored-by: Josh Matthews <josh@joshmatthews.net>
2025-04-13 20:54:59 +00:00
Simon Wülker
3d320fa96a
Update rustfmt to the 2024 style edition (#35764)
* Use 2024 style edition

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>

* Reformat all code

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>

---------

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
2025-03-03 11:26:53 +00:00
Simon Wülker
0ebdf146fc
Cleanup blocking fetch operations with bad ports (#35324)
Blocking a fetch due to a bad port should be grouped together
with CSP blocks as per the spec, but these steps were previously
seperated.

Additionally, remove handling of ftp in
should_request_be_blocked_due_to_a_bad_port, since it did nothing
anyways.

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
2025-02-06 16:47:29 +00:00
dependabot[bot]
1ce6495f0d
build(deps): bump async-tungstenite from 0.28.0 to 0.28.2 (#34904)
Bumps [async-tungstenite](https://github.com/sdroege/async-tungstenite) from 0.28.0 to 0.28.2.
- [Changelog](https://github.com/sdroege/async-tungstenite/blob/main/CHANGELOG.md)
- [Commits](https://github.com/sdroege/async-tungstenite/compare/0.28.0...0.28.2)

---
updated-dependencies:
- dependency-name: async-tungstenite
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-01-08 21:51:38 +00:00
Josh Matthews
4d5109cab2
websocket: Revert use of h2 in websocket ALPN. (#34634)
Signed-off-by: Josh Matthews <josh@joshmatthews.net>
2024-12-16 06:47:33 +00:00
Simon Wülker
e33bae6d0a
Use ROUTER::add_typed_route instead of ROUTER::add_route everywhere (#33866)
* Use ROUTER::add_typed_route where possible

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>

* Update webxr, media and ipc-channel

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>

---------

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
2024-10-18 10:47:52 +00:00
Martin Robinson
b6f1e3b22d
dependencies: Upgrade cookie and rename Servo's Cookie to ServoCookie (#32861)
This changes updates to the new version of the `cookie` crate in Servo
which no longer uses the old `time@0.1` data types. This requires using
a new version of `time` while we transition off of the old one. This is
the first step in that process.

In addition, the overloading of the `cookie::Cookie` name was causing a
great deal of confusion, so I've renamed the Servo wrapper to
`ServoCookie` like we do with `ServoUrl`.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
2024-07-26 16:13:39 +00:00
tannal
5c0199b568
Net: fold websocket and http tokio runtime into one (#31771)
* net: use the same tokio runtime in websocket loader

#31648

* readability

* license
2024-03-21 06:13:03 +00:00
eri
67b277c992
clippy: fix warnings in components/net (#31564)
* clippy: fix some warnings in components/net

* fix: review comments

* fix: tidy
2024-03-10 15:34:16 +00:00
Samson
aad2dccc9c
Strict import formatting (grouping and granularity) (#30325)
* strict imports formatting

* Reformat all imports
2023-09-11 19:16:54 +00:00
Samson
711dbbd4af
remove extern crate (#30311)
* remove extern crate

* Update components/script_plugins/lib.rs

Co-authored-by: Martin Robinson <mrobinson@igalia.com>

---------

Co-authored-by: Martin Robinson <mrobinson@igalia.com>
2023-09-08 12:11:31 +00:00
Martin Robinson
bce7622cde
Switch to rustls and webpki-roots (#30025)
This change replaces OpenSSL with rustls and also the manually curated
CA certs file with webpki-roots (effectively the same thing, but as a
crate).

Generally speaking the design of the network stack is the same. Changes:

- Code around certificate overrides needed to be refactored to work with
  rustls so the various thread-safe list of certificates is refactored
  into `CertificateErrorOverrideManager`
- hyper-rustls takes care of setting ALPN protocols for HTTP requests,
  so for WebSockets this is moved to the WebSocket code.
- The safe set of cypher suites is chosen, which seem to correspond to
  the "Modern" configuration from [1]. This can be adjusted later.
- Instead of passing a string of PEM CA certificates around, an enum is
  used that includes parsed Certificates (or the default which reads
  them from webpki-roots).
- Code for starting up an SSL server for testing is cleaned up a little,
  due to the fact that the certificates need to be overriden explicitly
  now. This is due to the fact that the `webpki` crate is more stringent
  with self-signed certificates than SSL (CA certificates cannot used as
  end-entity certificates). [2]

1. https://wiki.mozilla.org/Security/Server_Side_TLS
2. https://github.com/briansmith/webpki/issues/114

Fixes #7888.
Fixes #13749.
Fixes #26835.
Fixes #29291.
2023-08-08 14:00:10 +00:00
Tuna
4c8db6af87
bump base64 from 0.10 to 0.21 (#29804)
* bump base64 from 0.10 to 0.21

* Fix configuration of bitflags

---------

Co-authored-by: Martin Robinson <mrobinson@igalia.com>
2023-08-02 21:25:37 +00:00
Fabrice Desré
0d0540fc95 Update tungstenite 2023-05-20 21:55:00 +00:00
Naveen Gattu
a48a111cee Upgrade Hyper 2022-01-16 09:34:17 -08:00
Josh Matthews
d5d8eddb33 net: Remove explicit Host header from websocket connection. 2020-07-16 13:16:30 -04:00
Josh Matthews
76198e40a8 net: Replace ws-rs with async-tungstenite. 2020-07-08 10:33:17 -04:00
Josh Matthews
433c154595 net: Allow SSL websockets to use dynamic list of certs as well. 2020-06-09 15:03:18 -04:00
Josh Matthews
0ce2aa917a net: Pass certs that fail the SSL handshake out of the network layer. 2020-06-09 15:03:18 -04:00
Josh Matthews
1cdaf40eb2 net: Add an SSL verification callback to support checking a dynamic list of certs. 2020-06-09 15:03:18 -04:00
Josh Matthews
63cdcb847d Remove duplicate Host header from initial websocket request. 2020-05-22 14:51:43 -04:00
Josh Matthews
ba83f0ffa6 Don't panic when dealing with disconnected websockets. 2020-02-25 13:53:15 -05:00
Patrick Shaughnessy
fc13bd8b2f Cookie header values can be utf8 2020-01-28 12:47:18 -05:00
Patrick Shaughnessy
6d31827464 Cookies are now expired immediately before each lookup 2020-01-24 20:07:08 -05:00
Jan Andre Ikenmeyer
68ebecb775
Fix HSTS 2020-01-07 16:07:12 +01:00
Jan Andre Ikenmeyer
b811be764c
Add ALPN and signature algorithms to OpenSSL config 2019-11-30 05:18:00 +01:00
Gregory Terzian
c1573cc4fc use ipc router to handle ws dom-action messages 2019-10-09 17:36:45 +08:00
Josh Matthews
b1510d9ad5 Upgrade headers, headers-core, and hyper_serde. 2019-06-13 11:08:16 -04:00
oneturkmen
9034fb64b7 Net: removed opts::get() usage 2019-06-06 18:48:17 -06:00
Lucas Fantacuci
6b2be9b31d Implementing the builder pattern for RequestInit 2019-04-10 14:01:30 -03:00
Shotaro Yamada
c44a2febe6 Remove redundant .clone()s 2018-12-11 10:43:51 +09:00
Jan Andre Ikenmeyer
1d6fe65401
Update MPL license to https (part 4) 2018-11-19 14:47:27 +01:00
Pyfisch
9e92eb205a Reorder imports 2018-11-06 22:35:07 +01:00
Simon Sapin
76e59a46d3 Sort use statements 2018-11-06 15:26:02 +01:00
Simon Sapin
45f7199eee cargo fix --edition 2018-11-06 15:26:02 +01:00
Pyfisch
2481ad25f8 Rustfmt net crate 2018-11-03 15:29:01 +01:00
Bastien Orivel
024b40b39d Update hyper to 0.12 2018-11-01 19:17:36 +01:00
Bastien Orivel
75c746655c The WS protocols should be case sensitive, not insensitive 2018-08-16 15:50:50 +02:00
Bastien Orivel
73ef02ff17 Handle secure websockets
Fixes #20816
2018-08-16 00:24:19 +02:00
Bastien Orivel
2e11bc10fb Replace servo-websocket by ws
This is heavily based on previous work done in #16012.

Fixes #14517
2018-08-15 16:53:48 +02:00
Bastien Orivel
f48d0928d5 Update servo-websocket to 0.21 2018-03-15 02:05:00 +01:00
Simon Sapin
793bebfc0e Upgrade to rustc 1.23.0-nightly (02004ef78 2017-11-08) 2017-11-09 16:56:39 +01:00
Keith Yeung
99f9696a24 Merge functionality of WebsocketConnect into Fetch 2017-10-24 20:54:19 -07:00
Keith Yeung
c6bb1cb9d5 Merge request type and destination 2017-10-23 11:19:35 -07:00
Keith Yeung
b50bcdc8fc Rename basic fetch to scheme fetch 2017-08-08 09:27:17 -07:00
Josh Matthews
6f590a87bf Move hosts module into net crate. Remove obsolete functions. 2017-04-06 19:25:47 +09:00
Anthony Ramine
5313e00e3a Pass the url by value to websocket_loader::main_fetch 2017-04-05 14:46:52 +02:00