From 555b024dda05f78f19a2b61e36de713d05b69818 Mon Sep 17 00:00:00 2001 From: Byron Campen Date: Fri, 27 Oct 2023 16:12:40 -0500 Subject: [PATCH] Bug 1860685 - Vendor libwebrtc from 597e7ba370 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Upstream commit: https://webrtc.googlesource.com/src/+/597e7ba370a973f64f822aa247cb2355de7c5f47 [M118] Obfuscate prflx raddr when using mdns BUG=chromium:1478690 (cherry picked from commit a8e3111d8c6622eeb930c32ab7a2e6be51b3d801) Change-Id: I7a1caad7bbd2fc82507b61b59be71546494a304c Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/319580 Reviewed-by: Harald Alvestrand Reviewed-by: Henrik Boström Commit-Queue: Philipp Hancke Cr-Original-Commit-Position: refs/heads/main@{#40724} Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/320580 Cr-Commit-Position: refs/branch-heads/5993@{#2} Cr-Branched-From: 5afcec093c1403fe9e3872706d04671cbc6d2983-refs/heads/main@{#40703} --- third_party/libwebrtc/README.moz-ff-commit | 3 +++ third_party/libwebrtc/README.mozilla | 2 ++ third_party/libwebrtc/p2p/base/port_allocator.cc | 5 ++++- .../libwebrtc/p2p/base/port_allocator_unittest.cc | 15 +++++++++++++++ 4 files changed, 24 insertions(+), 1 deletion(-) diff --git a/third_party/libwebrtc/README.moz-ff-commit b/third_party/libwebrtc/README.moz-ff-commit index f0e1d6a5c5a7..aaac45e64c2f 100644 --- a/third_party/libwebrtc/README.moz-ff-commit +++ b/third_party/libwebrtc/README.moz-ff-commit @@ -25821,3 +25821,6 @@ ff281aa328 # MOZ_LIBWEBRTC_SRC=/home/bcampen/checkouts/elm/.moz-fast-forward/moz-libwebrtc MOZ_LIBWEBRTC_BRANCH=mozpatches bash dom/media/webrtc/third_party_build/fast-forward-libwebrtc.sh # base of lastest vendoring 7349579c42 +# MOZ_LIBWEBRTC_SRC=/home/bcampen/checkouts/elm/.moz-fast-forward/moz-libwebrtc MOZ_LIBWEBRTC_BRANCH=mozpatches bash dom/media/webrtc/third_party_build/fast-forward-libwebrtc.sh +# base of lastest vendoring +597e7ba370 diff --git a/third_party/libwebrtc/README.mozilla b/third_party/libwebrtc/README.mozilla index 993724c60a8b..18d9a44b70dc 100644 --- a/third_party/libwebrtc/README.mozilla +++ b/third_party/libwebrtc/README.mozilla @@ -17238,3 +17238,5 @@ libwebrtc updated from /home/bcampen/checkouts/elm/.moz-fast-forward/moz-libwebr libwebrtc updated from /home/bcampen/checkouts/elm/.moz-fast-forward/moz-libwebrtc commit mozpatches on 2023-10-27T21:10:43.186110. # ./mach python dom/media/webrtc/third_party_build/vendor-libwebrtc.py --from-local /home/bcampen/checkouts/elm/.moz-fast-forward/moz-libwebrtc --commit mozpatches libwebrtc libwebrtc updated from /home/bcampen/checkouts/elm/.moz-fast-forward/moz-libwebrtc commit mozpatches on 2023-10-27T21:11:33.670827. +# ./mach python dom/media/webrtc/third_party_build/vendor-libwebrtc.py --from-local /home/bcampen/checkouts/elm/.moz-fast-forward/moz-libwebrtc --commit mozpatches libwebrtc +libwebrtc updated from /home/bcampen/checkouts/elm/.moz-fast-forward/moz-libwebrtc commit mozpatches on 2023-10-27T21:12:29.956641. diff --git a/third_party/libwebrtc/p2p/base/port_allocator.cc b/third_party/libwebrtc/p2p/base/port_allocator.cc index 522f0beb9891..d8ff04fe20a9 100644 --- a/third_party/libwebrtc/p2p/base/port_allocator.cc +++ b/third_party/libwebrtc/p2p/base/port_allocator.cc @@ -340,9 +340,12 @@ Candidate PortAllocator::SanitizeCandidate(const Candidate& c) const { // If the candidate filter doesn't allow reflexive addresses, empty TURN raddr // to avoid reflexive address leakage. bool filter_turn_related_address = !(candidate_filter_ & CF_REFLEXIVE); + // Sanitize related_address when using MDNS. + bool filter_prflx_related_address = MdnsObfuscationEnabled(); bool filter_related_address = ((c.type() == STUN_PORT_TYPE && filter_stun_related_address) || - (c.type() == RELAY_PORT_TYPE && filter_turn_related_address)); + (c.type() == RELAY_PORT_TYPE && filter_turn_related_address) || + (c.type() == PRFLX_PORT_TYPE && filter_prflx_related_address)); return c.ToSanitizedCopy(use_hostname_address, filter_related_address); } diff --git a/third_party/libwebrtc/p2p/base/port_allocator_unittest.cc b/third_party/libwebrtc/p2p/base/port_allocator_unittest.cc index f70997179ea2..48d0bc8a6ec2 100644 --- a/third_party/libwebrtc/p2p/base/port_allocator_unittest.cc +++ b/third_party/libwebrtc/p2p/base/port_allocator_unittest.cc @@ -357,6 +357,21 @@ TEST_F(PortAllocatorTest, SanitizePrflxCandidateMdnsObfuscationEnabled) { EXPECT_EQ("", output.address().ipaddr().ToString()); } +TEST_F(PortAllocatorTest, + SanitizePrflxCandidateMdnsObfuscationEnabledRelatedAddress) { + allocator_->SetMdnsObfuscationEnabledForTesting(true); + // Create the candidate from an IP literal. This populates the hostname. + cricket::Candidate input(1, "udp", rtc::SocketAddress(kIpv4Address, 443), 1, + "username", "password", cricket::PRFLX_PORT_TYPE, 1, + "foundation", 1, 1); + + cricket::Candidate output = allocator_->SanitizeCandidate(input); + EXPECT_NE(kIpv4AddressWithPort, output.address().ToString()); + EXPECT_EQ("", output.address().ipaddr().ToString()); + EXPECT_NE(kIpv4AddressWithPort, output.related_address().ToString()); + EXPECT_EQ("", output.related_address().ipaddr().ToString()); +} + TEST_F(PortAllocatorTest, SanitizeIpv4NonLiteralMdnsObfuscationEnabled) { // Create the candidate with an empty hostname. allocator_->SetMdnsObfuscationEnabledForTesting(true);