Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion .github/workflows/build-sidestore-source.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@ jobs:
- name: Apply reviewed signing overlay
if: steps.signing-cache.outputs.cache-hit != 'true'
run: python3 scripts/prepare_sidestore_source.py sidestore-source
- name: Test pinned Increased Memory Limit Apple capability requests
if: steps.signing-cache.outputs.cache-hit != 'true'
working-directory: sidestore-source/Dependencies/SideSign
run: |
set -o pipefail
swift test --filter CapabilityTests 2>&1 | tee ../../../sidesign-memory-tests.log
- name: Archive custom SideStore
if: steps.signing-cache.outputs.cache-hit != 'true'
working-directory: sidestore-source
Expand Down Expand Up @@ -62,5 +68,7 @@ jobs:
if: always()
with:
name: sidestore-source-logs
path: sidestore-build.log
path: |
sidestore-build.log
sidesign-memory-tests.log
if-no-files-found: warn
61 changes: 57 additions & 4 deletions Integrations/SideStore/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,11 @@ bundle ID or icon, and configure supported dylib/DEB injection presets before pr
When enabled, `LSSupportsOpeningDocumentsInPlace` is also set so the app's Documents
directory is available to Files. It does not expose unrelated sandbox directories.
The original value is displayed on load and preserved by default.
- **Remove App Extensions** is visible only when the IPA contains `.appex` bundles in
`PlugIns`. It is disabled by default, removes those extension bundles from the
staged copy and may break extension-dependent features such as widgets and sharing.
Other embedded resources and executables are retained.
- **Manage App Extensions** is visible only when the IPA contains `.appex` bundles in
`PlugIns`. Every extension is retained by default; selected extensions can be
omitted individually from the staging copy. Removing extensions may break
extension-dependent features such as widgets and sharing. Other resources
and executables remain untouched.
- **Manage injected libraries** opens the existing validated injection preset UI, keyed
to the effective bundle ID. No unsupported device-limit bypass or fictitious Apple
account/signing selector is offered.
Expand All @@ -60,6 +61,58 @@ private staging directory and hands it back to SideStore. Signing, provisioning,
installation and their errors still belong to the real SideStore pipeline. Empty/invalid
choices fail before handoff. Cancel leaves the original IPA untouched.

## Increased Memory Limit (GetMoreRam workflow)

The **Increased Memory Limit** toggle in Advanced Install is **off by default**. It
prepares a user-requested installation option, not a forged Apple entitlement.
The host adds the internal `LCOSIncreasedMemoryLimitRequested` marker to the
**main application only** in the disposable IPA copy. Clearing the toggle
also clears a pre-existing marker; extensions are unaffected.

During the *real* source-built SideStore install pipeline:
1. SideStore finds or creates the Apple App ID for the **effective signed bundle
identifier**, using the account already signed in to SideStore.
2. `FetchProvisioningProfilesOperation` requests the
`INCREASED_MEMORY_LIMIT` capability on that App ID before downloading
a new provisioning profile. The pinned SideSign patch uses Apple Developer
Services' v1 `bundleIdCapabilities` PATCH (the mechanism used by
[GetMoreRam](https://github.com/hugeBlack/GetMoreRam)).
3. The operation checks the **actual profile** contains
`com.apple.developer.kernel.increased-memory-limit = true`.
If not, installation **fails with a visible error**, rather than silently
proceeding with a normal-memory profile. A user-selected override profile
without the entitlement is rejected as well.
4. The pinned SideSign signer may retain this entitlement **only for an opted-in
main app whose provisioning profile explicitly grants it**. It never grants
it to app extensions or to apps installed by the ordinary workflow.

A profile entitlement does not add physical RAM or promise a fixed memory
budget; the memory budget is device- and iOS-dependent. Internet access,
Apple account authentication and Apple's approval are necessary. After
installing, a device test must inspect both the installed app's signature
and its provisioning profile to prove the entitlement actually survived.

The feature does not modify the original input IPA, bypass signature checks,
revoke another App ID, or change the ordinary installation/refresh flow.
Account credentials remain managed exclusively by SideStore. We do **not**
ship or embed GetMoreRam or ask the user to log in to a second service.

### Pinned dependency / safety gate

`scripts/prepare_sidestore_source.py` checks out the existing SideStore
revision and its SideSign `752d1ef` submodule, then cherry-picks the
**exact** SideSign pull request
[SideSign #4](https://github.com/SideStore/SideSign/pull/4) commit
`9d89dac1d391c934e5c69be1fadbb090d9a7f944` *without committing*.
The patch request's HEAD must match the pinned SHA, and the modified file
list is verified. It keeps SideStore's existing 2FA fix. The builder patches
the memory-only signer check, verifies the profile operation, runs the
SideSign `CapabilityTests`, and records the source hashes in the build
manifest. The IPA verifier refuses an artifact lacking this provenance.

This is an experimental feature until real Apple profile/signature verification
on an iPhone. A green Xcode build cannot establish an increased memory budget.

## Extension bundle identifiers

The single-profile path now fetches the profile under the effective target bundle ID and keys its
Expand Down
14 changes: 14 additions & 0 deletions LiveContainerSwiftUI/PackageManager/Core/SigningAdvanced.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import Foundation

enum SigningAdvanced {
/// Explicit host Advanced Install request, never a claim that Apple granted
/// the entitlement. The source-built SideStore validates the signed profile.
static let increasedMemoryRequestKey = "LCOSIncreasedMemoryLimitRequested"

struct App {
let url: URL
let name: String
Expand All @@ -23,6 +27,9 @@ enum SigningAdvanced {
struct Options: Sendable {
var enableFileSharing: Bool
var removeAppExtensions: Bool = false
/// The Apple App ID capability and signing entitlement are handled
/// later by SideStore, not by this metadata-only IPA editor.
var enableIncreasedMemoryLimit: Bool = false
/// Individual .appex names to omit from the staged IPA before signing.
var excludedExtensionNames: Set<String> = []
}
Expand Down Expand Up @@ -120,6 +127,13 @@ enum SigningAdvanced {
if bundle == app.url {
plist["CFBundleDisplayName"] = name; plist["CFBundleName"] = name
plist["UIFileSharingEnabled"] = options.enableFileSharing
// Only a user-selected Advanced Install may write this opt-in.
// A disabled selection clears stale requests from an imported IPA.
if options.enableIncreasedMemoryLimit {
plist[increasedMemoryRequestKey] = true
} else {
plist.removeValue(forKey: increasedMemoryRequestKey)
}
if options.enableFileSharing {
// Also expose Documents in the Files app; this alone cannot
// grant access to a sandbox outside the app's Documents folder.
Expand Down
20 changes: 18 additions & 2 deletions LiveContainerSwiftUI/PackageManager/LCAdvancedInstallView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ struct LCAdvancedInstallView: View {
@State private var identifier = ""
@State private var ipaFilename = ""
@State private var enableFileSharing = false
@State private var enableIncreasedMemoryLimit = false
@State private var excludedExtensions: Set<String> = []
@State private var managingExtensions = false
@State private var icon: Data?
Expand Down Expand Up @@ -154,6 +155,17 @@ struct LCAdvancedInstallView: View {
Toggle(isOn: $enableFileSharing) {
Label("lcos.install.fileSharing".installLoc, systemImage: "folder")
}
Toggle(isOn: $enableIncreasedMemoryLimit) {
Label("lcos.install.increasedMemory".installLoc, systemImage: "memorychip")
}
.accessibilityHint("lcos.install.increasedMemoryHelp".installLoc)
if enableIncreasedMemoryLimit {
Label("lcos.install.increasedMemoryWarning".installLoc,
systemImage: "exclamationmark.triangle")
.font(.footnote)
.foregroundStyle(.secondary)
.fixedSize(horizontal: false, vertical: true)
}
if app.extensionCount > 0 {
Button { managingExtensions = true } label: {
HStack(spacing: 12) {
Expand All @@ -177,7 +189,8 @@ struct LCAdvancedInstallView: View {
} header: {
Text("lcos.install.options".installLoc)
} footer: {
Text("lcos.install.fileSharingHelp".installLoc)
Text("lcos.install.fileSharingHelp".installLoc + "\n" +
"lcos.install.increasedMemoryHelp".installLoc)
}
.disabled(working)
}
Expand Down Expand Up @@ -357,7 +370,9 @@ struct LCAdvancedInstallView: View {
if let workspace { try? FileManager.default.removeItem(at: workspace) }
workspace = directory; app = inspected; name = inspected.name; identifier = inspected.identifier
ipaFilename = source.lastPathComponent; icon = nil
enableFileSharing = inspected.fileSharingEnabled; excludedExtensions.removeAll()
enableFileSharing = inspected.fileSharingEnabled
enableIncreasedMemoryLimit = false
excludedExtensions.removeAll()
SigningDiagnostics.record("advanced.extract.end", inspected.identifier)
} catch { try? FileManager.default.removeItem(at: directory); throw error }
} catch { SigningDiagnostics.failure("advanced.extract.failed", error); failure = error.localizedDescription }
Expand All @@ -370,6 +385,7 @@ struct LCAdvancedInstallView: View {
let icon = icon
let options = SigningAdvanced.Options(enableFileSharing: enableFileSharing,
removeAppExtensions: false,
enableIncreasedMemoryLimit: enableIncreasedMemoryLimit,
excludedExtensionNames: excludedExtensions)
do {
guard let group = LCSharedUtils.appGroupPath() else { throw SigningInjectionFailure.invalid("Shared app group unavailable") }
Expand Down
3 changes: 3 additions & 0 deletions Resources/Localizable.xcstrings
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
{
"sourceLanguage" : "en",
"strings" : {
"lcos.install.increasedMemory" : {"extractionState":"manual","localizations":{"en":{"stringUnit":{"state":"translated","value":"Increased Memory Limit"}},"ru":{"stringUnit":{"state":"translated","value":"Увеличенный лимит памяти"}}}},
"lcos.install.increasedMemoryHelp" : {"extractionState":"manual","localizations":{"en":{"stringUnit":{"state":"translated","value":"Requests the Increased Memory Limit capability for this app's Apple App ID. SideStore must obtain a provisioning profile with the entitlement and reinstall the app. Available memory depends on the device; no RAM is physically added."}},"ru":{"stringUnit":{"state":"translated","value":"Запрашивает у Apple возможность Increased Memory Limit для App ID приложения. SideStore должен получить профиль с этим разрешением и переустановить приложение. Доступная память зависит от устройства; физическая ОЗУ не увеличивается."}}}},
"lcos.install.increasedMemoryWarning" : {"extractionState":"manual","localizations":{"en":{"stringUnit":{"state":"translated","value":"Requires signing into SideStore with an Apple ID and access to Apple Developer Services. If Apple refuses the capability or the profile lacks the entitlement, the installation will stop instead of claiming success."}},"ru":{"stringUnit":{"state":"translated","value":"Необходим вход в SideStore с Apple ID и доступ к Apple Developer Services. Если Apple отклонит запрос или в профиле не окажется разрешения, установка будет остановлена."}}}},
"lcos.home.scrollIndicator" : {"extractionState":"manual","localizations":{"en":{"stringUnit":{"state":"translated","value":"Show scroll indicator"}},"ru":{"stringUnit":{"state":"translated","value":"Показывать индикатор прокрутки"}}}},
"lcos.home.nativeScrollEdge" : {"extractionState":"manual","localizations":{"en":{"stringUnit":{"state":"translated","value":"System scroll blur"}},"ru":{"stringUnit":{"state":"translated","value":"Системное размытие при прокрутке"}}}},
"lcos.home.nativeScrollEdgeDescription" : {"extractionState":"manual","localizations":{"en":{"stringUnit":{"state":"translated","value":"Uses iOS's native scroll-edge rendering where supported. No artificial material overlays. The app grid scrolls continuously without pages."}},"ru":{"stringUnit":{"state":"translated","value":"Используется системный эффект iOS, если поддерживается. Без искусственных полупрозрачных полос. Сетка приложений прокручивается непрерывно без страниц."}}}},
Expand Down
34 changes: 34 additions & 0 deletions Tests/PackageCoreTests/AdvancedInstallTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,40 @@ final class AdvancedInstallTests: XCTestCase {
XCTAssertEqual(plist["LSSupportsOpeningDocumentsInPlace"] as? Bool, true)
}

func testIncreasedMemoryLimitOptInSetsRealSigningRequestOnlyForMainApp() throws {
let (root, app) = try fixture()
defer { try? FileManager.default.removeItem(at: root) }
try SigningAdvanced.customize(app, name: app.name, identifier: app.identifier,
iconPNG: nil, options: .init(enableFileSharing: false, enableIncreasedMemoryLimit: true))
let main = try XCTUnwrap(PropertyListSerialization.propertyList(
from: Data(contentsOf: app.url.appendingPathComponent("Info.plist")),
format: nil) as? [String: Any])
let extensionInfo = try XCTUnwrap(PropertyListSerialization.propertyList(
from: Data(contentsOf: app.url.appendingPathComponent("PlugIns/Widget.appex/Info.plist")),
format: nil) as? [String: Any])
XCTAssertEqual(main[SigningAdvanced.increasedMemoryRequestKey] as? Bool, true)
XCTAssertNil(extensionInfo[SigningAdvanced.increasedMemoryRequestKey])
XCTAssertEqual(try SigningAdvanced.inspect(root).extensionCount, 1)
// This editor writes an explicit request, not a forged entitlement.
XCTAssertNil(main["com.apple.developer.kernel.increased-memory-limit"])
}

func testIncreasedMemoryLimitOffIsDefaultAndClearsUntrustedOrOldRequest() throws {
let (root, app) = try fixture()
defer { try? FileManager.default.removeItem(at: root) }
let plistURL = app.url.appendingPathComponent("Info.plist")
var main = try XCTUnwrap(PropertyListSerialization.propertyList(
from: Data(contentsOf: plistURL), format: nil) as? [String: Any])
main[SigningAdvanced.increasedMemoryRequestKey] = true
try PropertyListSerialization.data(fromPropertyList: main, format: .xml, options: 0)
.write(to: plistURL)
try SigningAdvanced.customize(app, name: app.name, identifier: app.identifier,
iconPNG: nil)
let after = try XCTUnwrap(PropertyListSerialization.propertyList(
from: Data(contentsOf: plistURL), format: nil) as? [String: Any])
XCTAssertNil(after[SigningAdvanced.increasedMemoryRequestKey])
}

func testRemoveAppExtensionsRetainsExecutableAndAppIdentity() throws {
let (root, app) = try fixture(); defer { try? FileManager.default.removeItem(at: root) }
let executable = try Data(contentsOf: app.url.appendingPathComponent("Test"))
Expand Down
Loading
Loading