react-native-windows 0.71.19 → 0.71.21
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/Microsoft.ReactNative.Managed/packages.lock.json +4 -30
- package/PropertySheets/Generated/PackageVersion.g.props +3 -3
- package/Shared/BaseScriptStoreImpl.cpp +42 -13
- package/Shared/Hasher.cpp +64 -0
- package/Shared/Hasher.h +24 -0
- package/Shared/Shared.vcxitems +1 -0
- package/Shared/Shared.vcxitems.filters +1 -0
- package/package.json +4 -4
|
@@ -24,11 +24,6 @@
|
|
|
24
24
|
"Microsoft.SourceLink.Common": "1.0.0"
|
|
25
25
|
}
|
|
26
26
|
},
|
|
27
|
-
"boost": {
|
|
28
|
-
"type": "Transitive",
|
|
29
|
-
"resolved": "1.76.0",
|
|
30
|
-
"contentHash": "p+w3YvNdXL8Cu9Fzrmexssu0tZbWxuf6ywsQqHjDlKFE5ojXHof1HIyMC3zDLfLnh80dIeFcEUAuR2Asg/XHRA=="
|
|
31
|
-
},
|
|
32
27
|
"Microsoft.Build.Tasks.Git": {
|
|
33
28
|
"type": "Transitive",
|
|
34
29
|
"resolved": "1.0.0",
|
|
@@ -58,36 +53,21 @@
|
|
|
58
53
|
"Microsoft.NETCore.Platforms": {
|
|
59
54
|
"type": "Transitive",
|
|
60
55
|
"resolved": "2.1.0",
|
|
61
|
-
"contentHash": "
|
|
56
|
+
"contentHash": "ok+RPAtESz/9MUXeIEz6Lv5XAGQsaNmEYXMsgVALj4D7kqC8gveKWXWXbufLySR2fWrwZf8smyN5RmHu0e4BHA=="
|
|
62
57
|
},
|
|
63
58
|
"Microsoft.SourceLink.Common": {
|
|
64
59
|
"type": "Transitive",
|
|
65
60
|
"resolved": "1.0.0",
|
|
66
61
|
"contentHash": "G8DuQY8/DK5NN+3jm5wcMcd9QYD90UV7MiLmdljSJixi3U/vNaeBKmmXUqI4DJCOeWizIUEh4ALhSt58mR+5eg=="
|
|
67
62
|
},
|
|
68
|
-
"Microsoft.UI.Xaml": {
|
|
69
|
-
"type": "Transitive",
|
|
70
|
-
"resolved": "2.7.0",
|
|
71
|
-
"contentHash": "dB4im13tfmMgL/V3Ei+3kD2rUF+/lTxAmR4gjJ45l577eljHfdo/KUrxpq/3I1Vp6e5GCDG1evDaEGuDxypLMg=="
|
|
72
|
-
},
|
|
73
|
-
"Microsoft.Windows.SDK.BuildTools": {
|
|
74
|
-
"type": "Transitive",
|
|
75
|
-
"resolved": "10.0.22000.194",
|
|
76
|
-
"contentHash": "4L0P3zqut466SIqT3VBeLTNUQTxCBDOrTRymRuROCRJKazcK7ibLz9yAO1nKWRt50ttCj39oAa2Iuz9ZTDmLlg=="
|
|
77
|
-
},
|
|
78
63
|
"NETStandard.Library": {
|
|
79
64
|
"type": "Transitive",
|
|
80
65
|
"resolved": "2.0.3",
|
|
81
|
-
"contentHash": "
|
|
66
|
+
"contentHash": "st47PosZSHrjECdjeIzZQbzivYBJFv6P2nv4cj2ypdI204DO+vZ7l5raGMiX4eXMJ53RfOIg+/s4DHVZ54Nu2A==",
|
|
82
67
|
"dependencies": {
|
|
83
68
|
"Microsoft.NETCore.Platforms": "1.1.0"
|
|
84
69
|
}
|
|
85
70
|
},
|
|
86
|
-
"ReactNative.Hermes.Windows": {
|
|
87
|
-
"type": "Transitive",
|
|
88
|
-
"resolved": "0.71.1",
|
|
89
|
-
"contentHash": "q38h/Gkw8d0pfUqIhRCd1j/XLhpQY4Hm7kSQthZUzetEST34acbR883/Eh+DKt4FVz9a0lh5kiAfP7piO768SA=="
|
|
90
|
-
},
|
|
91
71
|
"runtime.win10-arm.Microsoft.Net.Native.Compiler": {
|
|
92
72
|
"type": "Transitive",
|
|
93
73
|
"resolved": "2.2.7-rel-27913-00",
|
|
@@ -164,7 +144,6 @@
|
|
|
164
144
|
"folly": {
|
|
165
145
|
"type": "Project",
|
|
166
146
|
"dependencies": {
|
|
167
|
-
"boost": "[1.76.0, )",
|
|
168
147
|
"fmt": "[1.0.0, )"
|
|
169
148
|
}
|
|
170
149
|
},
|
|
@@ -173,18 +152,13 @@
|
|
|
173
152
|
"dependencies": {
|
|
174
153
|
"Common": "[1.0.0, )",
|
|
175
154
|
"Folly": "[1.0.0, )",
|
|
176
|
-
"
|
|
177
|
-
"Microsoft.Windows.SDK.BuildTools": "[10.0.22000.194, )",
|
|
178
|
-
"ReactCommon": "[1.0.0, )",
|
|
179
|
-
"ReactNative.Hermes.Windows": "[0.71.1, )",
|
|
180
|
-
"boost": "[1.76.0, )"
|
|
155
|
+
"ReactCommon": "[1.0.0, )"
|
|
181
156
|
}
|
|
182
157
|
},
|
|
183
158
|
"reactcommon": {
|
|
184
159
|
"type": "Project",
|
|
185
160
|
"dependencies": {
|
|
186
|
-
"Folly": "[1.0.0, )"
|
|
187
|
-
"boost": "[1.76.0, )"
|
|
161
|
+
"Folly": "[1.0.0, )"
|
|
188
162
|
}
|
|
189
163
|
}
|
|
190
164
|
},
|
|
@@ -10,11 +10,11 @@
|
|
|
10
10
|
-->
|
|
11
11
|
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
12
12
|
<PropertyGroup>
|
|
13
|
-
<ReactNativeWindowsVersion>0.71.
|
|
13
|
+
<ReactNativeWindowsVersion>0.71.21</ReactNativeWindowsVersion>
|
|
14
14
|
<ReactNativeWindowsMajor>0</ReactNativeWindowsMajor>
|
|
15
15
|
<ReactNativeWindowsMinor>71</ReactNativeWindowsMinor>
|
|
16
|
-
<ReactNativeWindowsPatch>
|
|
16
|
+
<ReactNativeWindowsPatch>21</ReactNativeWindowsPatch>
|
|
17
17
|
<ReactNativeWindowsCanary>false</ReactNativeWindowsCanary>
|
|
18
|
-
<ReactNativeWindowsCommitId>
|
|
18
|
+
<ReactNativeWindowsCommitId>558faa07e799af7b36c2654a505161ae152b2c36</ReactNativeWindowsCommitId>
|
|
19
19
|
</PropertyGroup>
|
|
20
20
|
</Project>
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
#include "pch.h"
|
|
5
5
|
|
|
6
6
|
#include "BaseScriptStoreImpl.h"
|
|
7
|
+
#include "Hasher.h"
|
|
7
8
|
#include "MemoryMappedBuffer.h"
|
|
8
9
|
|
|
9
10
|
#include <CppRuntimeOptions.h>
|
|
@@ -92,6 +93,7 @@ struct PreparedScriptPrefix {
|
|
|
92
93
|
jsi::ScriptVersion_t scriptVersion;
|
|
93
94
|
jsi::JSRuntimeVersion_t runtimeVersion;
|
|
94
95
|
uint64_t sizeInBytes;
|
|
96
|
+
std::uint8_t hash[32];
|
|
95
97
|
};
|
|
96
98
|
|
|
97
99
|
struct PreparedScriptSuffix {
|
|
@@ -197,40 +199,40 @@ std::string BasePreparedScriptStoreImpl::getPreparedScriptFileName(
|
|
|
197
199
|
// Essentially, we are trying to construct,
|
|
198
200
|
// prep_<source_url>_<runtime_id>_<preparation_tag>.cache
|
|
199
201
|
|
|
200
|
-
std::string
|
|
202
|
+
std::string preparedScriptFileName("prep_");
|
|
201
203
|
|
|
202
204
|
const std::string &scriptUrl = scriptSignature.url;
|
|
203
205
|
|
|
204
206
|
// As a crude heuristic we choose the last 64 characters of the source url.
|
|
205
207
|
constexpr int MAXLENGTH = 64;
|
|
206
|
-
|
|
208
|
+
preparedScriptFileName.append(
|
|
207
209
|
scriptUrl.begin() + ((scriptUrl.size() < MAXLENGTH) ? 0 : (scriptUrl.size() - MAXLENGTH)), scriptUrl.end());
|
|
208
210
|
|
|
209
211
|
// Make a valid file name.
|
|
210
|
-
std::replace(
|
|
211
|
-
std::replace(
|
|
212
|
-
std::replace(
|
|
213
|
-
std::replace(
|
|
212
|
+
std::replace(preparedScriptFileName.begin(), preparedScriptFileName.end(), '\\', '_');
|
|
213
|
+
std::replace(preparedScriptFileName.begin(), preparedScriptFileName.end(), '/', '_');
|
|
214
|
+
std::replace(preparedScriptFileName.begin(), preparedScriptFileName.end(), ':', '_');
|
|
215
|
+
std::replace(preparedScriptFileName.begin(), preparedScriptFileName.end(), '.', '_');
|
|
214
216
|
|
|
215
217
|
if (runtimeSignature.runtimeName.empty()) {
|
|
216
218
|
std::terminate();
|
|
217
219
|
}
|
|
218
220
|
|
|
219
|
-
|
|
220
|
-
|
|
221
|
+
preparedScriptFileName.append("_");
|
|
222
|
+
preparedScriptFileName.append(runtimeSignature.runtimeName);
|
|
221
223
|
|
|
222
224
|
if (prepareTag) {
|
|
223
|
-
|
|
224
|
-
|
|
225
|
+
preparedScriptFileName.append("_");
|
|
226
|
+
preparedScriptFileName.append(prepareTag);
|
|
225
227
|
}
|
|
226
228
|
|
|
227
|
-
// TODO :: Need to
|
|
229
|
+
// TODO :: Need to construct a hash. ref:
|
|
228
230
|
// https://en.wikipedia.org/wiki/Base64#Filenames
|
|
229
231
|
|
|
230
232
|
// extension
|
|
231
|
-
|
|
233
|
+
preparedScriptFileName.append(".cache");
|
|
232
234
|
|
|
233
|
-
return
|
|
235
|
+
return preparedScriptFileName;
|
|
234
236
|
}
|
|
235
237
|
|
|
236
238
|
std::shared_ptr<const jsi::Buffer> BasePreparedScriptStoreImpl::tryGetPreparedScript(
|
|
@@ -269,6 +271,24 @@ std::shared_ptr<const jsi::Buffer> BasePreparedScriptStoreImpl::tryGetPreparedSc
|
|
|
269
271
|
return nullptr;
|
|
270
272
|
}
|
|
271
273
|
|
|
274
|
+
std::optional<std::vector<std::uint8_t>> hashBuffer = Microsoft::ReactNative::GetSHA256Hash(
|
|
275
|
+
reinterpret_cast<const std::uint8_t *>(buffer->data()) + sizeof(PreparedScriptPrefix),
|
|
276
|
+
static_cast<size_t>(prefix->sizeInBytes));
|
|
277
|
+
if (!hashBuffer) {
|
|
278
|
+
// Hashing failed.
|
|
279
|
+
return nullptr;
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
if (hashBuffer.value().size() < sizeof(prefix->hash)) {
|
|
283
|
+
// Unexpected hash size.
|
|
284
|
+
return nullptr;
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
if (memcmp(hashBuffer.value().data(), prefix->hash, sizeof(prefix->hash)) != 0) {
|
|
288
|
+
// Hash doesn't match. Store is possibly corrupted. It is safer to bail out.
|
|
289
|
+
return nullptr;
|
|
290
|
+
}
|
|
291
|
+
|
|
272
292
|
const PreparedScriptSuffix *suffix = reinterpret_cast<const PreparedScriptSuffix *>(
|
|
273
293
|
buffer->data() + sizeof(PreparedScriptPrefix) + prefix->sizeInBytes);
|
|
274
294
|
if (strncmp(suffix->eof, PERSIST_EOF, sizeof(suffix->eof)) != 0) {
|
|
@@ -297,6 +317,15 @@ void BasePreparedScriptStoreImpl::persistPreparedScript(
|
|
|
297
317
|
prefix->runtimeVersion = runtimeMetadata.version;
|
|
298
318
|
prefix->sizeInBytes = preparedScript->size();
|
|
299
319
|
|
|
320
|
+
std::optional<std::vector<std::uint8_t>> hashBuffer =
|
|
321
|
+
Microsoft::ReactNative::GetSHA256Hash(preparedScript->data(), preparedScript->size());
|
|
322
|
+
if (!hashBuffer) {
|
|
323
|
+
// Hashing failed.
|
|
324
|
+
std::terminate();
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
memcpy_s(prefix->hash, sizeof(prefix->hash), hashBuffer.value().data(), hashBuffer.value().size());
|
|
328
|
+
|
|
300
329
|
memcpy_s(
|
|
301
330
|
newBuffer->data() + sizeof(PreparedScriptPrefix),
|
|
302
331
|
newBuffer->size() - sizeof(PreparedScriptPrefix),
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
#include "pch.h"
|
|
2
|
+
#include "Hasher.h"
|
|
3
|
+
|
|
4
|
+
#ifndef NT_SUCCESS
|
|
5
|
+
#define NT_SUCCESS(Status) ((NTSTATUS)(Status) >= 0)
|
|
6
|
+
#endif // NT_SUCCESS
|
|
7
|
+
|
|
8
|
+
#define CheckNTSuccess(s) \
|
|
9
|
+
do { \
|
|
10
|
+
NTSTATUS status = (s); \
|
|
11
|
+
if (!NT_SUCCESS(status)) { \
|
|
12
|
+
throw status; \
|
|
13
|
+
} \
|
|
14
|
+
} while (false)
|
|
15
|
+
|
|
16
|
+
namespace Microsoft::ReactNative {
|
|
17
|
+
|
|
18
|
+
std::optional<std::vector<std::uint8_t>> GetSHA256Hash(const void *pb, size_t cb) {
|
|
19
|
+
try {
|
|
20
|
+
SHA256Hasher hasher;
|
|
21
|
+
hasher.HashData(pb, cb);
|
|
22
|
+
return hasher.GetHashValue();
|
|
23
|
+
} catch (...) {
|
|
24
|
+
return std::nullopt;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
SHA256Hasher::SHA256Hasher() {
|
|
29
|
+
CheckNTSuccess(BCryptOpenAlgorithmProvider(&m_hAlg, BCRYPT_SHA256_ALGORITHM, NULL, 0));
|
|
30
|
+
|
|
31
|
+
DWORD cbObject;
|
|
32
|
+
DWORD cbData;
|
|
33
|
+
CheckNTSuccess(BCryptGetProperty(m_hAlg, BCRYPT_OBJECT_LENGTH, (PBYTE)&cbObject, sizeof(DWORD), &cbData, 0));
|
|
34
|
+
|
|
35
|
+
m_hashObject.resize(cbObject);
|
|
36
|
+
CheckNTSuccess(
|
|
37
|
+
BCryptCreateHash(m_hAlg, &m_hHash, m_hashObject.data(), static_cast<ULONG>(m_hashObject.size()), NULL, 0, 0));
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
SHA256Hasher::~SHA256Hasher() {
|
|
41
|
+
BCryptDestroyHash(m_hHash);
|
|
42
|
+
BCryptCloseAlgorithmProvider(m_hAlg, 0);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
void SHA256Hasher::HashData(const void *pb, size_t cb) {
|
|
46
|
+
if (cb > LONG_MAX) {
|
|
47
|
+
// Input too large
|
|
48
|
+
throw E_INVALIDARG;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
CheckNTSuccess(BCryptHashData(m_hHash, (PBYTE)pb, (DWORD)cb, 0));
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
std::vector<std::uint8_t> SHA256Hasher::GetHashValue() {
|
|
55
|
+
DWORD hashLength;
|
|
56
|
+
DWORD cbData;
|
|
57
|
+
CheckNTSuccess(BCryptGetProperty(m_hAlg, BCRYPT_HASH_LENGTH, (PBYTE)&hashLength, sizeof(DWORD), &cbData, 0));
|
|
58
|
+
|
|
59
|
+
std::vector<uint8_t> hashValue(hashLength, 0);
|
|
60
|
+
CheckNTSuccess(BCryptFinishHash(m_hHash, &hashValue[0], static_cast<ULONG>(hashValue.size()), 0));
|
|
61
|
+
|
|
62
|
+
return hashValue;
|
|
63
|
+
}
|
|
64
|
+
} // namespace Microsoft::ReactNative
|
package/Shared/Hasher.h
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
#include <bcrypt.h>
|
|
2
|
+
#include <optional>
|
|
3
|
+
#include <vector>
|
|
4
|
+
|
|
5
|
+
namespace Microsoft::ReactNative {
|
|
6
|
+
std::optional<std::vector<std::uint8_t>> GetSHA256Hash(const void *pb, size_t cb);
|
|
7
|
+
|
|
8
|
+
class SHA256Hasher {
|
|
9
|
+
public:
|
|
10
|
+
SHA256Hasher();
|
|
11
|
+
~SHA256Hasher();
|
|
12
|
+
|
|
13
|
+
SHA256Hasher(const SHA256Hasher &) = delete;
|
|
14
|
+
SHA256Hasher &operator=(const SHA256Hasher &) = delete;
|
|
15
|
+
|
|
16
|
+
std::vector<std::uint8_t> GetHashValue();
|
|
17
|
+
void HashData(const void *pb, size_t cb);
|
|
18
|
+
|
|
19
|
+
private:
|
|
20
|
+
BCRYPT_ALG_HANDLE m_hAlg;
|
|
21
|
+
BCRYPT_HASH_HANDLE m_hHash;
|
|
22
|
+
std::vector<std::uint8_t> m_hashObject;
|
|
23
|
+
};
|
|
24
|
+
} // namespace Microsoft::ReactNative
|
package/Shared/Shared.vcxitems
CHANGED
|
@@ -25,6 +25,7 @@
|
|
|
25
25
|
<ClCompile Include="$(MSBuildThisFileDirectory)DevSupportManager.cpp" />
|
|
26
26
|
<ClCompile Include="$(MSBuildThisFileDirectory)Executors\WebSocketJSExecutor.cpp" />
|
|
27
27
|
<ClCompile Include="$(MSBuildThisFileDirectory)Executors\WebSocketJSExecutorFactory.cpp" />
|
|
28
|
+
<ClCompile Include="$(MSBuildThisFileDirectory)Hasher.cpp" />
|
|
28
29
|
<ClCompile Include="$(MSBuildThisFileDirectory)HermesRuntimeHolder.cpp" />
|
|
29
30
|
<ClCompile Include="$(MSBuildThisFileDirectory)HermesSamplingProfiler.cpp" />
|
|
30
31
|
<ClCompile Include="$(MSBuildThisFileDirectory)HermesShim.cpp" />
|
|
@@ -156,6 +156,7 @@
|
|
|
156
156
|
<Filter>Source Files\Modules</Filter>
|
|
157
157
|
</ClCompile>
|
|
158
158
|
<ClCompile Include="$(ReactNativeWindowsDir)Microsoft.ReactNative\Utils\ImageUtils.cpp" />
|
|
159
|
+
<ClCompile Include="$(MSBuildThisFileDirectory)Hasher.cpp" />
|
|
159
160
|
</ItemGroup>
|
|
160
161
|
<ItemGroup>
|
|
161
162
|
<Filter Include="Source Files">
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-windows",
|
|
3
|
-
"version": "0.71.
|
|
3
|
+
"version": "0.71.21",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"@react-native-community/cli": "10.2.2",
|
|
27
27
|
"@react-native-community/cli-platform-android": "10.2.0",
|
|
28
28
|
"@react-native-community/cli-platform-ios": "10.2.1",
|
|
29
|
-
"@react-native-windows/cli": "0.71.
|
|
29
|
+
"@react-native-windows/cli": "0.71.10",
|
|
30
30
|
"@react-native/assets": "1.0.0",
|
|
31
31
|
"@react-native/normalize-color": "2.1.0",
|
|
32
32
|
"@react-native/polyfills": "2.0.0",
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
"ws": "^6.2.2"
|
|
59
59
|
},
|
|
60
60
|
"devDependencies": {
|
|
61
|
-
"@react-native-windows/codegen": "0.71.
|
|
61
|
+
"@react-native-windows/codegen": "0.71.5",
|
|
62
62
|
"@rnw-scripts/babel-react-native-config": "0.0.0",
|
|
63
63
|
"@rnw-scripts/eslint-config": "1.1.14",
|
|
64
64
|
"@rnw-scripts/jest-out-of-tree-snapshot-resolver": "^1.1.0",
|
|
@@ -85,7 +85,7 @@
|
|
|
85
85
|
"react-native": "^0.71.0"
|
|
86
86
|
},
|
|
87
87
|
"beachball": {
|
|
88
|
-
"defaultNpmTag": "
|
|
88
|
+
"defaultNpmTag": "v0.71-stable",
|
|
89
89
|
"disallowedChangeTypes": [
|
|
90
90
|
"major",
|
|
91
91
|
"minor",
|