Skip to content

Cached license fields that drive gating are outside the signature #2181

Closed

Description

@datlechin

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:

  • LicenseStorage reads defaults from AppStorageEnvironment.shared.defaults but its keychain is the real login keychain (init(keychain: KeychainHelper = .shared)), bypassing AppStorageEnvironment.shared.keychain that every other store honours. An isolated run can therefore reach the operator's real license key. A SwiftLint custom rule banning bare KeychainHelper outside AppStorageEnvironment would prevent the class of mistake.
  • Configs/Base.xcconfig does #include? "Secrets.xcconfig" and Base is included by both Debug and Release, so a gitignored Secrets.xcconfig setting SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG would apply to a Release build. Any future #if DEBUG security guard rests on that not happening. A strings assertion in scripts/build-release.sh would close it.

Activity

  1. self-assigned this
    on Aug 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions