expo-updates 57.0.13 → 57.0.15
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/CHANGELOG.md +14 -0
- package/android/build.gradle +2 -2
- package/android/src/main/java/expo/modules/updates/UpdatesUtils.kt +11 -0
- package/android/src/main/java/expo/modules/updates/db/Reaper.kt +16 -1
- package/android/src/main/java/expo/modules/updates/loader/FileDownloader.kt +6 -0
- package/android/src/main/java/expo/modules/updates/manifest/ExpoUpdatesUpdate.kt +35 -18
- package/ios/EXUpdates/AppLauncher/AppLauncherWithDatabase.swift +10 -2
- package/ios/EXUpdates/AppLoader/EmbeddedAppLoader.swift +69 -7
- package/ios/EXUpdates/AppLoader/RemoteAppLoader.swift +7 -0
- package/ios/EXUpdates/Database/UpdatesDatabase.swift +5 -1
- package/ios/EXUpdates/Database/UpdatesReaper.swift +4 -0
- package/ios/EXUpdates/Update/Update.swift +15 -1
- package/ios/EXUpdates/UpdatesError.swift +3 -0
- package/ios/EXUpdates/UpdatesUtils.swift +25 -0
- package/ios/EXUpdates.podspec +11 -0
- package/package.json +6 -6
package/CHANGELOG.md
CHANGED
|
@@ -10,6 +10,20 @@
|
|
|
10
10
|
|
|
11
11
|
### 💡 Others
|
|
12
12
|
|
|
13
|
+
## 57.0.15 — 2026-08-17
|
|
14
|
+
|
|
15
|
+
_This version does not introduce any user-facing changes._
|
|
16
|
+
|
|
17
|
+
## 57.0.14 — 2026-08-14
|
|
18
|
+
|
|
19
|
+
### 🐛 Bug fixes
|
|
20
|
+
|
|
21
|
+
- Reject updates whose asset key or file extension contains a path separator, which previously let a manifest write and delete files outside the updates directory. ([#48762](https://github.com/expo/expo/pull/48762), [#48763](https://github.com/expo/expo/pull/48763) by [@alanjhughes](https://github.com/alanjhughes))
|
|
22
|
+
|
|
23
|
+
### 💡 Others
|
|
24
|
+
|
|
25
|
+
- [iOS] Link `libc++` in the test spec so the unit test bundle resolves the C++ symbols it pulls from `ExpoModulesCore`. ([#48762](https://github.com/expo/expo/pull/48762) by [@alanjhughes](https://github.com/alanjhughes))
|
|
26
|
+
|
|
13
27
|
## 57.0.13 — 2026-08-10
|
|
14
28
|
|
|
15
29
|
_This version does not introduce any user-facing changes._
|
package/android/build.gradle
CHANGED
|
@@ -42,7 +42,7 @@ expoModule {
|
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
group = 'host.exp.exponent'
|
|
45
|
-
version = '57.0.
|
|
45
|
+
version = '57.0.15'
|
|
46
46
|
|
|
47
47
|
// Utility method to derive boolean values from the environment or from Java properties,
|
|
48
48
|
// and return them as strings to be used in BuildConfig fields
|
|
@@ -89,7 +89,7 @@ android {
|
|
|
89
89
|
namespace "expo.modules.updates"
|
|
90
90
|
defaultConfig {
|
|
91
91
|
versionCode 31
|
|
92
|
-
versionName '57.0.
|
|
92
|
+
versionName '57.0.15'
|
|
93
93
|
consumerProguardFiles("proguard-rules.pro")
|
|
94
94
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
|
95
95
|
|
|
@@ -166,6 +166,17 @@ object UpdatesUtils {
|
|
|
166
166
|
}
|
|
167
167
|
}
|
|
168
168
|
|
|
169
|
+
/**
|
|
170
|
+
* Asset filenames are built from manifest-controlled values, so a filename holding a path
|
|
171
|
+
* separator or a `..` component would resolve outside the updates directory.
|
|
172
|
+
*/
|
|
173
|
+
fun isSafeFilename(filename: String): Boolean {
|
|
174
|
+
return filename.isNotEmpty() &&
|
|
175
|
+
filename != "." &&
|
|
176
|
+
filename != ".." &&
|
|
177
|
+
filename.none { it == '/' || it == '\\' || it == '\u0000' }
|
|
178
|
+
}
|
|
179
|
+
|
|
169
180
|
fun shouldCheckForUpdateOnLaunch(
|
|
170
181
|
updatesConfiguration: UpdatesConfiguration,
|
|
171
182
|
logger: UpdatesLogger,
|
|
@@ -2,10 +2,12 @@ package expo.modules.updates.db
|
|
|
2
2
|
|
|
3
3
|
import android.util.Log
|
|
4
4
|
import expo.modules.updates.UpdatesConfiguration
|
|
5
|
+
import expo.modules.updates.UpdatesUtils
|
|
5
6
|
import expo.modules.updates.db.entity.AssetEntity
|
|
6
7
|
import expo.modules.updates.db.entity.UpdateEntity
|
|
7
8
|
import expo.modules.updates.manifest.ManifestMetadata
|
|
8
9
|
import expo.modules.updates.selectionpolicy.SelectionPolicy
|
|
10
|
+
import expo.modules.updates.utils.AndroidResourceAssetUtils
|
|
9
11
|
import java.io.File
|
|
10
12
|
|
|
11
13
|
/**
|
|
@@ -47,7 +49,20 @@ object Reaper {
|
|
|
47
49
|
)
|
|
48
50
|
continue
|
|
49
51
|
}
|
|
50
|
-
val
|
|
52
|
+
val relativePath = asset.relativePath
|
|
53
|
+
// Embedded assets are served from the APK, so there is no file here to delete.
|
|
54
|
+
if (relativePath == null || AndroidResourceAssetUtils.isAndroidResourceAsset(relativePath)) {
|
|
55
|
+
continue
|
|
56
|
+
}
|
|
57
|
+
// A row written before asset filenames were validated may point outside the updates directory.
|
|
58
|
+
if (!UpdatesUtils.isSafeFilename(relativePath)) {
|
|
59
|
+
Log.e(
|
|
60
|
+
TAG,
|
|
61
|
+
"Refusing to delete asset with URL " + asset.url + " at unsafe path " + relativePath
|
|
62
|
+
)
|
|
63
|
+
continue
|
|
64
|
+
}
|
|
65
|
+
val path = File(updatesDirectory, relativePath)
|
|
51
66
|
try {
|
|
52
67
|
if (path.exists() && !path.delete()) {
|
|
53
68
|
Log.e(TAG, "Failed to delete asset with URL " + asset.url + " at path " + path.toString())
|
|
@@ -687,6 +687,12 @@ class FileDownloader(
|
|
|
687
687
|
}
|
|
688
688
|
|
|
689
689
|
val filename = UpdatesUtils.createFilenameForAsset(asset)
|
|
690
|
+
if (!UpdatesUtils.isSafeFilename(filename)) {
|
|
691
|
+
val message = "Failed to download asset ${asset.key}"
|
|
692
|
+
val error = IOException("Asset filename \"$filename\" would resolve outside the updates directory")
|
|
693
|
+
logger.error(message, error, UpdatesErrorCode.AssetsFailedToLoad)
|
|
694
|
+
throw IOException(message, error)
|
|
695
|
+
}
|
|
690
696
|
val path = File(destinationDirectory, filename)
|
|
691
697
|
|
|
692
698
|
if (path.exists()) {
|
|
@@ -14,6 +14,7 @@ import expo.modules.updates.db.enums.UpdateStatus
|
|
|
14
14
|
import org.json.JSONArray
|
|
15
15
|
import org.json.JSONException
|
|
16
16
|
import org.json.JSONObject
|
|
17
|
+
import java.io.IOException
|
|
17
18
|
import java.text.ParseException
|
|
18
19
|
import java.util.*
|
|
19
20
|
|
|
@@ -95,27 +96,43 @@ class ExpoUpdatesUpdate private constructor(
|
|
|
95
96
|
companion object {
|
|
96
97
|
private val TAG = Update::class.java.simpleName
|
|
97
98
|
|
|
98
|
-
@Throws(
|
|
99
|
+
@Throws(Exception::class)
|
|
99
100
|
fun fromExpoUpdatesManifest(
|
|
100
101
|
manifest: ExpoUpdatesManifest,
|
|
101
102
|
extensions: JSONObject?,
|
|
102
103
|
configuration: UpdatesConfiguration
|
|
103
|
-
): ExpoUpdatesUpdate
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
104
|
+
): ExpoUpdatesUpdate {
|
|
105
|
+
val update = ExpoUpdatesUpdate(
|
|
106
|
+
manifest,
|
|
107
|
+
id = UUID.fromString(manifest.getID()),
|
|
108
|
+
configuration.scopeKey,
|
|
109
|
+
commitTime = try {
|
|
110
|
+
UpdatesUtils.parseDateString(manifest.getCreatedAt())
|
|
111
|
+
} catch (e: ParseException) {
|
|
112
|
+
Log.e(TAG, "Could not parse manifest createdAt string; falling back to current time", e)
|
|
113
|
+
Date()
|
|
114
|
+
},
|
|
115
|
+
runtimeVersion = manifest.getRuntimeVersion(),
|
|
116
|
+
launchAsset = manifest.getLaunchAsset(),
|
|
117
|
+
assets = manifest.getAssets(),
|
|
118
|
+
extensions = extensions,
|
|
119
|
+
url = configuration.updateUrl,
|
|
120
|
+
requestHeaders = configuration.requestHeaders
|
|
121
|
+
)
|
|
122
|
+
|
|
123
|
+
update.assetEntityList.forEach { asset ->
|
|
124
|
+
val filename = UpdatesUtils.createFilenameForAsset(asset)
|
|
125
|
+
if (!UpdatesUtils.isSafeFilename(filename)) {
|
|
126
|
+
throw IOException(
|
|
127
|
+
"Update ${manifest.getID()} could not be loaded because the asset filename " +
|
|
128
|
+
"\"$filename\" is not a valid filename. Assets are stored under their key and file " +
|
|
129
|
+
"extension, so neither may contain a path separator. Check the server that produced " +
|
|
130
|
+
"this manifest."
|
|
131
|
+
)
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
return update
|
|
136
|
+
}
|
|
120
137
|
}
|
|
121
138
|
}
|
|
@@ -32,6 +32,11 @@ public class AppLauncherWithDatabase: NSObject, AppLauncher {
|
|
|
32
32
|
public var launchAssetUrl: URL?
|
|
33
33
|
public var assetFilesMap: [String: String]?
|
|
34
34
|
|
|
35
|
+
/// Set when the launched update is served directly from the embedded app binary. Tracked
|
|
36
|
+
/// explicitly because `assetFilesMap` is now populated with the bundle-resolved embedded assets,
|
|
37
|
+
/// so it can no longer double as the "using embedded assets" signal.
|
|
38
|
+
private var launchedFromEmbeddedBundle = false
|
|
39
|
+
|
|
35
40
|
private let launcherQueue: DispatchQueue
|
|
36
41
|
private var completedAssets: Int
|
|
37
42
|
private let config: UpdatesConfig
|
|
@@ -54,7 +59,7 @@ public class AppLauncherWithDatabase: NSObject, AppLauncher {
|
|
|
54
59
|
}
|
|
55
60
|
|
|
56
61
|
public func isUsingEmbeddedAssets() -> Bool {
|
|
57
|
-
return
|
|
62
|
+
return launchedFromEmbeddedBundle
|
|
58
63
|
}
|
|
59
64
|
|
|
60
65
|
public static func launchableUpdate(
|
|
@@ -178,7 +183,10 @@ public class AppLauncherWithDatabase: NSObject, AppLauncher {
|
|
|
178
183
|
}
|
|
179
184
|
|
|
180
185
|
if launchedUpdate.status == UpdateStatus.StatusEmbedded {
|
|
181
|
-
|
|
186
|
+
launchedFromEmbeddedBundle = true
|
|
187
|
+
// The embedded update's assets aren't copied into the cache, so resolve them from the app
|
|
188
|
+
// binary. Populating the map here keeps `Updates.localAssets` available instead of empty.
|
|
189
|
+
assetFilesMap = UpdatesUtils.embeddedAssetsMap(withConfig: config, database: database, logger: logger)
|
|
182
190
|
launchAssetUrl = updatesBundle.url(
|
|
183
191
|
forResource: EmbeddedAppLoader.EXUpdatesBareEmbeddedBundleFilename,
|
|
184
192
|
withExtension: EmbeddedAppLoader.EXUpdatesBareEmbeddedBundleFileType
|
|
@@ -8,14 +8,12 @@
|
|
|
8
8
|
import Foundation
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
|
-
* Subclass of AppLoader which
|
|
12
|
-
* expo-updates cache location.
|
|
11
|
+
* Subclass of AppLoader which loads the embedded update.
|
|
13
12
|
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
* redownloaded if included in future updates.
|
|
13
|
+
* By default (`EX_UPDATES_COPY_EMBEDDED_ASSETS` off) the update is registered but its assets aren't
|
|
14
|
+
* read into the database; it keeps StatusEmbedded and launches from the app binary, so first launch
|
|
15
|
+
* stays fast. When the flag is on, assets are read into the database and it launches like any other
|
|
16
|
+
* update, so a later update reusing them avoids a redownload.
|
|
19
17
|
*/
|
|
20
18
|
@objc(EXUpdatesEmbeddedAppLoader)
|
|
21
19
|
@objcMembers
|
|
@@ -29,6 +27,24 @@ public final class EmbeddedAppLoader: AppLoader {
|
|
|
29
27
|
|
|
30
28
|
private static var embeddedManifestInternal: EmbeddedUpdate?
|
|
31
29
|
|
|
30
|
+
/// Whether to read and hash embedded assets into the database on first launch. Defaults to the
|
|
31
|
+
/// build-time `EX_UPDATES_COPY_EMBEDDED_ASSETS` flag (off). Overridable for testing.
|
|
32
|
+
internal var shouldCopyEmbeddedAssets: Bool = UpdatesUtils.shouldCopyEmbeddedAssets()
|
|
33
|
+
|
|
34
|
+
internal let completionQueue: DispatchQueue
|
|
35
|
+
|
|
36
|
+
public required override init(
|
|
37
|
+
config: UpdatesConfig,
|
|
38
|
+
logger: UpdatesLogger,
|
|
39
|
+
database: UpdatesDatabase,
|
|
40
|
+
directory: URL,
|
|
41
|
+
launchedUpdate: Update?,
|
|
42
|
+
completionQueue: DispatchQueue
|
|
43
|
+
) {
|
|
44
|
+
self.completionQueue = completionQueue
|
|
45
|
+
super.init(config: config, logger: logger, database: database, directory: directory, launchedUpdate: launchedUpdate, completionQueue: completionQueue)
|
|
46
|
+
}
|
|
47
|
+
|
|
32
48
|
/**
|
|
33
49
|
Gets the embedded update.
|
|
34
50
|
If the `UpdatesConfig.hasEmbeddedUpdate` is false, it returns nil
|
|
@@ -136,6 +152,18 @@ public final class EmbeddedAppLoader: AppLoader {
|
|
|
136
152
|
self.assetBlock = assetBlock
|
|
137
153
|
self.successBlock = successBlock
|
|
138
154
|
self.errorBlock = errorBlock
|
|
155
|
+
startEmbeddedLoad(fromEmbeddedManifest: embeddedManifest)
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
/// Loads the embedded update: with copying off (default) registers it without ingesting assets,
|
|
159
|
+
/// otherwise loads them like any other update. Separate from `loadUpdateResponseFromEmbeddedManifest`
|
|
160
|
+
/// so tests can pass a manifest without reading the bundle.
|
|
161
|
+
internal func startEmbeddedLoad(fromEmbeddedManifest embeddedManifest: Update) {
|
|
162
|
+
if !shouldCopyEmbeddedAssets {
|
|
163
|
+
registerEmbeddedUpdateWithoutCopying(embeddedManifest)
|
|
164
|
+
return
|
|
165
|
+
}
|
|
166
|
+
|
|
139
167
|
startLoading(fromUpdateResponse: UpdateResponse(
|
|
140
168
|
responseHeaderData: nil,
|
|
141
169
|
manifestUpdateResponsePart: ManifestUpdateResponsePart(updateManifest: embeddedManifest),
|
|
@@ -143,6 +171,40 @@ public final class EmbeddedAppLoader: AppLoader {
|
|
|
143
171
|
))
|
|
144
172
|
}
|
|
145
173
|
|
|
174
|
+
/// Registers the embedded update without reading, hashing, or copying its assets. A StatusEmbedded
|
|
175
|
+
/// update resolves its bundle and assets from the app binary at launch. Tradeoff: a future update
|
|
176
|
+
/// reusing an embedded asset re-downloads it.
|
|
177
|
+
private func registerEmbeddedUpdateWithoutCopying(_ embeddedManifest: Update) {
|
|
178
|
+
database.databaseQueue.async {
|
|
179
|
+
do {
|
|
180
|
+
let existingUpdate = try? self.database.update(withId: embeddedManifest.updateId, config: self.config)
|
|
181
|
+
if existingUpdate == nil {
|
|
182
|
+
try self.database.addUpdate(embeddedManifest, config: self.config)
|
|
183
|
+
}
|
|
184
|
+
// Mark finished (keep = 1) so the reaper retains it; it stays StatusEmbedded since copying is off.
|
|
185
|
+
try self.database.markUpdateFinished(embeddedManifest)
|
|
186
|
+
} catch {
|
|
187
|
+
let errorBlock = self.errorBlock
|
|
188
|
+
self.completionQueue.async {
|
|
189
|
+
errorBlock?(UpdatesError.appLoaderUnknownError(cause: error))
|
|
190
|
+
self.reset()
|
|
191
|
+
}
|
|
192
|
+
return
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
let successBlock = self.successBlock
|
|
196
|
+
let updateResponse = UpdateResponse(
|
|
197
|
+
responseHeaderData: nil,
|
|
198
|
+
manifestUpdateResponsePart: ManifestUpdateResponsePart(updateManifest: embeddedManifest),
|
|
199
|
+
directiveUpdateResponsePart: nil
|
|
200
|
+
)
|
|
201
|
+
self.completionQueue.async {
|
|
202
|
+
successBlock?(updateResponse)
|
|
203
|
+
self.reset()
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
|
|
146
208
|
override public func downloadAsset(_ asset: UpdateAsset, extraHeaders: [String: Any]) {
|
|
147
209
|
FileDownloader.assetFilesQueue.async {
|
|
148
210
|
self.handleAssetDownloadAlreadyExists(asset)
|
|
@@ -105,6 +105,13 @@ public final class RemoteAppLoader: AppLoader {
|
|
|
105
105
|
}
|
|
106
106
|
|
|
107
107
|
override public func downloadAsset(_ asset: UpdateAsset, extraHeaders: [String: Any]) {
|
|
108
|
+
guard UpdatesUtils.isSafeFilename(asset.filename) else {
|
|
109
|
+
self.handleAssetDownload(
|
|
110
|
+
withError: UpdatesError.remoteAppLoaderUnsafeAssetFilename(filename: asset.filename),
|
|
111
|
+
asset: asset
|
|
112
|
+
)
|
|
113
|
+
return
|
|
114
|
+
}
|
|
108
115
|
let urlOnDisk = self.directory.appendingPathComponent(asset.filename)
|
|
109
116
|
|
|
110
117
|
let progressBlock = { [weak self] fractionCompleted in
|
|
@@ -280,7 +280,11 @@ public final class UpdatesDatabase: NSObject {
|
|
|
280
280
|
}
|
|
281
281
|
|
|
282
282
|
public func markUpdateFinished(_ update: Update) throws {
|
|
283
|
-
|
|
283
|
+
// With copying off, embedded updates have no asset rows, so they must stay StatusEmbedded to keep
|
|
284
|
+
// launching from the bundle. Promoting to StatusReady would route launch through the database
|
|
285
|
+
// asset path, which has no rows for them.
|
|
286
|
+
let keepEmbedded = update.status == UpdateStatus.StatusEmbedded && !UpdatesUtils.shouldCopyEmbeddedAssets()
|
|
287
|
+
if update.status != UpdateStatus.StatusDevelopment && !keepEmbedded {
|
|
284
288
|
update.status = UpdateStatus.StatusReady
|
|
285
289
|
}
|
|
286
290
|
|
|
@@ -71,6 +71,10 @@ public final class UpdatesReaper: NSObject {
|
|
|
71
71
|
|
|
72
72
|
let beginDeleteAssets = Date()
|
|
73
73
|
for asset in assetsForDeletion {
|
|
74
|
+
guard UpdatesUtils.isSafeFilename(asset.filename) else {
|
|
75
|
+
logger.warn(message: "Refusing to delete asset at unsafe path \(asset.filename)")
|
|
76
|
+
continue
|
|
77
|
+
}
|
|
74
78
|
let localUrl = directory.appendingPathComponent(asset.filename)
|
|
75
79
|
if FileManager.default.fileExists(atPath: localUrl.path) {
|
|
76
80
|
do {
|
|
@@ -77,6 +77,7 @@ public enum UpdateStatus: Int {
|
|
|
77
77
|
public enum UpdateError: Error, Sendable, LocalizedError {
|
|
78
78
|
case invalidExpoProtocolVersion(protocolVersion: Int)
|
|
79
79
|
case legacyManifestInstantiationInvalid
|
|
80
|
+
case unsafeAssetFilename(updateId: String, filename: String)
|
|
80
81
|
|
|
81
82
|
public var errorDescription: String? {
|
|
82
83
|
switch self {
|
|
@@ -84,6 +85,10 @@ public enum UpdateError: Error, Sendable, LocalizedError {
|
|
|
84
85
|
return "Invalid Expo Updates protocol version: \(protocolVersion)"
|
|
85
86
|
case .legacyManifestInstantiationInvalid:
|
|
86
87
|
return "This version of expo-updates can no longer load legacy manifests"
|
|
88
|
+
case let .unsafeAssetFilename(updateId, filename):
|
|
89
|
+
return "Update \(updateId) could not be loaded because the asset filename \"\(filename)\" " +
|
|
90
|
+
"is not a valid filename. Assets are stored under their key and file extension, so neither " +
|
|
91
|
+
"may contain a path separator. Check the server that produced this manifest."
|
|
87
92
|
}
|
|
88
93
|
}
|
|
89
94
|
}
|
|
@@ -157,12 +162,21 @@ public class Update: NSObject {
|
|
|
157
162
|
}
|
|
158
163
|
switch protocolVersion {
|
|
159
164
|
case 0, 1:
|
|
160
|
-
|
|
165
|
+
let update = ExpoUpdatesUpdate.update(
|
|
161
166
|
withExpoUpdatesManifest: ExpoUpdatesManifest(rawManifestJSON: withManifest),
|
|
162
167
|
extensions: extensions,
|
|
163
168
|
config: config,
|
|
164
169
|
database: database
|
|
165
170
|
)
|
|
171
|
+
try update.assets()?.forEach { asset in
|
|
172
|
+
guard UpdatesUtils.isSafeFilename(asset.filename) else {
|
|
173
|
+
throw UpdateError.unsafeAssetFilename(
|
|
174
|
+
updateId: update.updateId.uuidString,
|
|
175
|
+
filename: asset.filename
|
|
176
|
+
)
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
return update
|
|
166
180
|
default:
|
|
167
181
|
throw UpdateError.invalidExpoProtocolVersion(protocolVersion: protocolVersion)
|
|
168
182
|
}
|
|
@@ -26,6 +26,7 @@ public enum UpdatesError: Error, Sendable, LocalizedError {
|
|
|
26
26
|
case fileDownloaderFailedUpdateIDsFailure(cause: Error)
|
|
27
27
|
case fileDownloaderUnknownError(cause: Error)
|
|
28
28
|
case remoteAppLoaderAssetMissingUrl
|
|
29
|
+
case remoteAppLoaderUnsafeAssetFilename(filename: String)
|
|
29
30
|
case remoteAppLoaderHeaderDataError(cause: Error)
|
|
30
31
|
case remoteAppLoaderUnknownError(cause: Error)
|
|
31
32
|
case appLoaderFailedToLoadAllAssets
|
|
@@ -92,6 +93,8 @@ public enum UpdatesError: Error, Sendable, LocalizedError {
|
|
|
92
93
|
return "Unknown error: \(cause.localizedDescription)"
|
|
93
94
|
case .remoteAppLoaderAssetMissingUrl:
|
|
94
95
|
return "Failed to download asset with no URL provided"
|
|
96
|
+
case let .remoteAppLoaderUnsafeAssetFilename(filename):
|
|
97
|
+
return "Failed to download asset: filename \"\(filename)\" would resolve outside the updates directory"
|
|
95
98
|
case let .remoteAppLoaderHeaderDataError(cause):
|
|
96
99
|
return "Error persisting header data to disk: \(cause.localizedDescription)"
|
|
97
100
|
case .appLoaderFailedToLoadAllAssets:
|
|
@@ -75,6 +75,23 @@ public final class UpdatesUtils: NSObject {
|
|
|
75
75
|
return updatesDirectory
|
|
76
76
|
}
|
|
77
77
|
|
|
78
|
+
/**
|
|
79
|
+
* Asset filenames are built from manifest-controlled values, so a filename holding a path
|
|
80
|
+
* separator or a `..` component would resolve outside the updates directory.
|
|
81
|
+
*
|
|
82
|
+
* Matching is done on unicode scalars because `String.contains` compares grapheme clusters, and
|
|
83
|
+
* a separator followed by a combining mark forms one cluster that does not equal the separator.
|
|
84
|
+
* The filesystem still sees the separator byte.
|
|
85
|
+
*/
|
|
86
|
+
public static func isSafeFilename(_ filename: String) -> Bool {
|
|
87
|
+
return !filename.isEmpty &&
|
|
88
|
+
filename != "." &&
|
|
89
|
+
filename != ".." &&
|
|
90
|
+
!filename.unicodeScalars.contains("/") &&
|
|
91
|
+
!filename.unicodeScalars.contains("\\") &&
|
|
92
|
+
!filename.unicodeScalars.contains("\0")
|
|
93
|
+
}
|
|
94
|
+
|
|
78
95
|
// MARK: - Internal methods
|
|
79
96
|
|
|
80
97
|
public static func defaultNativeStateMachineContextJson() -> [String: Any?] {
|
|
@@ -165,6 +182,14 @@ public final class UpdatesUtils: NSObject {
|
|
|
165
182
|
#endif
|
|
166
183
|
}
|
|
167
184
|
|
|
185
|
+
internal static func shouldCopyEmbeddedAssets() -> Bool {
|
|
186
|
+
#if EX_UPDATES_COPY_EMBEDDED_ASSETS
|
|
187
|
+
return true
|
|
188
|
+
#else
|
|
189
|
+
return false
|
|
190
|
+
#endif
|
|
191
|
+
}
|
|
192
|
+
|
|
168
193
|
internal static func runBlockOnMainThread(_ block: @escaping () -> Void) {
|
|
169
194
|
if Thread.isMainThread {
|
|
170
195
|
block()
|
package/ios/EXUpdates.podspec
CHANGED
|
@@ -9,6 +9,9 @@ end
|
|
|
9
9
|
if ENV['EX_UPDATES_CUSTOM_INIT'] != '1'
|
|
10
10
|
ENV['EX_UPDATES_CUSTOM_INIT'] = podfile_properties['updatesCustomInit'] == 'true' ? '1' : '0'
|
|
11
11
|
end
|
|
12
|
+
if ENV['EX_UPDATES_COPY_EMBEDDED_ASSETS'] != '1'
|
|
13
|
+
ENV['EX_UPDATES_COPY_EMBEDDED_ASSETS'] = podfile_properties['updatesCopyEmbeddedAssets'] == 'true' ? '1' : '0'
|
|
14
|
+
end
|
|
12
15
|
|
|
13
16
|
use_dev_client = false
|
|
14
17
|
begin
|
|
@@ -72,6 +75,7 @@ Pod::Spec.new do |s|
|
|
|
72
75
|
|
|
73
76
|
ex_updates_native_debug = ENV['EX_UPDATES_NATIVE_DEBUG'] == '1'
|
|
74
77
|
ex_updates_custom_init = ENV['EX_UPDATES_CUSTOM_INIT'] == '1'
|
|
78
|
+
ex_updates_copy_embedded_assets = ENV['EX_UPDATES_COPY_EMBEDDED_ASSETS'] == '1'
|
|
75
79
|
if ex_updates_native_debug
|
|
76
80
|
other_debug_c_flags << ' -DEX_UPDATES_NATIVE_DEBUG=1'
|
|
77
81
|
other_debug_swift_flags << ' -DEX_UPDATES_NATIVE_DEBUG'
|
|
@@ -82,6 +86,12 @@ Pod::Spec.new do |s|
|
|
|
82
86
|
other_release_c_flags << ' -DEX_UPDATES_CUSTOM_INIT=1'
|
|
83
87
|
other_release_swift_flags << ' -DEX_UPDATES_CUSTOM_INIT'
|
|
84
88
|
end
|
|
89
|
+
if ex_updates_copy_embedded_assets
|
|
90
|
+
other_debug_c_flags << ' -DEX_UPDATES_COPY_EMBEDDED_ASSETS=1'
|
|
91
|
+
other_debug_swift_flags << ' -DEX_UPDATES_COPY_EMBEDDED_ASSETS'
|
|
92
|
+
other_release_c_flags << ' -DEX_UPDATES_COPY_EMBEDDED_ASSETS=1'
|
|
93
|
+
other_release_swift_flags << ' -DEX_UPDATES_COPY_EMBEDDED_ASSETS'
|
|
94
|
+
end
|
|
85
95
|
if use_dev_client
|
|
86
96
|
other_debug_c_flags << ' -DUSE_DEV_CLIENT=1'
|
|
87
97
|
other_debug_swift_flags << ' -DUSE_DEV_CLIENT'
|
|
@@ -141,6 +151,7 @@ Pod::Spec.new do |s|
|
|
|
141
151
|
test_spec.dependency 'ExpoModulesTestCore'
|
|
142
152
|
|
|
143
153
|
test_spec.pod_target_xcconfig = {
|
|
154
|
+
'OTHER_LDFLAGS' => '$(inherited) -lc++',
|
|
144
155
|
'USER_HEADER_SEARCH_PATHS' => '"${CONFIGURATION_TEMP_DIR}/EXUpdates.build/DerivedSources"',
|
|
145
156
|
'GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS' => 'YES',
|
|
146
157
|
'GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS' => 'YES',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "expo-updates",
|
|
3
|
-
"version": "57.0.
|
|
3
|
+
"version": "57.0.15",
|
|
4
4
|
"description": "Fetches and manages remotely-hosted assets and updates to your app's JS bundle.",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"types": "build/index.d.ts",
|
|
@@ -60,10 +60,10 @@
|
|
|
60
60
|
"picomatch": "^4.0.4",
|
|
61
61
|
"ts-node": "^10.9.2",
|
|
62
62
|
"xstate": "^4.37.2",
|
|
63
|
-
"expo": "57.0.
|
|
64
|
-
"expo-
|
|
65
|
-
"expo-
|
|
66
|
-
"
|
|
63
|
+
"expo": "57.0.14",
|
|
64
|
+
"@expo/metro-config": "57.0.8",
|
|
65
|
+
"expo-dev-client": "57.0.13",
|
|
66
|
+
"expo-module-scripts": "56.0.3"
|
|
67
67
|
},
|
|
68
68
|
"peerDependencies": {
|
|
69
69
|
"expo": "*",
|
|
@@ -82,7 +82,7 @@
|
|
|
82
82
|
"./scripts/with-node.sh"
|
|
83
83
|
]
|
|
84
84
|
},
|
|
85
|
-
"gitHead": "
|
|
85
|
+
"gitHead": "391d762fa5059cebf63ef2381da93994ce97fc63",
|
|
86
86
|
"scripts": {
|
|
87
87
|
"build": "expo-module build",
|
|
88
88
|
"clean": "expo-module clean",
|