react-native-windows 0.72.23 → 0.72.25
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.
|
@@ -10,11 +10,11 @@
|
|
|
10
10
|
-->
|
|
11
11
|
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
12
12
|
<PropertyGroup>
|
|
13
|
-
<ReactNativeWindowsVersion>0.72.
|
|
13
|
+
<ReactNativeWindowsVersion>0.72.25</ReactNativeWindowsVersion>
|
|
14
14
|
<ReactNativeWindowsMajor>0</ReactNativeWindowsMajor>
|
|
15
15
|
<ReactNativeWindowsMinor>72</ReactNativeWindowsMinor>
|
|
16
|
-
<ReactNativeWindowsPatch>
|
|
16
|
+
<ReactNativeWindowsPatch>25</ReactNativeWindowsPatch>
|
|
17
17
|
<ReactNativeWindowsCanary>false</ReactNativeWindowsCanary>
|
|
18
|
-
<ReactNativeWindowsCommitId>
|
|
18
|
+
<ReactNativeWindowsCommitId>21a119eff71ffc407a118a2f68ed1c7696843328</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 {
|
|
@@ -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
|
@@ -153,6 +153,7 @@
|
|
|
153
153
|
<ClCompile Include="$(MSBuildThisFileDirectory)DevSupportManager.cpp" />
|
|
154
154
|
<ClCompile Include="$(MSBuildThisFileDirectory)Executors\WebSocketJSExecutor.cpp" />
|
|
155
155
|
<ClCompile Include="$(MSBuildThisFileDirectory)Executors\WebSocketJSExecutorFactory.cpp" />
|
|
156
|
+
<ClCompile Include="$(MSBuildThisFileDirectory)Hasher.cpp" />
|
|
156
157
|
<ClCompile Include="$(MSBuildThisFileDirectory)HermesRuntimeHolder.cpp" />
|
|
157
158
|
<ClCompile Include="$(MSBuildThisFileDirectory)HermesSamplingProfiler.cpp" />
|
|
158
159
|
<ClCompile Include="$(MSBuildThisFileDirectory)InspectorPackagerConnection.cpp" />
|
|
@@ -264,6 +264,7 @@
|
|
|
264
264
|
<Filter>Hermes</Filter>
|
|
265
265
|
</ClCompile>
|
|
266
266
|
<ClCompile Include="$(NodeApiJsiDir)src\ApiLoaders\HermesApi.cpp" />
|
|
267
|
+
<ClCompile Include="$(MSBuildThisFileDirectory)Hasher.cpp" />
|
|
267
268
|
<ClCompile Include="$(MSBuildThisFileDirectory)JSI\V8RuntimeHolder.cpp" />
|
|
268
269
|
<ClCompile Include="$(MSBuildThisFileDirectory)SafeLoadLibrary.cpp" />
|
|
269
270
|
<ClCompile Include="$(MSBuildThisFileDirectory)V8JSIRuntimeHolder.cpp" />
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-windows",
|
|
3
|
-
"version": "0.72.
|
|
3
|
+
"version": "0.72.25",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"@react-native-community/cli": "11.3.7",
|
|
27
27
|
"@react-native-community/cli-platform-android": "11.3.7",
|
|
28
28
|
"@react-native-community/cli-platform-ios": "11.3.7",
|
|
29
|
-
"@react-native-windows/cli": "0.72.
|
|
29
|
+
"@react-native-windows/cli": "0.72.5",
|
|
30
30
|
"@react-native/assets": "1.0.0",
|
|
31
31
|
"@react-native/assets-registry": "^0.72.0",
|
|
32
32
|
"@react-native/codegen": "^0.72.7",
|