Changeset 256016 in webkit
- Timestamp:
- Feb 7, 2020 2:42:37 AM (4 years ago)
- Location:
- trunk/Source
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WTF/ChangeLog
r256011 r256016 1 2020-02-07 youenn fablet <youenn@apple.com> 2 3 Mandate UUID version 4 for mDNS ICE candidates 4 https://bugs.webkit.org/show_bug.cgi?id=207329 5 6 Reviewed by Alex Christensen. 7 8 Add a routine to validate version 4 UUID. 9 10 * wtf/UUID.cpp: 11 (WTF::isHexadecimalCharacter): 12 (WTF::isVersion4UUID): 13 * wtf/UUID.h: 14 1 15 2020-02-07 Yusuke Suzuki <ysuzuki@apple.com> 2 16 -
trunk/Source/WTF/wtf/UUID.cpp
r254046 r256016 82 82 } 83 83 84 static inline bool isHexadecimalCharacter(UChar character) 85 { 86 return (character >= '0' && character <= '9') 87 || (character >= 'a' && character <= 'f') 88 || (character >= 'A' && character <= 'F'); 89 } 90 91 bool isVersion4UUID(StringView value) 92 { 93 // Version 4 UUIDs have the form xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx with hexadecimal digits for x and one of 8, 9, A, or B for y. 94 if (value.length() != 36) 95 return false; 96 97 for (auto cptr = 0; cptr < 36; ++cptr) { 98 if (cptr == 8 || cptr == 13 || cptr == 18 || cptr == 23) { 99 if (value[cptr] != '-') 100 return false; 101 continue; 102 } 103 if (cptr == 14) { 104 if (value[cptr] != '4') 105 return false; 106 continue; 107 } 108 if (cptr == 19) { 109 auto y = value[cptr]; 110 if (y != '8' && y != '9' && y != 'a' && y != 'A' && y != 'b' && y != 'B') 111 return false; 112 continue; 113 } 114 if (!isHexadecimalCharacter(value[cptr])) 115 return false; 116 } 117 return true; 118 } 119 84 120 } // namespace WTF -
trunk/Source/WTF/wtf/UUID.h
r241733 r256016 35 35 namespace WTF { 36 36 37 class StringView; 38 37 39 // Creates a UUID that consists of 32 hexadecimal digits and returns its canonical form. 38 40 // The canonical form is displayed in 5 groups separated by hyphens, in the form 8-4-4-4-12 for a total of 36 characters. … … 47 49 48 50 WTF_EXPORT_PRIVATE String bootSessionUUIDString(); 51 WTF_EXPORT_PRIVATE bool isVersion4UUID(StringView); 49 52 50 53 } -
trunk/Source/WebCore/ChangeLog
r256014 r256016 1 2020-02-07 youenn fablet <youenn@apple.com> 2 3 Mandate UUID version 4 for mDNS ICE candidates 4 https://bugs.webkit.org/show_bug.cgi?id=207329 5 6 Reviewed by Alex Christensen. 7 8 Ignore ICE candidates if they are mDNS but not UUID version 4. 9 Covered by existing tests relying on mDNS to do the connection. 10 11 * Modules/mediastream/PeerConnectionBackend.cpp: 12 (WebCore::shouldIgnoreCandidate): 13 (WebCore::PeerConnectionBackend::addIceCandidate): 14 1 15 2020-02-07 Tomoki Imai <Tomoki.Imai@sony.com> 2 16 -
trunk/Source/WebCore/Modules/mediastream/PeerConnectionBackend.cpp
r256009 r256016 47 47 #include "RTCTrackEvent.h" 48 48 #include "RuntimeEnabledFeatures.h" 49 #include <wtf/UUID.h> 49 50 #include <wtf/text/StringBuilder.h> 50 51 #include <wtf/text/StringConcatenateNumbers.h> … … 303 304 } 304 305 305 static String extractIPAddres(const String& sdp) 306 { 307 ASSERT(sdp.contains(" host ")); 306 static String extractIPAddress(const String& sdp) 307 { 308 308 unsigned counter = 0; 309 309 for (auto item : StringView { sdp }.split(' ')) { … … 314 314 } 315 315 316 static inline bool shouldIgnoreIceCandidate(const RTCIceCandidate& iceCandidate) 317 { 318 auto address = extractIPAddress(iceCandidate.candidate()); 319 if (!address.endsWithIgnoringASCIICase(".local"_s)) 320 return false; 321 322 if (!WTF::isVersion4UUID(StringView { address }.substring(0, address.length() - 6))) { 323 RELEASE_LOG_ERROR(WebRTC, "mDNS candidate is not a Version 4 UUID"); 324 return true; 325 } 326 return false; 327 } 328 316 329 void PeerConnectionBackend::addIceCandidate(RTCIceCandidate* iceCandidate, DOMPromiseDeferred<void>&& promise) 317 330 { … … 328 341 return; 329 342 } 343 344 if (shouldIgnoreIceCandidate(*iceCandidate)) { 345 promise.resolve(); 346 return; 347 } 348 330 349 m_addIceCandidatePromise = WTF::makeUnique<DOMPromiseDeferred<void>>(WTFMove(promise)); 331 350 doAddIceCandidate(*iceCandidate); … … 451 470 m_pendingICECandidates.append(PendingICECandidate { String { sdp }, WTFMove(mid), sdpMLineIndex, WTFMove(serverURL) }); 452 471 if (RuntimeEnabledFeatures::sharedFeatures().webRTCMDNSICECandidatesEnabled()) { 453 auto ipAddress = extractIPAddres (sdp);472 auto ipAddress = extractIPAddress(sdp); 454 473 // We restrict to IPv4 candidates for now. 455 474 if (ipAddress.contains('.')) -
trunk/Source/WebKit/ChangeLog
r256013 r256016 1 2020-02-07 youenn fablet <youenn@apple.com> 2 3 Mandate UUID version 4 for mDNS ICE candidates 4 https://bugs.webkit.org/show_bug.cgi?id=207329 5 6 Reviewed by Alex Christensen. 7 8 * NetworkProcess/webrtc/NetworkMDNSRegister.cpp: 9 (WebKit::NetworkMDNSRegister::registerMDNSName): 10 Remove the count at the end of the mDNS name to make it a fully version 4 UUID. 11 1 12 2020-02-07 Patrick Griffis <pgriffis@igalia.com> 2 13 -
trunk/Source/WebKit/NetworkProcess/webrtc/NetworkMDNSRegister.cpp
r249980 r256016 127 127 service = iterator->value; 128 128 129 String name = makeString(createCanonicalUUIDString(), pendingRegistrationRequestCount,".local");129 String name = makeString(createCanonicalUUIDString(), ".local"); 130 130 131 131 auto ip = inet_addr(ipAddress.utf8().data());
Note: See TracChangeset
for help on using the changeset viewer.