Skip to content

Commit 945994a

Browse files
committed
fix: reject stale user-installed plugins with outdated PluginKit version
1 parent 83208d7 commit 945994a

1 file changed

Lines changed: 16 additions & 1 deletion

File tree

TablePro/Core/Plugins/PluginManager.swift

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import TableProPluginKit
1212
@MainActor @Observable
1313
final class PluginManager {
1414
static let shared = PluginManager()
15-
static let currentPluginKitVersion = 1
15+
static let currentPluginKitVersion = 2
1616
private static let disabledPluginsKey = "com.TablePro.disabledPlugins"
1717
private static let legacyDisabledPluginsKey = "disabledPlugins"
1818

@@ -161,6 +161,15 @@ final class PluginManager {
161161
}
162162

163163
if source == .userInstalled {
164+
// User-installed plugins compiled against an older DriverPlugin protocol
165+
// have stale witness tables — accessing protocol properties crashes with
166+
// EXC_BAD_ACCESS. Reject them before loading the bundle.
167+
if pluginKitVersion < Self.currentPluginKitVersion {
168+
throw PluginError.incompatibleVersion(
169+
required: Self.currentPluginKitVersion,
170+
current: pluginKitVersion
171+
)
172+
}
164173
try verifyCodeSignature(bundle: bundle)
165174
}
166175

@@ -191,6 +200,12 @@ final class PluginManager {
191200
}
192201

193202
if source == .userInstalled {
203+
if pluginKitVersion < Self.currentPluginKitVersion {
204+
throw PluginError.incompatibleVersion(
205+
required: Self.currentPluginKitVersion,
206+
current: pluginKitVersion
207+
)
208+
}
194209
try verifyCodeSignature(bundle: bundle)
195210
}
196211

0 commit comments

Comments
 (0)