Skip to content
Merged
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
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: Release

# Builds the installers on macOS, Windows and Linux and publishes them as a GitHub release when a version tag is
# pushed (v0.1.0-alpha.4). A tag with a pre-release part (-alpha, -beta, -rc) becomes a pre-release. The release
# pushed (v0.1.0-alpha.5). A tag with a pre-release part (-alpha, -beta, -rc) becomes a pre-release. The release
# notes come from docs/releases/<version>.md. Every file gets a Sigstore signature (<file>.sigstore.json) made with
# this workflow's GitHub identity, so anyone can check it was built here from that tag. The macOS app is signed with
# IPAForge's self-signed certificate (secrets MAC_CODESIGN_P12 and MAC_CODESIGN_PASSWORD), so the keychain
Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# IPAForge

[![CI](https://github.com/SirReaDy/ipaforge/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/SirReaDy/ipaforge/actions/workflows/ci.yml)
[![Downloads](https://img.shields.io/github/downloads/SirReaDy/ipaforge/total?label=downloads)](https://github.com/SirReaDy/ipaforge/releases)
[![Latest release](https://img.shields.io/github/v/release/SirReaDy/ipaforge?include_prereleases&label=release)](https://github.com/SirReaDy/ipaforge/releases/latest)
[![CI](https://github.com/IPAForge/ipaforge/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/IPAForge/ipaforge/actions/workflows/ci.yml)
[![Downloads](https://img.shields.io/github/downloads/IPAForge/ipaforge/total?label=downloads)](https://github.com/IPAForge/ipaforge/releases)
[![Latest release](https://img.shields.io/github/v/release/IPAForge/ipaforge?include_prereleases&label=release)](https://github.com/IPAForge/ipaforge/releases/latest)
[![Licence: AGPL-3.0](https://img.shields.io/badge/licence-AGPL--3.0-blue.svg)](LICENSE)
[![Sponsor](https://img.shields.io/badge/sponsor-%E2%9D%A4-ea4aaa?logo=githubsponsors)](https://github.com/sponsors/SirReaDy)

**Install SideStore and your own apps on iPhone and iPad with a free Apple ID, from Windows, macOS or Linux.**

**[Website](https://ipaforge.github.io)** · **[Download](https://github.com/SirReaDy/ipaforge/releases)** · **[Discord](https://discord.gg/C87DKmAWhr)** · [Installing](docs/installing.md) · [Roadmap](docs/roadmap.md)
**[Website](https://ipaforge.github.io)** · **[Download](https://github.com/IPAForge/ipaforge/releases)** · **[Discord](https://discord.gg/C87DKmAWhr)** · [Installing](docs/installing.md) · [Roadmap](docs/roadmap.md)

IPAForge is a free, open-source desktop app for sideloading. You plug in your iPhone, sign in with your Apple ID, and it does the rest:

Expand All @@ -19,7 +19,7 @@ IPAForge is a free, open-source desktop app for sideloading. You plug in your iP
After that it keeps them working: it shows when each app expires, refreshes them before they do, repairs SideStore when it stops refreshing, and explains every failure with the fixes that apply. The whole engine, code signing included, is written in TypeScript, with no native helpers or bundled command-line tools.

> [!NOTE]
> **Alpha, 0.1.0-alpha.4.** Builds for macOS, Windows and Linux are on the [Releases page](https://github.com/SirReaDy/ipaforge/releases), and IPAForge updates itself from there. It isn't notarised or code-signed for Windows yet: [how to open it the first time](docs/installing.md#opening-ipaforge-the-first-time). Questions and feedback: [Discord](https://discord.gg/C87DKmAWhr) or [Issues](https://github.com/SirReaDy/ipaforge/issues).
> **Alpha, 0.1.0-alpha.5.** Builds for macOS, Windows and Linux are on the [Releases page](https://github.com/IPAForge/ipaforge/releases), and IPAForge updates itself from there. It isn't notarised or code-signed for Windows yet: [how to open it the first time](docs/installing.md#opening-ipaforge-the-first-time). Questions and feedback: [Discord](https://discord.gg/C87DKmAWhr) or [Issues](https://github.com/IPAForge/ipaforge/issues).

## Why IPAForge

Expand Down
2 changes: 1 addition & 1 deletion apps/desktop/electron-builder.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ afterSign: build/after-sign.mjs

publish:
provider: github
owner: SirReaDy
owner: IPAForge
repo: ipaforge
releaseType: prerelease

Expand Down
4 changes: 2 additions & 2 deletions apps/desktop/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ipaforge/desktop",
"version": "0.1.0-alpha.4",
"version": "0.1.0-alpha.5",
"license": "AGPL-3.0-or-later",
"private": true,
"type": "module",
Expand Down Expand Up @@ -43,6 +43,6 @@
"productName": "IPAForge",
"description": "Install SideStore and preload your apps onto iPhone and iPad.",
"author": "Dan Motpan",
"homepage": "https://github.com/SirReaDy/ipaforge",
"homepage": "https://ipaforge.github.io",
"desktopName": "ipaforge.desktop"
}
4 changes: 2 additions & 2 deletions apps/desktop/src/main/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
* verifying the email or accepting the agreement). Each entry is an origin and the path the page must start with.
*/
export const allowedExternalLinks = [
{ origin: 'https://github.com', path: '/SirReaDy/ipaforge/issues/new' },
{ origin: 'https://github.com', path: '/SirReaDy/ipaforge/releases' },
{ origin: 'https://github.com', path: '/IPAForge/ipaforge/issues/new' },
{ origin: 'https://github.com', path: '/IPAForge/ipaforge/releases' },
{ origin: 'https://account.apple.com', path: '/' },
{ origin: 'https://developer.apple.com', path: '/account' }
] as const
Expand Down
10 changes: 5 additions & 5 deletions apps/desktop/src/main/external-links.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ describe('isAllowedExternalLink', () => {
it('allows a new IPAForge issue and Apple’s account and developer pages', () => {
expect(
isAllowedExternalLink(
'https://github.com/SirReaDy/ipaforge/issues/new?title=x&body=y'
'https://github.com/IPAForge/ipaforge/issues/new?title=x&body=y'
)
).toBe(true)
expect(isAllowedExternalLink('https://account.apple.com')).toBe(true)
Expand All @@ -18,10 +18,10 @@ describe('isAllowedExternalLink', () => {
it('refuses everything else', () => {
for (const url of [
// eslint-disable-next-line sonarjs/no-clear-text-protocols -- plain HTTP must be refused
'http://github.com/SirReaDy/ipaforge/issues/new',
'https://github.com/SirReaDy/ipaforge/settings',
'https://github.com/SirReaDy/ipaforge/issues/newer',
'https://github.com.evil.example/SirReaDy/ipaforge/issues/new',
'http://github.com/IPAForge/ipaforge/issues/new',
'https://github.com/IPAForge/ipaforge/settings',
'https://github.com/IPAForge/ipaforge/issues/newer',
'https://github.com.evil.example/IPAForge/ipaforge/issues/new',
'https://user:pass@account.apple.com',
'https://developer.apple.com/download',
'file:///etc/passwd',
Expand Down
15 changes: 12 additions & 3 deletions apps/desktop/src/main/updates/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,20 @@ import type { ManualFile } from '@desktop/main/updates/types.ts'
import type { ManualPackage } from '@ipaforge/rpc'

/** IPAForge's releases on GitHub: each one's page, and its files under `download/`. */
export const RELEASES_URL = 'https://github.com/SirReaDy/ipaforge/releases'
export const RELEASES_URL = 'https://github.com/IPAForge/ipaforge/releases'

/** Who signs IPAForge's releases: its release workflow, through GitHub's OIDC issuer (`release.yml` on a tag). */
export const RELEASE_WORKFLOW_IDENTITY =
/**
* Who signs IPAForge's releases: its release workflow (`release.yml` on a tag), through GitHub's OIDC issuer. The
* repository moved from SirReaDy/ipaforge to the IPAForge organization; releases made before the move carry the
* old name, so both are accepted, and nothing else.
*/
export const RELEASE_WORKFLOWS = [
'https://github.com/IPAForge/ipaforge/.github/workflows/release.yml',
'https://github.com/SirReaDy/ipaforge/.github/workflows/release.yml'
] as const

/** What sigstore-js says when a signature is valid but made by someone else. */
export const UNTRUSTED_SIGNER = 'UNTRUSTED_SIGNER_ERROR'
export const SIGSTORE_ISSUER = 'https://token.actions.githubusercontent.com'

/** How long the check may take before IPAForge opens without it (offline, a slow network). */
Expand Down
52 changes: 45 additions & 7 deletions apps/desktop/src/main/updates/sigstore-verifier.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,32 +18,70 @@ const setup = (verifyBundle = vi.fn(async () => ({}))) => {
return { verifier, fetchJson, verifyBundle }
}

const ORG = 'https://github.com/IPAForge/ipaforge/.github/workflows/release.yml'
const OLD = 'https://github.com/SirReaDy/ipaforge/.github/workflows/release.yml'

/** sigstore-js's error for a valid signature made by another workflow. */
const untrusted = () =>
Object.assign(new Error('certificate identity error'), {
code: 'UNTRUSTED_SIGNER_ERROR'
})

describe('createSigstoreVerifier', () => {
it("checks the file's signature from its release, for the release workflow on the version's own tag", async () => {
const { verifier, fetchJson, verifyBundle } = setup()

await verifier.verify(FILE, VERSION)

expect(fetchJson).toHaveBeenCalledWith(
`https://github.com/SirReaDy/ipaforge/releases/download/v${VERSION}/IPAForge-${VERSION}-win-x64.exe.sigstore.json`
`https://github.com/IPAForge/ipaforge/releases/download/v${VERSION}/IPAForge-${VERSION}-win-x64.exe.sigstore.json`
)
expect(verifyBundle).toHaveBeenCalledWith(BUNDLE, Buffer.from([1, 2, 3]), {
certificateIssuer: 'https://token.actions.githubusercontent.com',
certificateIdentityURI: `https://github.com/SirReaDy/ipaforge/.github/workflows/release.yml@refs/tags/v${VERSION}`,
certificateIdentityURI: `${ORG}@refs/tags/v${VERSION}`,
tufCachePath: '/data/sigstore'
})
})

it('rejects when the signature does not verify', async () => {
const { verifier } = setup(
vi.fn(async () => {
throw new Error('signature verification failed')
})
it('accepts a release made before the move to the organization', async () => {
const verifyBundle = vi
.fn()
.mockRejectedValueOnce(untrusted())
.mockResolvedValueOnce({})
const { verifier } = setup(verifyBundle)

await verifier.verify(FILE, VERSION)

expect(
verifyBundle.mock.calls.map(
([, , options]) =>
(options as { certificateIdentityURI: string }).certificateIdentityURI
)
).toEqual([`${ORG}@refs/tags/v${VERSION}`, `${OLD}@refs/tags/v${VERSION}`])
})

it('refuses a signature made by any other workflow', async () => {
const verifyBundle = vi.fn(async () => {
throw untrusted()
})
const { verifier } = setup(verifyBundle)

await expect(verifier.verify(FILE, VERSION)).rejects.toThrow(
'certificate identity error'
)
expect(verifyBundle).toHaveBeenCalledTimes(2)
})

it('rejects a broken signature at once, without trying the other workflow', async () => {
const verifyBundle = vi.fn(async () => {
throw new Error('signature verification failed')
})
const { verifier } = setup(verifyBundle)

await expect(verifier.verify(FILE, VERSION)).rejects.toThrow(
'signature verification failed'
)
expect(verifyBundle).toHaveBeenCalledOnce()
})

it('rejects when the release has no signature for the file', async () => {
Expand Down
37 changes: 25 additions & 12 deletions apps/desktop/src/main/updates/sigstore-verifier.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// An update installs only if its file carries a Sigstore signature from IPAForge's release workflow for that very
// version: the release workflow signs every file it publishes (`cosign sign-blob`, keyless, with GitHub's OIDC
// An update installs only if its file carries a Sigstore signature from IPAForge's release workflow (under the
// repository's current name or its earlier one) for that very version: the release workflow signs every file it publishes (`cosign sign-blob`, keyless, with GitHub's OIDC
// identity), and the signature is checked here against Sigstore's public logs. A file changed after the release,
// or published by anything other than `release.yml` on the version's own tag, is refused.
import { Buffer } from 'node:buffer'
Expand All @@ -8,15 +8,19 @@ import { basename } from 'node:path'
import { verify } from 'sigstore'

import {
RELEASE_WORKFLOW_IDENTITY,
RELEASE_WORKFLOWS,
RELEASES_URL,
SIGSTORE_ISSUER
SIGSTORE_ISSUER,
UNTRUSTED_SIGNER
} from '@desktop/main/updates/constants.ts'
import type {
UpdateVerifier,
UpdateVerifierDeps
} from '@desktop/main/updates/types.ts'

const isUntrustedSigner = (error: unknown): boolean =>
(error as { code?: unknown } | undefined)?.code === UNTRUSTED_SIGNER

export const createSigstoreVerifier = ({
fetchJson,
readFile,
Expand All @@ -33,14 +37,23 @@ export const createSigstoreVerifier = ({
})
})
const bytes = await readFile(file)
await verifyBundle(
bundle as Parameters<typeof verify>[0],
Buffer.from(bytes.buffer, bytes.byteOffset, bytes.byteLength),
{
certificateIssuer: SIGSTORE_ISSUER,
certificateIdentityURI: `${RELEASE_WORKFLOW_IDENTITY}@refs/tags/v${version}`,
tufCachePath
const data = Buffer.from(bytes.buffer, bytes.byteOffset, bytes.byteLength)
// Each workflow in turn: only "signed by someone else" moves on to the next; any other failure is final.
const verifyAs = async (workflows: readonly string[]): Promise<void> => {
const [workflow, ...others] = workflows
if (!workflow) return
try {
await verifyBundle(bundle as Parameters<typeof verify>[0], data, {
certificateIssuer: SIGSTORE_ISSUER,
certificateIdentityURI: `${workflow}@refs/tags/v${version}`,
tufCachePath
})
} catch (error) {
if (others.length === 0 || !isUntrustedSigner(error)) throw error
await verifyAs(others)
}
)
}

await verifyAs(RELEASE_WORKFLOWS)
}
})
6 changes: 3 additions & 3 deletions apps/desktop/src/main/updates/update-service.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ describe('createUpdateService', () => {
phase: 'failed',
version: NEXT,
reason: 'net::ERR_CONNECTION_RESET',
url: `https://github.com/SirReaDy/ipaforge/releases/tag/v${NEXT}`
url: `https://github.com/IPAForge/ipaforge/releases/tag/v${NEXT}`
})

service.retry()
Expand Down Expand Up @@ -216,7 +216,7 @@ describe('createUpdateService', () => {
version: NEXT,
packageType: kind,
fileName,
url: `https://github.com/SirReaDy/ipaforge/releases/download/v${NEXT}/${fileName}`
url: `https://github.com/IPAForge/ipaforge/releases/download/v${NEXT}/${fileName}`
})
expect(updater.port.download).not.toHaveBeenCalled()
}
Expand All @@ -230,7 +230,7 @@ describe('createUpdateService', () => {
phase: 'manual',
version: NEXT,
packageType: 'other',
url: `https://github.com/SirReaDy/ipaforge/releases/tag/v${NEXT}`
url: `https://github.com/IPAForge/ipaforge/releases/tag/v${NEXT}`
})
})
})
1 change: 1 addition & 0 deletions docs/design/roadmap.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ Every feature below maps to the phases that deliver it. "Automatic" means the us
- [x] release 0.1.0-alpha.2: the first release with the self-signed macOS app, the extra installers and Sigstore signatures (#65)
- [x] release 0.1.0-alpha.3: app sources, detailed install progress and the Apps section with SideStore-style refresh (#69)
- [x] release 0.1.0-alpha.4: Repair SideStore, SideStore QR codes, the on-device checklist, faster Wi-Fi installs, and the first version that updates itself, every update checked against its release's Sigstore signature (#75)
- [x] release 0.1.0-alpha.5, the first from the IPAForge organization: updates look for releases there (accepting signatures from the repository's old name too), the website and the AGPL-3.0 licence (#77)
- [x] auto-update on launch with electron-updater from the GitHub releases: the window waits behind an update screen while IPAForge checks, downloads (with progress) and installs the new version, then reopens; offline or a slow check opens the app, a failed download offers Try again, the release page or going on; copies from a .msi, .deb or .rpm, which can't update themselves, name the file to download. The state reaches the UI over its own MessagePort (`serveUpdates`/`createUpdateClient` in `@ipaforge/rpc`). What's new opens once after an update (the notes in New, Changed, Fixed and Removed lists) and the changelog page lists every version; the notes are in English, bundled in the UI (#74)
- [x] every update is checked before it installs: its file must carry a Sigstore signature from `release.yml` on that version's own tag (sigstore-js against Sigstore's public logs), else the update screen says it failed; an install that fails before IPAForge quits says so too. Two small pnpm patches (`patches/`) name SHA-256 where `@sigstore/core` and `@tufjs/models` verify EC and RSA signatures without a hash: OpenSSL assumes it, Electron's BoringSSL refuses (`NO_DEFAULT_DIGEST`) (#74)
- [x] the certificates the OS trusts (company proxies, self-hosted anisette servers with their own CA) are trusted for Apple and anisette requests and by Node's default, alongside Node's bundled roots and Apple's (`tls.getCACertificates('system')`) (#74)
Expand Down
2 changes: 1 addition & 1 deletion docs/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

## Current status

IPAForge is in **alpha**: test builds are on the [Releases page](https://github.com/SirReaDy/ipaforge/releases). Phases 0–6 are complete: foundation, signer, device layer, Apple account, developer services, the installer and the UI foundation. Phase 8 (install and preload) is complete too: Preload with app sources, the Apps page with refresh, Repair SideStore, SideStore QR codes and the on-device checklist. Phase 9 (the desktop app) is complete too: installers for every system, Sigstore-signed releases, and updates itself; Windows code signing and Apple notarisation come with 1.0. Onboarding (Phase 7) comes next. See [Installing](installing.md) to try a build.
IPAForge is in **alpha**: test builds are on the [Releases page](https://github.com/IPAForge/ipaforge/releases). Phases 0–6 are complete: foundation, signer, device layer, Apple account, developer services, the installer and the UI foundation. Phase 8 (install and preload) is complete too: Preload with app sources, the Apps page with refresh, Repair SideStore, SideStore QR codes and the on-device checklist. Phase 9 (the desktop app) is complete too: installers for every system, Sigstore-signed releases, and updates itself; Windows code signing and Apple notarisation come with 1.0. Onboarding (Phase 7) comes next. See [Installing](installing.md) to try a build.

| Area | State |
|---|---|
Expand Down
Loading
Loading