Repository navigation
Description
Found while investigating whether a screenshot test could legitimately render a Starter-gated screen. Not caused by any current branch.
Problem
LicenseManager.loadCachedLicense verifies the signed payload and then throws the result away:
_ = try verifier.verify(payload: cached.signedPayload)LicenseSignatureVerifier signs only payload.data. Every field that actually drives gating lives on the unsigned outer License struct: status, tier, expiresAt, lastValidatedAt, machineId. evaluateStatus and currentTier read exclusively from those unsigned fields.
Impact
Any local process can write a License blob into com.TablePro.license.payload in UserDefaults with status active and tier team, and unlock every paid feature offline, on a shipped notarized build. The signature check passes because the payload it verifies is never compared against the fields that are used.
This is a paid-feature bypass, not a data-loss bug, so it is not urgent in the safety sense. It does mean the current gating is advisory.
Suggested fix
Bind the outer License to the verified payload rather than trusting it. LicensePayloadData already carries status, tier, expiresAt and licenseKey, so keep the return value of verify(payload:) and reconstruct those from it, reducing the outer struct to a cache envelope. Add machineId to the server-signed payload and compare the verified value.
Related
Two adjacent observations from the same investigation, worth their own decision:
LicenseStoragereads defaults fromAppStorageEnvironment.shared.defaultsbut its keychain is the real login keychain (init(keychain: KeychainHelper = .shared)), bypassingAppStorageEnvironment.shared.keychainthat every other store honours. An isolated run can therefore reach the operator's real license key. A SwiftLint custom rule banning bareKeychainHelperoutsideAppStorageEnvironmentwould prevent the class of mistake.Configs/Base.xcconfigdoes#include? "Secrets.xcconfig"and Base is included by both Debug and Release, so a gitignoredSecrets.xcconfigsettingSWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUGwould apply to a Release build. Any future#if DEBUGsecurity guard rests on that not happening. Astringsassertion inscripts/build-release.shwould close it.
Activity