react-native-windows 0.73.10 → 0.73.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Libraries/Core/ReactNativeVersion.js +1 -1
- package/Libraries/LogBox/Data/parseLogBoxLog.js +1 -1
- package/PropertySheets/Generated/PackageVersion.g.props +3 -3
- package/Shared/Networking/OriginPolicyHttpFilter.cpp +19 -23
- package/Shared/Networking/OriginPolicyHttpFilter.h +4 -7
- package/Shared/Networking/WinRTHttpResource.cpp +2 -4
- package/package.json +6 -6
|
@@ -192,7 +192,7 @@ export function parseComponentStack(message: string): ComponentStack {
|
|
|
192
192
|
if (!s) {
|
|
193
193
|
return null;
|
|
194
194
|
}
|
|
195
|
-
const match = s.match(/(.*) \(at (.*\.js):([\d]+)\)/);
|
|
195
|
+
const match = s.match(/(.*) \(at (.*\.(?:js|jsx|ts|tsx)):([\d]+)\)/);
|
|
196
196
|
if (!match) {
|
|
197
197
|
return null;
|
|
198
198
|
}
|
|
@@ -10,11 +10,11 @@
|
|
|
10
10
|
-->
|
|
11
11
|
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
12
12
|
<PropertyGroup>
|
|
13
|
-
<ReactNativeWindowsVersion>0.73.
|
|
13
|
+
<ReactNativeWindowsVersion>0.73.11</ReactNativeWindowsVersion>
|
|
14
14
|
<ReactNativeWindowsMajor>0</ReactNativeWindowsMajor>
|
|
15
15
|
<ReactNativeWindowsMinor>73</ReactNativeWindowsMinor>
|
|
16
|
-
<ReactNativeWindowsPatch>
|
|
16
|
+
<ReactNativeWindowsPatch>11</ReactNativeWindowsPatch>
|
|
17
17
|
<ReactNativeWindowsCanary>false</ReactNativeWindowsCanary>
|
|
18
|
-
<ReactNativeWindowsCommitId>
|
|
18
|
+
<ReactNativeWindowsCommitId>1a56053a4c4912271841269db84956d6b525f795</ReactNativeWindowsCommitId>
|
|
19
19
|
</PropertyGroup>
|
|
20
20
|
</Project>
|
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
#include <regex>
|
|
19
19
|
|
|
20
20
|
using std::set;
|
|
21
|
+
using std::string;
|
|
21
22
|
using std::wstring;
|
|
22
23
|
|
|
23
24
|
using winrt::hresult_error;
|
|
@@ -114,15 +115,6 @@ bool OriginPolicyHttpFilter::CaseInsensitiveComparer::operator()(const wstring &
|
|
|
114
115
|
/*static*/ set<const wchar_t *, OriginPolicyHttpFilter::CaseInsensitiveComparer>
|
|
115
116
|
OriginPolicyHttpFilter::s_corsForbiddenRequestHeaderNamePrefixes = {L"Proxy-", L"Sec-"};
|
|
116
117
|
|
|
117
|
-
/*static*/ Uri OriginPolicyHttpFilter::s_origin{nullptr};
|
|
118
|
-
|
|
119
|
-
/*static*/ void OriginPolicyHttpFilter::SetStaticOrigin(std::string &&url) {
|
|
120
|
-
if (!url.empty())
|
|
121
|
-
s_origin = Uri{to_hstring(url)};
|
|
122
|
-
else
|
|
123
|
-
s_origin = nullptr;
|
|
124
|
-
}
|
|
125
|
-
|
|
126
118
|
/*static*/ bool OriginPolicyHttpFilter::IsSameOrigin(Uri const &u1, Uri const &u2) noexcept {
|
|
127
119
|
return (u1 && u2) && u1.SchemeName() == u2.SchemeName() && u1.Host() == u2.Host() && u1.Port() == u2.Port();
|
|
128
120
|
}
|
|
@@ -387,10 +379,14 @@ bool OriginPolicyHttpFilter::CaseInsensitiveComparer::operator()(const wstring &
|
|
|
387
379
|
}
|
|
388
380
|
}
|
|
389
381
|
|
|
390
|
-
OriginPolicyHttpFilter::OriginPolicyHttpFilter(IHttpFilter const &innerFilter)
|
|
382
|
+
OriginPolicyHttpFilter::OriginPolicyHttpFilter(string &&origin, IHttpFilter const &innerFilter)
|
|
383
|
+
: m_origin{nullptr}, m_innerFilter{innerFilter} {
|
|
384
|
+
if (!origin.empty())
|
|
385
|
+
m_origin = Uri{to_hstring(origin)};
|
|
386
|
+
}
|
|
391
387
|
|
|
392
|
-
OriginPolicyHttpFilter::OriginPolicyHttpFilter()
|
|
393
|
-
: OriginPolicyHttpFilter(winrt::Windows::Web::Http::Filters::HttpBaseProtocolFilter{}) {}
|
|
388
|
+
OriginPolicyHttpFilter::OriginPolicyHttpFilter(string &&origin)
|
|
389
|
+
: OriginPolicyHttpFilter(std::move(origin), winrt::Windows::Web::Http::Filters::HttpBaseProtocolFilter{}) {}
|
|
394
390
|
|
|
395
391
|
OriginPolicy OriginPolicyHttpFilter::ValidateRequest(HttpRequestMessage const &request) {
|
|
396
392
|
auto effectiveOriginPolicy =
|
|
@@ -400,17 +396,17 @@ OriginPolicy OriginPolicyHttpFilter::ValidateRequest(HttpRequestMessage const &r
|
|
|
400
396
|
return effectiveOriginPolicy;
|
|
401
397
|
|
|
402
398
|
case OriginPolicy::SameOrigin:
|
|
403
|
-
if (!IsSameOrigin(
|
|
399
|
+
if (!IsSameOrigin(m_origin, request.RequestUri()))
|
|
404
400
|
throw hresult_error{E_INVALIDARG, L"SOP (same-origin policy) is enforced"};
|
|
405
401
|
break;
|
|
406
402
|
|
|
407
403
|
case OriginPolicy::SimpleCrossOriginResourceSharing:
|
|
408
404
|
// Check for disallowed mixed content
|
|
409
405
|
if (GetRuntimeOptionBool("Http.BlockMixedContentSimpleCors") &&
|
|
410
|
-
|
|
406
|
+
m_origin.SchemeName() != request.RequestUri().SchemeName())
|
|
411
407
|
throw hresult_error{E_INVALIDARG, L"The origin and request URLs must have the same scheme"};
|
|
412
408
|
|
|
413
|
-
if (IsSameOrigin(
|
|
409
|
+
if (IsSameOrigin(m_origin, request.RequestUri()))
|
|
414
410
|
// Same origin. Therefore, skip Cross-Origin handling.
|
|
415
411
|
effectiveOriginPolicy = OriginPolicy::SameOrigin;
|
|
416
412
|
else if (!IsSimpleCorsRequest(request))
|
|
@@ -426,7 +422,7 @@ OriginPolicy OriginPolicyHttpFilter::ValidateRequest(HttpRequestMessage const &r
|
|
|
426
422
|
// Example: On the Edge browser, an XHR request with the "Host" header set gets rejected as unsafe.
|
|
427
423
|
// https://fetch.spec.whatwg.org/#forbidden-header-name
|
|
428
424
|
|
|
429
|
-
if (
|
|
425
|
+
if (m_origin.SchemeName() != request.RequestUri().SchemeName())
|
|
430
426
|
throw hresult_error{E_INVALIDARG, L"The origin and request URLs must have the same scheme"};
|
|
431
427
|
|
|
432
428
|
if (!AreSafeRequestHeaders(request.Headers()))
|
|
@@ -435,7 +431,7 @@ OriginPolicy OriginPolicyHttpFilter::ValidateRequest(HttpRequestMessage const &r
|
|
|
435
431
|
if (s_forbiddenMethods.find(request.Method().ToString().c_str()) != s_forbiddenMethods.cend())
|
|
436
432
|
throw hresult_error{E_INVALIDARG, L"Request method not allowed in cross-origin resource sharing"};
|
|
437
433
|
|
|
438
|
-
if (IsSameOrigin(
|
|
434
|
+
if (IsSameOrigin(m_origin, request.RequestUri()))
|
|
439
435
|
effectiveOriginPolicy = OriginPolicy::SameOrigin;
|
|
440
436
|
else if (IsSimpleCorsRequest(request))
|
|
441
437
|
effectiveOriginPolicy = OriginPolicy::SimpleCrossOriginResourceSharing;
|
|
@@ -472,7 +468,7 @@ void OriginPolicyHttpFilter::ValidateAllowOrigin(
|
|
|
472
468
|
// 4.10.4 - Mismatched allow origin
|
|
473
469
|
auto taintedOriginProp = props.TryLookup(L"TaintedOrigin");
|
|
474
470
|
auto taintedOrigin = taintedOriginProp && winrt::unbox_value<bool>(taintedOriginProp);
|
|
475
|
-
auto origin = taintedOrigin ? nullptr :
|
|
471
|
+
auto origin = taintedOrigin ? nullptr : m_origin;
|
|
476
472
|
if (allowedOrigin.empty() || !IsSameOrigin(origin, Uri{allowedOrigin})) {
|
|
477
473
|
hstring errorMessage;
|
|
478
474
|
if (allowedOrigin.empty())
|
|
@@ -603,7 +599,7 @@ void OriginPolicyHttpFilter::ValidateResponse(HttpResponseMessage const &respons
|
|
|
603
599
|
bool originAllowed = false;
|
|
604
600
|
for (const auto &header : response.Headers()) {
|
|
605
601
|
if (boost::iequals(header.Key(), L"Access-Control-Allow-Origin")) {
|
|
606
|
-
originAllowed |= L"*" == header.Value() ||
|
|
602
|
+
originAllowed |= L"*" == header.Value() || m_origin == Uri{header.Value()};
|
|
607
603
|
}
|
|
608
604
|
}
|
|
609
605
|
|
|
@@ -691,7 +687,7 @@ ResponseOperation OriginPolicyHttpFilter::SendPreflightAsync(HttpRequestMessage
|
|
|
691
687
|
}
|
|
692
688
|
|
|
693
689
|
preflightRequest.Headers().Insert(L"Access-Control-Request-Headers", headerNames);
|
|
694
|
-
preflightRequest.Headers().Insert(L"Origin", GetOrigin(
|
|
690
|
+
preflightRequest.Headers().Insert(L"Origin", GetOrigin(m_origin));
|
|
695
691
|
preflightRequest.Headers().Insert(L"Sec-Fetch-Mode", L"CORS");
|
|
696
692
|
|
|
697
693
|
co_return {co_await m_innerFilter.SendRequestAsync(preflightRequest)};
|
|
@@ -708,7 +704,7 @@ bool OriginPolicyHttpFilter::OnRedirecting(
|
|
|
708
704
|
// origin=http://a.com. Since the origin matches the URL, the request is authorized at http://a.com, but it actually
|
|
709
705
|
// allows http://b.com to bypass the CORS check at http://a.com since the redirected URL is from http://b.com.
|
|
710
706
|
if (!IsSameOrigin(response.Headers().Location(), request.RequestUri()) &&
|
|
711
|
-
!IsSameOrigin(
|
|
707
|
+
!IsSameOrigin(m_origin, request.RequestUri())) {
|
|
712
708
|
// By masking the origin field in the request header, we make it impossible for the server to set a single value for
|
|
713
709
|
// the access-control-allow-origin header. It means, the only way to support redirect is that server allows access
|
|
714
710
|
// from all sites through wildcard.
|
|
@@ -740,7 +736,7 @@ ResponseOperation OriginPolicyHttpFilter::SendRequestAsync(HttpRequestMessage co
|
|
|
740
736
|
// Allow only HTTP or HTTPS schemes
|
|
741
737
|
if (GetRuntimeOptionBool("Http.StrictScheme") && coRequest.RequestUri().SchemeName() != L"https" &&
|
|
742
738
|
coRequest.RequestUri().SchemeName() != L"http")
|
|
743
|
-
throw hresult_error{E_INVALIDARG, L"Invalid URL scheme: [" +
|
|
739
|
+
throw hresult_error{E_INVALIDARG, L"Invalid URL scheme: [" + m_origin.SchemeName() + L"]"};
|
|
744
740
|
|
|
745
741
|
if (!GetRuntimeOptionBool("Http.OmitCredentials")) {
|
|
746
742
|
coRequest.Properties().Lookup(L"RequestArgs").as<RequestArgs>()->WithCredentials = false;
|
|
@@ -777,7 +773,7 @@ ResponseOperation OriginPolicyHttpFilter::SendRequestAsync(HttpRequestMessage co
|
|
|
777
773
|
|
|
778
774
|
if (originPolicy == OriginPolicy::SimpleCrossOriginResourceSharing ||
|
|
779
775
|
originPolicy == OriginPolicy::CrossOriginResourceSharing) {
|
|
780
|
-
coRequest.Headers().Insert(L"Origin", GetOrigin(
|
|
776
|
+
coRequest.Headers().Insert(L"Origin", GetOrigin(m_origin));
|
|
781
777
|
}
|
|
782
778
|
|
|
783
779
|
auto response = co_await m_innerFilter.SendRequestAsync(coRequest);
|
|
@@ -37,9 +37,6 @@ class OriginPolicyHttpFilter
|
|
|
37
37
|
static std::set<const wchar_t *, CaseInsensitiveComparer> s_corsForbiddenRequestHeaderNamePrefixes;
|
|
38
38
|
static std::set<const wchar_t *, CaseInsensitiveComparer> s_cookieSettingResponseHeaders;
|
|
39
39
|
|
|
40
|
-
// NOTE: Assumes static origin through owning client/resource/module/(React) instance's lifetime.
|
|
41
|
-
static winrt::Windows::Foundation::Uri s_origin;
|
|
42
|
-
|
|
43
40
|
struct AccessControlValues {
|
|
44
41
|
winrt::hstring AllowedOrigin;
|
|
45
42
|
winrt::hstring AllowedCredentials;
|
|
@@ -49,11 +46,11 @@ class OriginPolicyHttpFilter
|
|
|
49
46
|
size_t MaxAge;
|
|
50
47
|
};
|
|
51
48
|
|
|
49
|
+
winrt::Windows::Foundation::Uri m_origin;
|
|
50
|
+
|
|
52
51
|
winrt::Windows::Web::Http::Filters::IHttpFilter m_innerFilter;
|
|
53
52
|
|
|
54
53
|
public:
|
|
55
|
-
static void SetStaticOrigin(std::string &&url);
|
|
56
|
-
|
|
57
54
|
static bool IsSameOrigin(
|
|
58
55
|
winrt::Windows::Foundation::Uri const &u1,
|
|
59
56
|
winrt::Windows::Foundation::Uri const &u2) noexcept;
|
|
@@ -80,9 +77,9 @@ class OriginPolicyHttpFilter
|
|
|
80
77
|
winrt::Windows::Web::Http::HttpResponseMessage const &response,
|
|
81
78
|
bool removeAll);
|
|
82
79
|
|
|
83
|
-
OriginPolicyHttpFilter(winrt::Windows::Web::Http::Filters::IHttpFilter const &innerFilter);
|
|
80
|
+
OriginPolicyHttpFilter(std::string &&origin, winrt::Windows::Web::Http::Filters::IHttpFilter const &innerFilter);
|
|
84
81
|
|
|
85
|
-
OriginPolicyHttpFilter();
|
|
82
|
+
OriginPolicyHttpFilter(std::string &&origin);
|
|
86
83
|
|
|
87
84
|
OriginPolicy ValidateRequest(winrt::Windows::Web::Http::HttpRequestMessage const &request);
|
|
88
85
|
|
|
@@ -641,8 +641,7 @@ void WinRTHttpResource::AddResponseHandler(shared_ptr<IResponseHandler> response
|
|
|
641
641
|
|
|
642
642
|
#pragma region IHttpResource
|
|
643
643
|
|
|
644
|
-
/*static*/ shared_ptr<IHttpResource> IHttpResource::Make(
|
|
645
|
-
winrt::Windows::Foundation::IInspectable const &inspectableProperties) noexcept {
|
|
644
|
+
/*static*/ shared_ptr<IHttpResource> IHttpResource::Make(IInspectable const &inspectableProperties) noexcept {
|
|
646
645
|
using namespace winrt::Microsoft::ReactNative;
|
|
647
646
|
using winrt::Windows::Web::Http::HttpClient;
|
|
648
647
|
|
|
@@ -653,8 +652,7 @@ void WinRTHttpResource::AddResponseHandler(shared_ptr<IResponseHandler> response
|
|
|
653
652
|
client = HttpClient{redirFilter};
|
|
654
653
|
} else {
|
|
655
654
|
auto globalOrigin = GetRuntimeOptionString("Http.GlobalOrigin");
|
|
656
|
-
OriginPolicyHttpFilter
|
|
657
|
-
auto opFilter = winrt::make<OriginPolicyHttpFilter>(redirFilter);
|
|
655
|
+
auto opFilter = winrt::make<OriginPolicyHttpFilter>(std::move(globalOrigin), redirFilter);
|
|
658
656
|
redirFilter.as<RedirectHttpFilter>()->SetRedirectSource(opFilter.as<IRedirectEventSource>());
|
|
659
657
|
|
|
660
658
|
client = HttpClient{opFilter};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-windows",
|
|
3
|
-
"version": "0.73.
|
|
3
|
+
"version": "0.73.11",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -23,13 +23,13 @@
|
|
|
23
23
|
"dependencies": {
|
|
24
24
|
"@babel/runtime": "^7.0.0",
|
|
25
25
|
"@jest/create-cache-key-function": "^29.6.3",
|
|
26
|
-
"@react-native-community/cli": "12.3.
|
|
27
|
-
"@react-native-community/cli-platform-android": "12.3.
|
|
28
|
-
"@react-native-community/cli-platform-ios": "12.3.
|
|
26
|
+
"@react-native-community/cli": "12.3.6",
|
|
27
|
+
"@react-native-community/cli-platform-android": "12.3.6",
|
|
28
|
+
"@react-native-community/cli-platform-ios": "12.3.6",
|
|
29
29
|
"@react-native-windows/cli": "0.73.2",
|
|
30
30
|
"@react-native/assets-registry": "0.73.1",
|
|
31
31
|
"@react-native/codegen": "0.73.3",
|
|
32
|
-
"@react-native/community-cli-plugin": "0.73.
|
|
32
|
+
"@react-native/community-cli-plugin": "0.73.17",
|
|
33
33
|
"@react-native/gradle-plugin": "0.73.4",
|
|
34
34
|
"@react-native/js-polyfills": "0.73.1",
|
|
35
35
|
"@react-native/normalize-colors": "0.73.2",
|
|
@@ -81,7 +81,7 @@
|
|
|
81
81
|
"just-scripts": "^1.3.3",
|
|
82
82
|
"prettier": "^2.4.1",
|
|
83
83
|
"react": "18.2.0",
|
|
84
|
-
"react-native": "0.73.
|
|
84
|
+
"react-native": "0.73.6",
|
|
85
85
|
"react-native-platform-override": "^1.9.16",
|
|
86
86
|
"react-refresh": "^0.4.0",
|
|
87
87
|
"typescript": "^4.9.5"
|