A full-featured download manager.
fix(ffmpeg): verify legacy macos binaries against signed releases (#2496)
Dr_rOot03ca7d173236
diff --git a/e2e/media-settings.spec.ts b/e2e/media-settings.spec.tsindex 389c1491..1cb37d6e 100644--- a/e2e/media-settings.spec.ts+++ b/e2e/media-settings.spec.ts@@ -1,11 +1,14 @@-import { readFile } from 'node:fs/promises'+import { execFileSync } from 'node:child_process'+import { copyFile, readFile, rename } from 'node:fs/promises'import path from 'node:path'+import { Queries } from '@shared/protocol/queries'import { expect, test } from './fixtures/electron-app'test.describe('media settings', () => {test('downloads, verifies and installs the public FFmpeg release through the desktop UI', async ({mainWindow,userDataDir,+ electronApp,}, testInfo) => {test.skip(process.env.MOTRIX_FFMPEG_PUBLIC_RELEASE_TEST !== '1' ||@@ -137,6 +140,79 @@ test.describe('media settings', () => {await managedRow.screenshot({path: testInfo.outputPath('ffmpeg-resolved-path-narrow.png'),})++ // Reproduce the pre-managed layout from #2494 with only the official+ // ffmpeg binary present, retaining its Internet-origin quarantine value.+ const quarantine = execFileSync(+ '/usr/bin/xattr',+ ['-p', 'com.apple.quarantine', binaryPath],+ { encoding: 'utf8' }+ ).trim()+ const legacyBinary = path.join(userDataDir, 'binaries', 'ffmpeg')+ await copyFile(binaryPath, legacyBinary)+ execFileSync('/usr/bin/xattr', [+ '-w',+ 'com.apple.quarantine',+ quarantine,+ legacyBinary,+ ])+ await rename(+ path.join(userDataDir, 'binaries', 'ffmpeg-verified'),+ path.join(userDataDir, 'previous-verified-install')+ )+ await mainWindow.setViewportSize({ width: 1000, height: 740 })+ // A fresh legacy verification without metadata is a retryable error,+ // even though the local executable is a valid official release.+ await electronApp.evaluate(({ session }) => {+ session.defaultSession.webRequest.onBeforeRequest(+ { urls: ['https://api.github.com/repos/motrixapp/ffmpeg-static/*'] },+ (_details, callback) => callback({ cancel: true })+ )+ })+ await card.getByRole('button', { name: 'Refresh', exact: true }).click()+ await expect(card.getByRole('alert')).toContainText(+ 'Couldn’t refresh FFmpeg detection'+ )+ await expect(card.getByText('FFmpeg was blocked by macOS')).toHaveCount(0)+ await electronApp.evaluate(({ session }) =>+ session.defaultSession.webRequest.onBeforeRequest(null)+ )+ await card.getByRole('button', { name: 'Refresh', exact: true }).click()+ await expect(+ managedRow.getByTitle(legacyBinary, { exact: true })+ ).toBeVisible({ timeout: 120_000 })+ await expect(managedRow.getByText('In use', { exact: true })).toBeVisible()+ await expect(card.getByRole('alert')).toHaveCount(0)+ expect(+ execFileSync(+ '/usr/bin/xattr',+ ['-p', 'com.apple.quarantine', legacyBinary],+ { encoding: 'utf8' }+ ).trim()+ ).toBe(quarantine)+ await managedRow.screenshot({+ path: testInfo.outputPath('ffmpeg-legacy-verified.png'),+ })+ // Saved signed evidence must support later checks without GitHub, while+ // still running the real macOS signature and notarization checks.+ await electronApp.evaluate(({ session }) => {+ session.defaultSession.webRequest.onBeforeRequest(+ { urls: ['https://api.github.com/repos/motrixapp/ffmpeg-static/*'] },+ (_details, callback) => callback({ cancel: true })+ )+ })+ const cachedDetection = await mainWindow.evaluate(async (channel) => {+ const api = (+ window as unknown as {+ motrix: { invoke: (channel: string) => Promise<unknown> }+ }+ ).motrix+ return api.invoke(channel)+ }, Queries.GetFfmpegDetection)+ expect(cachedDetection).toMatchObject({ active: { path: legacyBinary } })+ await electronApp.evaluate(({ session }) =>+ session.defaultSession.webRequest.onBeforeRequest(null)+ )})test('shows detection status and saves a manual path', async ({mainWindow,diff --git a/src/core/ffmpeg/verified-install.test.ts b/src/core/ffmpeg/verified-install.test.tsindex 743258f3..156241e6 100644--- a/src/core/ffmpeg/verified-install.test.ts+++ b/src/core/ffmpeg/verified-install.test.ts@@ -26,9 +26,11 @@ import { afterEach, describe, expect, it, vi } from 'vitest'import {assertManagedFfmpegTrusted,extractVerifiedFfmpeg,+ FfmpegDownloadUnavailableError,getFfmpegInstallStatus,installVerifiedFfmpeg,resolveManagedFfmpegCandidate,+ verifyLegacyMacFfmpeg,} from './verified-install'import {compareFfmpegReleases,@@ -167,8 +169,17 @@ function fixture(version = '9.0.2-motrix.8',arch: 'x64' | 'arm64' = 'x64',platform: FfmpegPlatform = 'win32',- additionalManifest: Record<string, unknown> = {}+ additionalManifest: Record<string, unknown> = {},+ binaryVariant = 0) {+ const binary = (+ selectedPlatform: FfmpegPlatform,+ selectedArch: 'x64' | 'arm64'+ ) => {+ const bytes = nativeBinary(selectedPlatform, selectedArch)+ bytes[500] = binaryVariant+ return bytes+ }const licenseFiles = [{ path: 'LICENSES/GPL.txt', sha256: sha256(Buffer.from('license')) },]@@ -180,14 +191,8 @@ function fixture(}))const files = new Map([- [- platform === 'win32' ? 'ffmpeg.exe' : 'ffmpeg',- nativeBinary(platform, arch),- ],- [- platform === 'win32' ? 'ffprobe.exe' : 'ffprobe',- nativeBinary(platform, arch),- ],+ [platform === 'win32' ? 'ffmpeg.exe' : 'ffmpeg', binary(platform, arch)],+ [platform === 'win32' ? 'ffprobe.exe' : 'ffprobe', binary(platform, arch)],['BUILD-INFO.json', Buffer.from('{}')],['LICENSES.json', inventory],['configure.txt', Buffer.from('--enable-gpl')],@@ -219,10 +224,10 @@ function fixture(archiveSize: archive.length,binaryPath:platform === 'win32' ? ('ffmpeg.exe' as const) : ('ffmpeg' as const),- binarySha256: sha256(nativeBinary(platform, arch)),+ binarySha256: sha256(binary(platform, arch)),ffprobePath:platform === 'win32' ? ('ffprobe.exe' as const) : ('ffprobe' as const),- ffprobeSha256: sha256(nativeBinary(platform, arch)),+ ffprobeSha256: sha256(binary(platform, arch)),buildInfoSha256: sha256(Buffer.from('{}')),configureSha256: sha256(Buffer.from('--enable-gpl')),licensesSha256: sha256(inventory),@@ -244,8 +249,8 @@ function fixture(archive: `ffmpeg-${version}-${name}.${otherPlatform === 'linux' ? 'tar.gz' : 'zip'}`,binaryPath: otherPlatform === 'win32' ? 'ffmpeg.exe' : 'ffmpeg',ffprobePath: otherPlatform === 'win32' ? 'ffprobe.exe' : 'ffprobe',- binarySha256: sha256(nativeBinary(otherPlatform, otherArch)),- ffprobeSha256: sha256(nativeBinary(otherPlatform, otherArch)),+ binarySha256: sha256(binary(otherPlatform, otherArch)),+ ffprobeSha256: sha256(binary(otherPlatform, otherArch)),minimumOs: {name: { darwin: 'macos', win32: 'windows', linux: 'linux' }[otherPlatform@@ -342,32 +347,32 @@ function fixture(signature: signature.toString('base64'),}))+ const metadata = {+ tag_name: `v${version}`,+ draft: false,+ prerelease: false,+ immutable: true,+ published_at: '2026-10-01T01:00:00Z',+ html_url: `https://github.com/motrixapp/ffmpeg-static/releases/tag/v${version}`,+ assets: [+ { name: 'ffmpeg-manifest.json', size: raw.length },+ { name: 'ffmpeg-manifest.json.sig', size: envelope.length },+ ...allTargets.map((item) => ({+ name: item.archive,+ size: item.archiveSize,+ })),+ ].map((item, index) => ({+ ...item,+ id: index + 1,+ state: 'uploaded',+ browser_download_url: `https://github.com/motrixapp/ffmpeg-static/releases/download/v${version}/${item.name}`,+ })),+ }const fetcher = vi.fn<typeof fetch>(async (input) => {const url = String(input)- if (url.endsWith('/latest'))- return new Response(- JSON.stringify({- tag_name: `v${version}`,- draft: false,- prerelease: false,- immutable: true,- published_at: '2026-10-01T01:00:00Z',- html_url: `https://github.com/motrixapp/ffmpeg-static/releases/tag/v${version}`,- assets: [- { name: 'ffmpeg-manifest.json', size: raw.length },- { name: 'ffmpeg-manifest.json.sig', size: envelope.length },- ...allTargets.map((item) => ({- name: item.archive,- size: item.archiveSize,- })),- ].map((item, index) => ({- ...item,- id: index + 1,- state: 'uploaded',- browser_download_url: `https://github.com/motrixapp/ffmpeg-static/releases/download/v${version}/${item.name}`,- })),- })- )+ if (url.endsWith('/latest')) return new Response(JSON.stringify(metadata))+ if (url.includes('/releases?'))+ return new Response(JSON.stringify([metadata]))if (url.endsWith('.json.sig')) return new Response(envelope)if (url.endsWith('ffmpeg-manifest.json')) return new Response(raw)if (url.endsWith(target.archive)) return new Response(archive)@@ -379,6 +384,7 @@ function fixture(archive,target: selected as import('@shared/schemas/ffmpeg-release').FfmpegTarget,entries,+ metadata,fetcher,}}@@ -396,6 +402,364 @@ afterEach(async () => {)})+describe('legacy macOS FFmpeg verification', () => {+ async function legacy() {+ const userDataDir = await temp()+ const directory = path.join(userDataDir, 'binaries')+ await mkdir(directory, { mode: 0o700 })+ const binaryPath = path.join(directory, 'ffmpeg')+ await writeFile(binaryPath, nativeBinary('darwin', 'arm64'))+ const release = fixture(undefined, 'arm64', 'darwin')+ return { userDataDir, binaryPath, release }+ }+ function history(...releases: ReturnType<typeof fixture>[]) {+ return vi.fn<typeof fetch>(async (input, init) => {+ const url = String(input)+ if (url.includes('/releases?')) {+ const page = Number(new URL(url).searchParams.get('page'))+ return new Response(+ JSON.stringify(+ releases+ .slice((page - 1) * 20, page * 20)+ .map((release) => release.metadata)+ )+ )+ }+ const release = releases.find((item) =>+ url.includes(`/v${item.target.releaseVersion}/`)+ )+ if (!release) throw new Error('Unexpected release URL')+ return release.fetcher(input, init)+ })+ }+ function evidenceFile(+ userDataDir: string,+ release: ReturnType<typeof fixture>+ ) {+ return path.join(+ userDataDir,+ 'binaries',+ 'ffmpeg-legacy-evidence',+ `${release.target.binarySha256}-darwin-arm64.json`+ )+ }+ it('discovers an unchanged older signed release even when a different newer release already exists', async () => {+ const { userDataDir, binaryPath, release } = await legacy()+ const newer = fixture('9.0.2-motrix.9', 'arm64', 'darwin', {}, 1)+ const fetcher = history(newer, release)+ const systemTrust = vi.fn(async () => {})+ await verifyLegacyMacFfmpeg({+ userDataDir,+ binaryPath,+ arch: 'arm64',+ fetcher,+ systemTrust,+ })+ expect(systemTrust).toHaveBeenCalledWith(binaryPath, release.target)+ expect(+ fetcher.mock.calls.every(([input]) => !String(input).endsWith('/latest'))+ ).toBe(true)+ })+ it('does not let an unrelated future manifest format invalidate a verifiable older binary', async () => {+ const { userDataDir, binaryPath, release } = await legacy()+ const future = fixture(+ '9.0.2-motrix.9',+ 'arm64',+ 'darwin',+ { schemaVersion: 4 },+ 1+ )+ const systemTrust = vi.fn(async () => {})+ await verifyLegacyMacFfmpeg({+ userDataDir,+ binaryPath,+ arch: 'arm64',+ fetcher: history(future, release),+ systemTrust,+ })+ expect(systemTrust).toHaveBeenCalledWith(binaryPath, release.target)+ })+ it('follows bounded release-history pages to find the binary’s signed release', async () => {+ const { userDataDir, binaryPath, release } = await legacy()+ const newer = Array.from({ length: 20 }, (_, index) =>+ fixture(`9.0.2-motrix.${index + 9}`, 'arm64', 'darwin', {}, 1)+ )+ const fetcher = history(...newer, release)+ await verifyLegacyMacFfmpeg({+ userDataDir,+ binaryPath,+ arch: 'arm64',+ fetcher,+ systemTrust: async () => {},+ })+ expect(+ fetcher.mock.calls.some(([input]) => String(input).includes('page=2'))+ ).toBe(true)+ })+ it('reuses authenticated on-disk evidence after newer releases and GitHub outages, but always repeats OS checks', async () => {+ const { userDataDir, binaryPath, release } = await legacy()+ const systemTrust = vi.fn(async () => {})+ await verifyLegacyMacFfmpeg({+ userDataDir,+ binaryPath,+ arch: 'arm64',+ fetcher: release.fetcher,+ systemTrust,+ })+ const newer = fixture('9.0.2-motrix.9', 'arm64', 'darwin', {}, 1)+ const fetcher = history(newer)+ await verifyLegacyMacFfmpeg({+ userDataDir,+ binaryPath,+ arch: 'arm64',+ fetcher,+ systemTrust,+ })+ fetcher.mockRejectedValue(new Error('offline'))+ await verifyLegacyMacFfmpeg({+ userDataDir,+ binaryPath,+ arch: 'arm64',+ fetcher,+ systemTrust,+ })+ expect(fetcher).not.toHaveBeenCalled()+ expect(systemTrust).toHaveBeenCalledTimes(3)+ systemTrust.mockRejectedValue(new Error('notarization denied'))+ await expect(+ verifyLegacyMacFfmpeg({+ userDataDir,+ binaryPath,+ arch: 'arm64',+ fetcher,+ systemTrust,+ })+ ).rejects.toThrow('notarization denied')+ })+ it.each(['manifest', 'signature', 'wrong-release', 'symlink', 'hardlink'])(+ 'rejects cached %s tampering without falling back to network evidence',+ async (violation) => {+ const { userDataDir, binaryPath, release } = await legacy()+ await verifyLegacyMacFfmpeg({+ userDataDir,+ binaryPath,+ arch: 'arm64',+ fetcher: release.fetcher,+ systemTrust: async () => {},+ })+ const file = evidenceFile(userDataDir, release)+ if (violation === 'symlink' || violation === 'hardlink') {+ const original = path.join(await temp(), 'evidence.json')+ await rename(file, original)+ await (violation === 'symlink' ? symlink : link)(original, file)+ } else {+ const evidence = JSON.parse(await readFile(file, 'utf8'))+ if (violation === 'wrong-release') {+ const newer = fixture('9.0.2-motrix.9', 'arm64', 'darwin', {}, 1)+ evidence.manifest = newer.raw.toString('base64')+ evidence.signature = newer.envelope.toString('base64')+ } else evidence[violation] = Buffer.from('modified').toString('base64')+ await writeFile(file, JSON.stringify(evidence))+ }+ const fetcher = vi.fn<typeof fetch>()+ const systemTrust = vi.fn(async () => {})+ await expect(+ verifyLegacyMacFfmpeg({+ userDataDir,+ binaryPath,+ arch: 'arm64',+ fetcher,+ systemTrust,+ })+ ).rejects.toThrow()+ expect(fetcher).not.toHaveBeenCalled()+ expect(systemTrust).not.toHaveBeenCalled()+ }+ )+ it('never reuses a cached verdict for changed binary bytes', async () => {+ const { userDataDir, binaryPath, release } = await legacy()+ await verifyLegacyMacFfmpeg({+ userDataDir,+ binaryPath,+ arch: 'arm64',+ fetcher: release.fetcher,+ systemTrust: async () => {},+ })+ const changed = nativeBinary('darwin', 'arm64')+ changed[500] = 1+ await writeFile(binaryPath, changed)+ const systemTrust = vi.fn(async () => {})+ await expect(+ verifyLegacyMacFfmpeg({+ userDataDir,+ binaryPath,+ arch: 'arm64',+ fetcher: release.fetcher,+ systemTrust,+ })+ ).rejects.toThrow('No signed FFmpeg release matches')+ expect(systemTrust).not.toHaveBeenCalled()+ })+ it.each([+ 403,+ 429,+ 503,+ 'offline',+ 'stream-error',+ 'error-status-stream-error',+ ])(+ 'classifies %s as retryable metadata unavailability before any OS check',+ async (failure) => {+ const { userDataDir, binaryPath } = await legacy()+ const fetcher = vi.fn<typeof fetch>(async () => {+ if (failure === 'offline') throw new Error('offline')+ if (+ failure === 'stream-error' ||+ failure === 'error-status-stream-error'+ )+ return new Response(+ new ReadableStream({+ start(controller) {+ controller.error(new Error('connection lost'))+ },+ }),+ { status: failure === 'stream-error' ? 200 : 503 }+ )+ return new Response(null, { status: failure as number })+ })+ const systemTrust = vi.fn(async () => {})+ await expect(+ verifyLegacyMacFfmpeg({+ userDataDir,+ binaryPath,+ arch: 'arm64',+ fetcher,+ systemTrust,+ })+ ).rejects.toBeInstanceOf(FfmpegDownloadUnavailableError)+ expect(systemTrust).not.toHaveBeenCalled()+ }+ )+ it('reports an incomplete bounded history search as retryable instead of declaring the binary untrusted', async () => {+ const { userDataDir, binaryPath } = await legacy()+ const newer = fixture('9.0.2-motrix.9', 'arm64', 'darwin', {}, 1)+ const fetcher = vi.fn<typeof fetch>(async (input, init) =>+ String(input).includes('/releases?')+ ? new Response(JSON.stringify(Array(20).fill(newer.metadata)))+ : newer.fetcher(input, init)+ )+ await expect(+ verifyLegacyMacFfmpeg({+ userDataDir,+ binaryPath,+ arch: 'arm64',+ fetcher,+ systemTrust: async () => {},+ })+ ).rejects.toBeInstanceOf(FfmpegDownloadUnavailableError)+ expect(fetcher).toHaveBeenCalledTimes(12)+ })+ it('authenticates a lone legacy binary against the signed release before OS checks', async () => {+ const { userDataDir, binaryPath, release } = await legacy()+ const systemTrust = vi.fn(async () => {})+ await verifyLegacyMacFfmpeg({+ userDataDir,+ binaryPath,+ arch: 'arm64',+ fetcher: release.fetcher,+ systemTrust,+ })+ expect(systemTrust).toHaveBeenCalledWith(binaryPath, release.target)+ expect(await readFile(binaryPath)).toEqual(nativeBinary('darwin', 'arm64'))+ expect((await readdir(path.dirname(binaryPath))).sort()).toEqual([+ 'ffmpeg',+ 'ffmpeg-legacy-evidence',+ ])+ expect(+ release.fetcher.mock.calls.map(([input]) => String(input))+ ).toHaveLength(3)+ expect(getFfmpegInstallStatus(userDataDir).phase).toBe('idle')+ })+ it.each([+ 'hash',+ 'architecture',+ 'symlink',+ 'hardlink',+ 'signature',+ 'metadata',+ 'network',+ 'minimum-version',+ 'managed-receipt',+ 'other-path',+ ])('rejects %s before system checks', async (violation) => {+ let { userDataDir, binaryPath, release } = await legacy()+ if (violation === 'hash')+ await writeFile(+ binaryPath,+ Buffer.concat([+ nativeBinary('darwin', 'arm64'),+ Buffer.from('modified'),+ ])+ )+ if (violation === 'architecture')+ await writeFile(binaryPath, nativeBinary('darwin', 'x64'))+ if (violation === 'symlink' || violation === 'hardlink') {+ const original = path.join(await temp(), 'ffmpeg')+ await rename(binaryPath, original)+ await (violation === 'symlink' ? symlink : link)(original, binaryPath)+ }+ if (violation === 'signature') release.raw[0] ^= 1+ if (violation === 'metadata')+ release.fetcher.mockResolvedValueOnce(new Response('{}'))+ if (violation === 'network')+ release.fetcher.mockRejectedValueOnce(new Error('offline'))+ if (violation === 'minimum-version')+ release = fixture('9.0.2-motrix.7', 'arm64', 'darwin')+ if (violation === 'managed-receipt') {+ const managed = path.join(userDataDir, 'binaries', 'ffmpeg-verified')+ await mkdir(managed)+ await writeFile(path.join(managed, 'current.json'), '{}')+ }+ if (violation === 'other-path')+ binaryPath = path.join(await temp(), 'ffmpeg')+ const systemTrust = vi.fn(async () => {})+ await expect(+ verifyLegacyMacFfmpeg({+ userDataDir,+ binaryPath,+ arch: 'arm64',+ fetcher: release.fetcher,+ systemTrust,+ })+ ).rejects.toThrow()+ expect(systemTrust).not.toHaveBeenCalled()+ })+ it.each(['os-rejection', 'changed-during-check'])(+ 'fails closed on %s',+ async (violation) => {+ const { userDataDir, binaryPath, release } = await legacy()+ await expect(+ verifyLegacyMacFfmpeg({+ userDataDir,+ binaryPath,+ arch: 'arm64',+ fetcher: release.fetcher,+ systemTrust: async () => {+ if (violation === 'os-rejection') throw new Error('not notarized')+ await writeFile(+ binaryPath,+ Buffer.concat([+ nativeBinary('darwin', 'arm64'),+ Buffer.from('changed'),+ ])+ )+ },+ })+ ).rejects.toThrow()+ }+ )+})+describe('verified FFmpeg releases', () => {it('creates the missing binaries directory and keeps the verified installation inside it', async () => {const userDataDir = await temp()diff --git a/src/core/ffmpeg/verified-install.ts b/src/core/ffmpeg/verified-install.tsindex 0836b890..201855d5 100644--- a/src/core/ffmpeg/verified-install.ts+++ b/src/core/ffmpeg/verified-install.ts@@ -28,6 +28,7 @@ import type {FfmpegTarget,} from '@shared/schemas/ffmpeg-release'import {+ FFMPEG_MINIMUM_RELEASE,FFMPEG_REPOSITORY,ffmpegLicenseInventorySchema,ffmpegReleaseVersionSchema,@@ -195,9 +196,8 @@ function regularBytes(file: string, limit: number): Buffer {}}-function hashBinary(+function binaryDigest(file: string,- expected: string,arch: 'x64' | 'arm64',platform: FfmpegPlatform) {@@ -229,14 +229,23 @@ function hashBinary(if (offset > MAX_BINARY) throw new Error('FFmpeg binary exceeds limits')digest.update(chunk.subarray(0, count))}- if (offset !== info.size || digest.digest('hex') !== expected) {- throw new Error('Managed FFmpeg binary digest mismatch')- }+ if (offset !== info.size) throw new Error('FFmpeg binary changed')+ return digest.digest('hex')} finally {closeSync(fd)}}+function hashBinary(+ file: string,+ expected: string,+ arch: 'x64' | 'arm64',+ platform: FfmpegPlatform+) {+ if (binaryDigest(file, arch, platform) !== expected)+ throw new Error('Managed FFmpeg binary digest mismatch')+}+function readInstalled(userDataDir: string) {const root = rootFor(userDataDir)assertManagedDirectory(path.dirname(root))@@ -367,6 +376,13 @@ export function resolveManagedFfmpegCandidate(return candidate}+/** Transport failure is retryable; it is not evidence of an invalid signature. */+export class FfmpegDownloadUnavailableError extends Error {+ constructor(cause?: unknown) {+ super('FFmpeg download unavailable', { cause })+ }+}+async function download(url: string,limit: number,@@ -385,17 +401,22 @@ async function download() {throw new Error('Untrusted FFmpeg download location')}- const response = await fetcher(url, {- signal,- redirect: 'manual',- credentials: 'omit',- })+ let response: Response+ try {+ response = await fetcher(url, {+ signal,+ redirect: 'manual',+ credentials: 'omit',+ })+ } catch (error) {+ throw new FfmpegDownloadUnavailableError(error)+ }if (response.status === 404 &&location.hostname === 'api.github.com' &&location.pathname === `/repos/${FFMPEG_REPOSITORY}/releases/latest`) {- await response.body?.cancel()+ await response.body?.cancel().catch(() => {})throw new AppError(ErrorCode.FfmpegReleaseUnavailable,'No formal FFmpeg release'@@ -403,17 +424,20 @@ async function download(}if ([301, 302, 303, 307, 308].includes(response.status)) {const next = response.headers.get('location')- await response.body?.cancel()+ await response.body?.cancel().catch(() => {})if (!next) throw new Error('Missing download redirect')url = new URL(next, url).hrefcontinue}+ if (!response.ok) {+ await response.body?.cancel().catch(() => {})+ throw new FfmpegDownloadUnavailableError()+ }if (- !response.ok ||!response.body ||Number(response.headers.get('content-length')) > limit) {- await response.body?.cancel()+ await response.body?.cancel().catch(() => {})throw new Error('FFmpeg download failed or exceeds limits')}const chunks: Uint8Array[] = []@@ -424,7 +448,9 @@ async function download(const reader = response.body.getReader()try {for (;;) {- const { value, done } = await reader.read()+ const { value, done } = await reader.read().catch((error) => {+ throw new FfmpegDownloadUnavailableError(error)+ })if (done) breaksize += value.lengthif (size > limit) throw new Error('FFmpeg download exceeds limits')@@ -710,6 +736,245 @@ async function extractVerifiedTar(}}+/** Both new installs and legacy discovery require an immutable, signed release. */+async function fetchVerifiedFfmpegRelease(+ arch: 'x64' | 'arm64',+ platform: FfmpegPlatform,+ fetcher: typeof fetch,+ signal: AbortSignal,+ onMetadata?: (version: string) => void,+ release?: z.infer<typeof releaseApiSchema>+) {+ const latestRaw =+ release ??+ JSON.parse(+ (+ await download(+ `https://api.github.com/repos/${FFMPEG_REPOSITORY}/releases/latest`,+ 1024 * 1024,+ fetcher,+ signal+ )+ ).toString('utf8')+ )+ const parsed = releaseApiSchema.safeParse(latestRaw)+ if (+ !parsed.success ||+ latestRaw.html_url !==+ `https://github.com/${FFMPEG_REPOSITORY}/releases/tag/${latestRaw.tag_name}`+ ) {+ throw new AppError(+ ErrorCode.FfmpegReleaseUnavailable,+ 'No immutable formal FFmpeg release'+ )+ }+ const latest = parsed.data+ const version = ffmpegReleaseVersionSchema.parse(+ String(latest.tag_name).replace(/^v/, '')+ )+ const tag = `v${version}`+ const base = `https://github.com/${FFMPEG_REPOSITORY}/releases/download/${tag}/`+ const raw = await download(+ `${base}ffmpeg-manifest.json`,+ 1024 * 1024,+ fetcher,+ signal+ )+ const sig = await download(+ `${base}ffmpeg-manifest.json.sig`,+ 4096,+ fetcher,+ signal+ )+ onMetadata?.(version)+ const verified = verifyFfmpegRelease(raw, sig, arch, tag, platform)+ const assetNames = new Set(latest.assets.map((asset) => asset.name))+ if (+ assetNames.size !== latest.assets.length ||+ new Set(latest.assets.map((asset) => asset.id)).size !==+ latest.assets.length+ )+ throw new Error('Duplicate FFmpeg release assets')+ const requiredAssets = [+ { name: 'ffmpeg-manifest.json', size: raw.length },+ { name: 'ffmpeg-manifest.json.sig', size: sig.length },+ ...verified.allTargets.map((item) => ({+ name: item.archive,+ size: item.archiveSize,+ })),+ ]+ for (const required of requiredAssets) {+ const asset = latest.assets.find((item) => item.name === required.name)+ if (+ !asset ||+ asset.size !== required.size ||+ asset.browser_download_url !== `${base}${required.name}`+ )+ throw new Error('Formal FFmpeg release asset identity mismatch')+ }+ return { ...verified, raw, sig, version, base }+}++const legacyEvidenceSchema = z+ .object({+ manifest: z.string().min(1).max(1_398_104),+ signature: z.string().min(1).max(5464),+ })+ .strict()++function readLegacyEvidence(+ directory: string,+ file: string,+ arch: 'x64' | 'arm64'+) {+ assertManagedDirectory(directory, true)+ let bytes: Buffer+ try {+ bytes = regularBytes(file, 2 * 1024 * 1024)+ } catch (error) {+ if ((error as NodeJS.ErrnoException).code === 'ENOENT') return+ throw error+ }+ const evidence = legacyEvidenceSchema.parse(+ JSON.parse(bytes.toString('utf8'))+ )+ const raw = Buffer.from(evidence.manifest, 'base64')+ const sig = Buffer.from(evidence.signature, 'base64')+ // Persist signed bytes, never a cached trust verdict. Key, minimum version,+ // certificate pin, architecture and binary hash are checked on every read.+ return {+ ...verifyFfmpegRelease(raw, sig, arch, undefined, 'darwin'),+ raw,+ sig,+ }+}++async function findLegacyRelease(+ digest: string,+ arch: 'x64' | 'arm64',+ fetcher: typeof fetch+) {+ const signal = AbortSignal.timeout(30_000)+ const seen = new Set<string>()+ // Bound discovery; an incomplete search is retryable, never an OS rejection.+ for (let page = 1; page <= 10; page++) {+ const entries = z+ .array(z.unknown())+ .max(20)+ .parse(+ JSON.parse(+ (+ await download(+ `https://api.github.com/repos/${FFMPEG_REPOSITORY}/releases?per_page=20&page=${page}`,+ 4 * 1024 * 1024,+ fetcher,+ signal+ )+ ).toString('utf8')+ )+ )+ for (const entry of entries) {+ const parsed = releaseApiSchema.safeParse(entry)+ if (!parsed.success) continue+ const version = ffmpegReleaseVersionSchema.safeParse(+ parsed.data.tag_name.replace(/^v/, '')+ )+ if (+ !version.success ||+ seen.has(parsed.data.tag_name) ||+ compareFfmpegReleases(version.data, FFMPEG_MINIMUM_RELEASE) < 0+ )+ continue+ seen.add(parsed.data.tag_name)+ let verified: Awaited<ReturnType<typeof fetchVerifiedFfmpegRelease>>+ try {+ verified = await fetchVerifiedFfmpegRelease(+ arch,+ 'darwin',+ fetcher,+ signal,+ undefined,+ parsed.data+ )+ } catch (error) {+ if (error instanceof FfmpegDownloadUnavailableError) throw error+ // This entry supplies no usable proof. A different historical release+ // must still pass every signature, identity and hash check on its own.+ continue+ }+ if (verified.target.binarySha256 === digest) return verified+ }+ if (entries.length < 20)+ throw new Error('No signed FFmpeg release matches the legacy binary')+ }+ throw new FfmpegDownloadUnavailableError()+}++async function saveLegacyEvidence(+ directory: string,+ file: string,+ raw: Buffer,+ sig: Buffer+) {+ await ensureManagedDirectory(directory)+ const temporary = path.join(directory, `.evidence-${randomUUID()}.json`)+ try {+ await writeFile(+ temporary,+ JSON.stringify({+ manifest: raw.toString('base64'),+ signature: sig.toString('base64'),+ }),+ { flag: 'wx', mode: 0o600 }+ )+ await rename(temporary, file)+ } finally {+ await rm(temporary, { force: true })+ }+}++/** Authenticate only the conventional legacy macOS binary, without moving or executing it. */+export async function verifyLegacyMacFfmpeg(options: {+ userDataDir: string+ binaryPath: string+ arch: 'x64' | 'arm64'+ fetcher: typeof fetch+ systemTrust: (binary: string, target: FfmpegTarget) => Promise<void>+}) {+ const { userDataDir, binaryPath, arch, fetcher, systemTrust } = options+ const directory = path.resolve(userDataDir, 'binaries')+ if (path.resolve(binaryPath) !== path.join(directory, 'ffmpeg'))+ throw new Error('Unexpected legacy FFmpeg path')+ assertManagedDirectory(directory)+ // A managed receipt must never fall back to the legacy trust path.+ if (existsSync(path.join(rootFor(userDataDir), 'current.json')))+ throw new Error('Managed FFmpeg installation already exists')+ const digest = binaryDigest(binaryPath, arch, 'darwin')+ const evidenceDirectory = path.join(directory, 'ffmpeg-legacy-evidence')+ const evidenceFile = path.join(+ evidenceDirectory,+ `${digest}-darwin-${arch}.json`+ )+ const cached = readLegacyEvidence(evidenceDirectory, evidenceFile, arch)+ const { target, raw, sig } =+ cached ?? (await findLegacyRelease(digest, arch, fetcher))+ const authenticate = () => {+ assertManagedDirectory(directory)+ hashBinary(binaryPath, target.binarySha256, arch, 'darwin')+ }+ authenticate()+ await systemTrust(binaryPath, target)+ if (!cached) {+ // Cache persistence is optional; inability to write cannot negate valid+ // evidence from this check. Future checks can discover the release again.+ await saveLegacyEvidence(evidenceDirectory, evidenceFile, raw, sig).catch(+ () => {}+ )+ }+ // Recheck after the online OS assessment before the caller executes a probe.+ authenticate()+}+export async function installVerifiedFfmpeg(options: {userDataDir: stringarch: 'x64' | 'arm64'@@ -758,71 +1023,14 @@ export async function installVerifiedFfmpeg(options: {assertManagedDirectory(path.dirname(root), true)assertManagedDirectory(root, true)assertManagedDirectory(path.join(root, 'releases'), true)- const latestRaw = JSON.parse(- (- await download(- `https://api.github.com/repos/${FFMPEG_REPOSITORY}/releases/latest`,- 1024 * 1024,- fetcher,- signal- )- ).toString('utf8')- )- const parsed = releaseApiSchema.safeParse(latestRaw)- if (- !parsed.success ||- latestRaw.html_url !==- `https://github.com/${FFMPEG_REPOSITORY}/releases/tag/${latestRaw.tag_name}`- ) {- throw new AppError(- ErrorCode.FfmpegReleaseUnavailable,- 'No immutable formal FFmpeg release'- )- }- const latest = parsed.data- const version = ffmpegReleaseVersionSchema.parse(- String(latest.tag_name).replace(/^v/, '')- )- const tag = `v${version}`- const base = `https://github.com/${FFMPEG_REPOSITORY}/releases/download/${tag}/`- const raw = await download(- `${base}ffmpeg-manifest.json`,- 1024 * 1024,- fetcher,- signal- )- const sig = await download(- `${base}ffmpeg-manifest.json.sig`,- 4096,+ const verified = await fetchVerifiedFfmpegRelease(+ arch,+ platform,fetcher,- signal- )- publish({ phase: 'verifying', releaseVersion: version })- const verified = verifyFfmpegRelease(raw, sig, arch, tag, platform)- const assetNames = new Set(latest.assets.map((asset) => asset.name))- if (- assetNames.size !== latest.assets.length ||- new Set(latest.assets.map((asset) => asset.id)).size !==- latest.assets.length+ signal,+ (version) => publish({ phase: 'verifying', releaseVersion: version }))- throw new Error('Duplicate FFmpeg release assets')- const requiredAssets = [- { name: 'ffmpeg-manifest.json', size: raw.length },- { name: 'ffmpeg-manifest.json.sig', size: sig.length },- ...verified.allTargets.map((item) => ({- name: item.archive,- size: item.archiveSize,- })),- ]- for (const required of requiredAssets) {- const asset = latest.assets.find((item) => item.name === required.name)- if (- !asset ||- asset.size !== required.size ||- asset.browser_download_url !== `${base}${required.name}`- )- throw new Error('Formal FFmpeg release asset identity mismatch')- }+ const { raw, sig, version, base } = verifiedif (existsSync(path.join(root, 'current.json'))) {const current = readInstalled(userDataDir)const comparison = compareFfmpegReleases(diff --git a/src/core/plugin/capabilities/ffmpeg-detect.test.ts b/src/core/plugin/capabilities/ffmpeg-detect.test.tsindex 8d0be24b..6f694410 100644--- a/src/core/plugin/capabilities/ffmpeg-detect.test.ts+++ b/src/core/plugin/capabilities/ffmpeg-detect.test.ts@@ -7,6 +7,7 @@// when MOTRIX_TEST_FFMPEG is set.import { describe, expect, it } from 'vitest'+import { FfmpegCapabilityHost } from './ffmpeg'import {detectFromCandidates,detectInOrder,@@ -270,6 +271,44 @@ describe('detectInOrder', () => {})})+ it.each(['manual', 'path', 'none'])(+ 'keeps checking other candidates after unavailable verification, with %s fallback',+ async (source) => {+ const results: Record<string, FfmpegDetection> = {+ '/data/binaries/ffmpeg': {+ available: false,+ binaryPath: '/data/binaries/ffmpeg',+ failureReason: 'verification_unavailable',+ },+ }+ if (source !== 'none')+ results[source === 'manual' ? '/custom/ffmpeg' : 'ffmpeg'] = {+ available: true,+ binaryPath: '/custom/ffmpeg',+ version: '9.0.2',+ }+ const host = new FfmpegCapabilityHost({ detect: { available: false } })+ const report = await host.refreshDetection(() =>+ detectInOrder(+ {+ manualPath: source === 'manual' ? '/custom/ffmpeg' : '',+ userDataBinariesDir: '/data/binaries',+ platform: 'darwin',+ envPath: null,+ },+ makeProbe(results)+ )+ )+ expect(report.candidates[1]).toMatchObject({+ state: 'verification_unavailable',+ })+ expect(host.available).toBe(source !== 'none')+ expect(report.active).toEqual(+ source === 'none' ? null : { path: '/custom/ffmpeg', version: '9.0.2' }+ )+ }+ )+it('derives the Windows userData candidate from the supplied platform', async () => {const probe = makeProbe({})const r = await detectInOrder(diff --git a/src/core/plugin/capabilities/ffmpeg-detect.ts b/src/core/plugin/capabilities/ffmpeg-detect.tsindex 20caee5f..2bda9673 100644--- a/src/core/plugin/capabilities/ffmpeg-detect.ts+++ b/src/core/plugin/capabilities/ffmpeg-detect.ts@@ -23,7 +23,10 @@ import path from 'node:path'// Types// ----------------------------------------------------------------------------export type FfmpegDetectionFailureReason = 'missing' | 'untrusted'+export type FfmpegDetectionFailureReason =+ | 'missing'+ | 'untrusted'+ | 'verification_unavailable'export interface FfmpegDetection {available: boolean@@ -154,6 +157,7 @@ export type CandidateState =| 'missing'| 'untrusted'| 'unconfigured'+ | 'verification_unavailable'| 'version_mismatch'export interface FfmpegDetectionResult {@@ -205,6 +209,8 @@ export function ffmpegCandidatesInOrder(* - Probe succeeds but a higher-priority candidate already won →* `'available'` (still includes version).* - Probe reports `failureReason: 'untrusted'` → `'untrusted'`.+ * - Temporarily unavailable verification → `'verification_unavailable'`;+ * keep looking for another usable candidate.* - Any other probe failure → `'missing'`.* - `'version_mismatch'` is reserved for a future semver gate; this* function never emits it.@@ -251,7 +257,7 @@ export async function detectInOrder(candidates.push({kind: entry.kind,path: checkedPath,- state: result.failureReason === 'untrusted' ? 'untrusted' : 'missing',+ state: result.failureReason ?? 'missing',})}}diff --git a/src/main/plugin/ffmpeg-macos-trust.test.ts b/src/main/plugin/ffmpeg-macos-trust.test.tsindex 19150de7..4c20d2d7 100644--- a/src/main/plugin/ffmpeg-macos-trust.test.ts+++ b/src/main/plugin/ffmpeg-macos-trust.test.ts@@ -4,7 +4,10 @@ import { writeFile } from 'node:fs/promises'import type { FfmpegTarget } from '@shared/schemas/ffmpeg-release'import { describe, expect, it, vi } from 'vitest'import type { RunCommand } from '../cli/command-runner'-import { verifyMacFfmpegTrust } from './ffmpeg-macos-trust'+import {+ verifyMacFfmpegBinaryTrust,+ verifyMacFfmpegTrust,+} from './ffmpeg-macos-trust'const identity = vi.hoisted(() => {const bytes = Buffer.from('ephemeral certificate fixture')@@ -35,7 +38,7 @@ function target(): FfmpegTarget {},} as FfmpegTarget}-function runner(violation?: string) {+function runner(violation?: string, timestamp = 'Sep 30, 2026 at 12:00:00 PM') {return vi.fn<RunCommand>(async (command, args) => {if (violation === 'os-failed')return { code: 1, stdout: '', stderr: 'rejected' }@@ -63,7 +66,7 @@ function runner(violation?: string) {}if (args.includes('--verbose=4') && command.endsWith('codesign')) {const name = args.at(-1)!.endsWith('ffprobe') ? 'ffprobe' : 'ffmpeg'- let stderr = `Identifier=net.agalwood.motrix.${name}\nTeamIdentifier=TESTTEAM01\nCDHash=${'a'.repeat(40)}\nTimestamp=Sep 30, 2026 at 12:00:00 PM\nAuthority=Developer ID Application: Test (TESTTEAM01)\nCodeDirectory v=20500 size=42 flags=0x10000(runtime)\n`+ let stderr = `Identifier=net.agalwood.motrix.${name}\nTeamIdentifier=TESTTEAM01\nCDHash=${'a'.repeat(40)}\nTimestamp=${timestamp}\nAuthority=Developer ID Application: Test (TESTTEAM01)\nCodeDirectory v=20500 size=42 flags=0x10000(runtime)\n`if (violation === 'team')stderr = stderr.replace('TeamIdentifier=TESTTEAM01',@@ -90,6 +93,76 @@ function runner(violation?: string) {const url ='https://github.com/motrixapp/ffmpeg-static/releases/download/v9.0.2-motrix.8/ffmpeg-9.0.2-motrix.8-darwin-arm64.zip'describe('managed macOS FFmpeg system trust', () => {+ it.each([+ ['Oct 1, 2026 at 16:18:51', '2026-10-01T16:18:51Z'],+ ['1 Oct 2026 at 16:18:51', '2026-10-01T16:18:51Z'],+ ['Oct 1, 2026 at 4:18:51 PM', '2026-10-01T16:18:51Z'],+ ['1 Oct 2026 at 4:18:51 PM', '2026-10-01T16:18:51Z'],+ ['1 Oct 2026 at 4:18:51 AM', '2026-10-01T04:18:51Z'],+ ['Oct 1, 2026 at 12:18:51 AM', '2026-10-01T00:18:51Z'],+ ['1 Oct 2026 at 12:18:51 AM', '2026-10-01T00:18:51Z'],+ ['1 Oct 2026 at 12:18:51 PM', '2026-10-01T12:18:51Z'],+ ['1 Oct 2026 at 00:18:51', '2026-10-01T00:18:51Z'],+ ['1\u00a0Oct\u202f2026 at 4:18:51\u202fPM', '2026-10-01T16:18:51Z'],+ ['29 Feb 2024 at 23:59:59', '2024-02-29T23:59:59Z'],+ ])(+ 'matches the secure date %s to the authenticated UTC timestamp',+ async (display, timestamp) => {+ const release = target()+ for (const name of ['ffmpeg', 'ffprobe'] as const)+ release.signing!.binaries[name].timestamp = timestamp+ await expect(+ verifyMacFfmpegTrust(+ '/fixture',+ release,+ url,+ runner(undefined, display)+ )+ ).resolves.toBeUndefined()+ }+ )+ it.each([+ '30 Sep 2026 at 12:00:01 PM',+ '30 Sep 2026 at 12:00:00 AM',+ '30 Sep 2026 at 00:00:00 PM',+ '30 Sep 2026 at 13:00:00 PM',+ '30 Sep 2026 at 24:00:00',+ '30 Sep 2026 at 12:60:00',+ '30 Sep 2026 at 12:00:60',+ '31 Sep 2026 at 12:00:00',+ '29 Feb 2026 at 12:00:00',+ '0 Sep 2026 at 12:00:00',+ '30 Xxx 2026 at 12:00:00',+ '30/09/2026 12:00:00',+ '30 Sep 2026 at 12:00:00 UTC',+ '30 Sep 2026\nat 12:00:00',+ 'Sep 30, 2026 at 12:00:00 PM\nTimestamp=30 Sep 2026 at 12:00:00',+ ])(+ 'rejects invalid, ambiguous or mismatched timestamps: %s',+ async (display) => {+ await expect(+ verifyMacFfmpegTrust(+ '/fixture',+ target(),+ url,+ runner(undefined, display)+ )+ ).rejects.toThrow()+ }+ )+ it('checks a legacy CLI binary without changing quarantine or requiring a sibling ffprobe', async () => {+ const run = runner(undefined, '30 Sep 2026 at 12:00:00')+ await verifyMacFfmpegBinaryTrust('/legacy/ffmpeg', 'ffmpeg', target(), run)+ expect(+ run.mock.calls.every(+ ([command, args]) =>+ command === '/usr/bin/codesign' && args.at(-1) === '/legacy/ffmpeg'+ )+ ).toBe(true)+ expect(+ run.mock.calls.some(([, args]) => args.includes('--check-notarization'))+ ).toBe(true)+ })it('checks both CLI binaries with Apple anchoring, online notarization, a pinned leaf certificate and secure UTC timestamps', async () => {const run = runner()await verifyMacFfmpegTrust('/fixture', target(), url, run)diff --git a/src/main/plugin/ffmpeg-macos-trust.ts b/src/main/plugin/ffmpeg-macos-trust.tsindex 683cae85..180c4954 100644--- a/src/main/plugin/ffmpeg-macos-trust.ts+++ b/src/main/plugin/ffmpeg-macos-trust.ts@@ -7,12 +7,101 @@ import certificate from '@shared/config/ffmpeg-macos-certificate.json'import type { FfmpegTarget } from '@shared/schemas/ffmpeg-release'import { type RunCommand, runCommand } from '../cli/command-runner'+function parseSecureTimestamp(value: string): string {+ // codesign uses system date preferences even with LC_ALL=C. Normalize only+ // horizontal separators, then accept the explicit English date orders.+ const raw = value.replace(/[ \t\u00a0\u202f]+/g, ' ')+ const timestamp =+ /^(?:([A-Z][a-z]{2}) (\d{1,2}),|(\d{1,2}) ([A-Z][a-z]{2})) (\d{4}) at (\d{1,2}):(\d{2}):(\d{2})(?: (AM|PM))?$/.exec(+ raw+ )+ if (!timestamp) throw new Error('Missing secure FFmpeg timestamp')+ const month = [+ 'Jan',+ 'Feb',+ 'Mar',+ 'Apr',+ 'May',+ 'Jun',+ 'Jul',+ 'Aug',+ 'Sep',+ 'Oct',+ 'Nov',+ 'Dec',+ ].indexOf(timestamp[1] ?? timestamp[4])+ const day = Number(timestamp[2] ?? timestamp[3])+ const year = Number(timestamp[5])+ let hour = Number(timestamp[6])+ const minute = Number(timestamp[7])+ const second = Number(timestamp[8])+ if (timestamp[9]) {+ if (hour < 1 || hour > 12)+ throw new Error('Invalid secure FFmpeg timestamp')+ hour = (hour % 12) + (timestamp[9] === 'PM' ? 12 : 0)+ }+ const date = new Date(Date.UTC(year, month, day, hour, minute, second))+ if (+ month < 0 ||+ date.getUTCFullYear() !== year ||+ date.getUTCMonth() !== month ||+ date.getUTCDate() !== day ||+ date.getUTCHours() !== hour ||+ date.getUTCMinutes() !== minute ||+ date.getUTCSeconds() !== second+ )+ throw new Error('Invalid secure FFmpeg timestamp')+ return date.toISOString().replace('.000Z', 'Z')+}+/** Static OS checks only. Never execute an unverified payload or remove quarantine. */export async function verifyMacFfmpegTrust(directory: string,target: FfmpegTarget,sourceUrl: string,run: RunCommand = runCommand+): Promise<void> {+ if (+ !sourceUrl.startsWith(+ 'https://github.com/motrixapp/ffmpeg-static/releases/download/'+ )+ )+ throw new Error('Unexpected FFmpeg source')+ for (const name of ['ffmpeg', 'ffprobe'] as const) {+ const binary = path.join(directory, name)+ // Chromium networking does not propagate Finder quarantine; mark this Internet download explicitly.+ await checked(run, '/usr/bin/xattr', [+ '-w',+ 'com.apple.quarantine',+ `0081;${Math.floor(Date.now() / 1000).toString(16)};Motrix;${randomUUID()}`,+ binary,+ ])+ await verifyMacFfmpegBinaryTrust(binary, name, target, run)+ }+}++async function checked(run: RunCommand, command: string, args: string[]) {+ const result = await run(command, args, {+ env: { ...process.env, LC_ALL: 'C', TZ: 'UTC' },+ timeoutMs: 30_000,+ maxBuffer: 64_000,+ })+ if (+ result.code !== 0 ||+ result.spawnError ||+ result.timedOut ||+ result.truncated+ )+ throw new Error('FFmpeg system trust check failed')+ return result+}++/** The caller authenticates the target and binary hash before these CLI checks. */+export async function verifyMacFfmpegBinaryTrust(+ binary: string,+ name: 'ffmpeg' | 'ffprobe',+ target: FfmpegTarget,+ run: RunCommand = runCommand): Promise<void> {const signing = target.signingif (@@ -24,123 +113,55 @@ export async function verifyMacFfmpegTrust(const temporary = await mkdtemp(path.join(os.tmpdir(), 'motrix-ffmpeg-certificate-'))- const checked = async (command: string, args: string[]) => {- const result = await run(command, args, {- env: { ...process.env, LC_ALL: 'C', TZ: 'UTC' },- timeoutMs: 30_000,- maxBuffer: 64_000,- })- if (- result.code !== 0 ||- result.spawnError ||- result.timedOut ||- result.truncated- )- throw new Error('FFmpeg system trust check failed')- return result- }try {- for (const name of ['ffmpeg', 'ffprobe'] as const) {- const binary = path.join(directory, name)- // Chromium networking does not propagate Finder quarantine; mark this Internet download explicitly.- await checked('/usr/bin/xattr', [- '-w',- 'com.apple.quarantine',- `0081;${Math.floor(Date.now() / 1000).toString(16)};Motrix;${randomUUID()}`,- binary,- ])- // The source URL is bounded by the authenticated target and fixed repository.- if (- !sourceUrl.startsWith(- 'https://github.com/motrixapp/ffmpeg-static/releases/download/'- )- )- throw new Error('Unexpected FFmpeg source')- await checked('/usr/bin/codesign', [- '--verify',- '--strict',- '--check-notarization',- '--verbose=2',- '-R',- '=anchor apple generic and certificate 1[field.1.2.840.113635.100.6.2.6] exists and certificate leaf[field.1.2.840.113635.100.6.1.13] exists and notarized',- binary,- ])- const display = await checked('/usr/bin/codesign', [- '--display',- '--verbose=4',- binary,- ])- const text = `${display.stdout}\n${display.stderr}`- const field = (label: string) => {- const values = text- .split(/\r?\n/)- .filter((line) => line.startsWith(`${label}=`))- .map((line) => line.slice(label.length + 1))- if (values.length !== 1)- throw new Error('Ambiguous FFmpeg signing identity')- return values[0]- }- const record = signing.binaries[name]- // macOS locales can retain a nonbreaking AM/PM separator even with LC_ALL=C.- // Normalize horizontal whitespace only; line breaks must never be accepted here.- const rawTimestamp = field('Timestamp').replace(- /[ \t\u00a0\u202f]+/g,- ' '- )- const timestamp =- /^([A-Z][a-z]{2}) (\d{1,2}), (\d{4}) at (\d{1,2}):(\d{2}):(\d{2})(?: (AM|PM))?$/.exec(- rawTimestamp- )- if (!timestamp) throw new Error('Missing secure FFmpeg timestamp')- const month = [- 'Jan',- 'Feb',- 'Mar',- 'Apr',- 'May',- 'Jun',- 'Jul',- 'Aug',- 'Sep',- 'Oct',- 'Nov',- 'Dec',- ].indexOf(timestamp[1])- let hour = Number(timestamp[4])- if (timestamp[7]) {- if (hour < 1 || hour > 12)- throw new Error('Invalid secure FFmpeg timestamp')- hour = (hour % 12) + (timestamp[7] === 'PM' ? 12 : 0)- }- const canonicalTimestamp = `${timestamp[3]}-${String(month + 1).padStart(2, '0')}-${timestamp[2].padStart(2, '0')}T${String(hour).padStart(2, '0')}:${timestamp[5]}:${timestamp[6]}Z`- const flags = /flags=0x([0-9a-f]+)\(/i.exec(text)- // The Team ID is authenticated by the pinned manifest and compared only in memory.- if (- field('TeamIdentifier') !== signing.identity.teamId ||- field('CDHash') !== record.cdHash ||- month < 0 ||- canonicalTimestamp !== record.timestamp ||- field('Identifier') !== `net.agalwood.motrix.${name}` ||- !text- .split(/\r?\n/)- .includes(`Authority=${signing.identity.subject}`) ||- !flags ||- (Number.parseInt(flags[1], 16) & 0x10000) === 0- )- throw new Error('FFmpeg signature evidence mismatch')- const prefix = path.join(temporary, name)- await checked('/usr/bin/codesign', [- '--display',- `--extract-certificates=${prefix}`,- binary,- ])- if (- sha256(await readFile(`${prefix}0`)) !== certificate.certificateSha256- )- throw new Error('FFmpeg leaf certificate mismatch')- // Apple prescribes the notarized requirement for standalone CLI tools;- // spctl's application assessment rejects valid non-app executables.+ await checked(run, '/usr/bin/codesign', [+ '--verify',+ '--strict',+ '--check-notarization',+ '--verbose=2',+ '-R',+ '=anchor apple generic and certificate 1[field.1.2.840.113635.100.6.2.6] exists and certificate leaf[field.1.2.840.113635.100.6.1.13] exists and notarized',+ binary,+ ])+ const display = await checked(run, '/usr/bin/codesign', [+ '--display',+ '--verbose=4',+ binary,+ ])+ const text = `${display.stdout}\n${display.stderr}`+ const field = (label: string) => {+ const values = text+ .split(/\r?\n/)+ .filter((line) => line.startsWith(`${label}=`))+ .map((line) => line.slice(label.length + 1))+ if (values.length !== 1)+ throw new Error('Ambiguous FFmpeg signing identity')+ return values[0]}+ const record = signing.binaries[name]+ const canonicalTimestamp = parseSecureTimestamp(field('Timestamp'))+ const flags = /flags=0x([0-9a-f]+)\(/i.exec(text)+ // The Team ID is authenticated by the pinned manifest and compared only in memory.+ if (+ field('TeamIdentifier') !== signing.identity.teamId ||+ field('CDHash') !== record.cdHash ||+ canonicalTimestamp !== record.timestamp ||+ field('Identifier') !== `net.agalwood.motrix.${name}` ||+ !text.split(/\r?\n/).includes(`Authority=${signing.identity.subject}`) ||+ !flags ||+ (Number.parseInt(flags[1], 16) & 0x10000) === 0+ )+ throw new Error('FFmpeg signature evidence mismatch')+ const prefix = path.join(temporary, name)+ await checked(run, '/usr/bin/codesign', [+ '--display',+ `--extract-certificates=${prefix}`,+ binary,+ ])+ if (sha256(await readFile(`${prefix}0`)) !== certificate.certificateSha256)+ throw new Error('FFmpeg leaf certificate mismatch')+ // Apple prescribes the notarized requirement for standalone CLI tools;+ // spctl's application assessment rejects valid non-app executables.} finally {await rm(temporary, { recursive: true, force: true })}diff --git a/src/main/plugin/ffmpeg-probe-electron.ts b/src/main/plugin/ffmpeg-probe-electron.tsindex 34643fa3..59886e11 100644--- a/src/main/plugin/ffmpeg-probe-electron.ts+++ b/src/main/plugin/ffmpeg-probe-electron.ts@@ -1,12 +1,15 @@// Resolve candidates and check trust before executing any version probe.// Managed macOS CLI tools require authenticated metadata, hashes and Apple's-// online notarized code requirement. External quarantined paths keep their-// existing Gatekeeper application assessment, without any fallback on denial.+// online notarized code requirement. Legacy official binaries get the same+// CLI checks after authenticating against their signed release. Other+// external paths keep their Gatekeeper assessment, without fallback on denial.import path from 'node:path'import {assertManagedFfmpegTrusted,+ FfmpegDownloadUnavailableError,resolveManagedFfmpegCandidate,+ verifyLegacyMacFfmpeg,} from '@core/ffmpeg/verified-install'import {type FfmpegDetection,@@ -19,7 +22,10 @@ import {} from '@shared/schemas/ffmpeg-release'import { type RunCommand, runCommand } from '../cli/command-runner'import { resolveExecutable } from '../cli/shell-environment'-import { verifyMacFfmpegTrust } from './ffmpeg-macos-trust'+import {+ verifyMacFfmpegBinaryTrust,+ verifyMacFfmpegTrust,+} from './ffmpeg-macos-trust'const XATTR_BIN = '/usr/bin/xattr'const SPCTL_BIN = '/usr/sbin/spctl'@@ -45,7 +51,9 @@ type ProbeFfmpegBinary = (export interface ElectronFfmpegProbeOptions {userDataDir?: stringplatform?: NodeJS.Platform+ arch?: stringenv?: NodeJS.ProcessEnv+ fetcher?: typeof fetchrun?: RunCommandresolve?: ResolveFfmpegExecutableprobe?: ProbeFfmpegBinary@@ -61,7 +69,8 @@ function unavailable(/*** Create a probe suitable for injection into `detectInOrder`.*- * A quarantined macOS candidate is only executed when `spctl` accepts it.+ * Official macOS CLI binaries require authenticated release and OS evidence;+ * other quarantined candidates are only executed when `spctl` accepts them.* Failures to run either static inspection tool are handled conservatively.*/export function makeElectronFfmpegProbe(@@ -133,7 +142,8 @@ export function makeElectronFfmpegProbe(if (quarantineResult.code !== 0 ||quarantineResult.timedOut ||- quarantineResult.spawnError+ quarantineResult.spawnError ||+ quarantineResult.truncated) {return unavailable('untrusted', resolved)}@@ -141,6 +151,32 @@ export function makeElectronFfmpegProbe(const attributes = quarantineResult.stdout.split(/\r?\n/)if (!attributes.includes('com.apple.quarantine')) return probe(resolved)+ if (+ options.userDataDir &&+ resolved === path.resolve(options.userDataDir, 'binaries', 'ffmpeg')+ ) {+ try {+ const arch = options.arch ?? process.arch+ if (arch !== 'arm64' && arch !== 'x64')+ return unavailable('untrusted', resolved)+ await verifyLegacyMacFfmpeg({+ userDataDir: options.userDataDir,+ binaryPath: resolved,+ arch,+ fetcher:+ options.fetcher ??+ (await import('./ffmpeg-fetch-electron')).fetchFfmpegAsset,+ systemTrust: (binary, target) =>+ verifyMacFfmpegBinaryTrust(binary, 'ffmpeg', target, run),+ })+ } catch (error) {+ if (error instanceof FfmpegDownloadUnavailableError)+ return unavailable('verification_unavailable', resolved)+ return unavailable('untrusted', resolved)+ }+ return probe(resolved)+ }+let assessmentResult: Awaited<ReturnType<RunCommand>>try {assessmentResult = await run(@@ -159,7 +195,8 @@ export function makeElectronFfmpegProbe(if (assessmentResult.code !== 0 ||assessmentResult.timedOut ||- assessmentResult.spawnError+ assessmentResult.spawnError ||+ assessmentResult.truncated) {return unavailable('untrusted', resolved)}diff --git a/src/main/plugin/ffmpeg-probe-managed.test.ts b/src/main/plugin/ffmpeg-probe-managed.test.tsindex a573ca8c..de799ee7 100644--- a/src/main/plugin/ffmpeg-probe-managed.test.ts+++ b/src/main/plugin/ffmpeg-probe-managed.test.ts@@ -1,4 +1,5 @@// @vitest-environment node+import { FfmpegDownloadUnavailableError } from '@core/ffmpeg/verified-install'import type { FfmpegTarget } from '@shared/schemas/ffmpeg-release'import { beforeEach, describe, expect, it, vi } from 'vitest'import { makeElectronFfmpegProbe } from './ffmpeg-probe-electron'@@ -7,13 +8,20 @@ const guards = vi.hoisted(() => ({authenticated: vi.fn(),candidate: vi.fn(),systemTrust: vi.fn(),+ legacy: vi.fn(),+ binaryTrust: vi.fn(),}))-vi.mock('@core/ffmpeg/verified-install', () => ({+vi.mock('@core/ffmpeg/verified-install', async (importOriginal) => ({+ FfmpegDownloadUnavailableError: (+ await importOriginal<typeof import('@core/ffmpeg/verified-install')>()+ ).FfmpegDownloadUnavailableError,assertManagedFfmpegTrusted: guards.authenticated,resolveManagedFfmpegCandidate: guards.candidate,+ verifyLegacyMacFfmpeg: guards.legacy,}))vi.mock('./ffmpeg-macos-trust', () => ({verifyMacFfmpegTrust: guards.systemTrust,+ verifyMacFfmpegBinaryTrust: guards.binaryTrust,}))const userDataDir = '/fixture/user-data'@@ -27,10 +35,114 @@ const target = {} as FfmpegTargetbeforeEach(() => {- vi.clearAllMocks()+ vi.resetAllMocks()guards.candidate.mockReturnValue(managedBinary)guards.authenticated.mockReturnValue(target)guards.systemTrust.mockResolvedValue(undefined)+ guards.binaryTrust.mockResolvedValue(undefined)+})++describe('legacy official macOS FFmpeg probing', () => {+ const legacyBinary = '/fixture/user-data/binaries/ffmpeg'+ function setup() {+ guards.candidate.mockReturnValue(legacyBinary)+ guards.authenticated.mockReturnValue(undefined)+ guards.legacy.mockImplementation(async (options) => {+ await options.systemTrust(options.binaryPath, target)+ })+ const run = vi.fn(async () => ({+ code: 0,+ stdout: 'com.apple.quarantine\n',+ stderr: '',+ }))+ const probe = vi.fn(async () => ({+ available: true,+ binaryPath: legacyBinary,+ }))+ const fetcher = vi.fn()+ const detect = makeElectronFfmpegProbe({+ userDataDir,+ platform: 'darwin',+ arch: 'arm64',+ resolve: async () => legacyBinary,+ run,+ probe,+ fetcher,+ })+ return { detect, run, probe, fetcher }+ }+ it('requires signed release authentication and CLI trust before probing a quarantined legacy binary', async () => {+ const { detect, run, probe, fetcher } = setup()+ await expect(detect(legacyBinary)).resolves.toMatchObject({+ available: true,+ })+ expect(guards.legacy).toHaveBeenCalledWith(+ expect.objectContaining({+ userDataDir,+ binaryPath: legacyBinary,+ arch: 'arm64',+ fetcher,+ })+ )+ expect(guards.binaryTrust).toHaveBeenCalledWith(+ legacyBinary,+ 'ffmpeg',+ target,+ run+ )+ expect(guards.binaryTrust.mock.invocationCallOrder[0]).toBeLessThan(+ probe.mock.invocationCallOrder[0]+ )+ expect(run.mock.calls).toHaveLength(1)+ })+ it.each(['manifest or hash', 'OS trust'])(+ 'does not execute or fall back to spctl after %s rejection',+ async (failure) => {+ const { detect, run, probe } = setup()+ if (failure === 'OS trust')+ guards.binaryTrust.mockRejectedValue(new Error('not notarized'))+ else guards.legacy.mockRejectedValue(new Error('untrusted release'))+ await expect(detect(legacyBinary)).resolves.toMatchObject({+ available: false,+ failureReason: 'untrusted',+ })+ expect(probe).not.toHaveBeenCalled()+ expect(run.mock.calls).toHaveLength(1)+ }+ )+ it('reports metadata outages as incomplete verification without aborting detection or executing the binary', async () => {+ const { detect, probe, run } = setup()+ guards.legacy.mockRejectedValue(new FfmpegDownloadUnavailableError())+ await expect(detect(legacyBinary)).resolves.toMatchObject({+ available: false,+ binaryPath: legacyBinary,+ failureReason: 'verification_unavailable',+ })+ expect(guards.binaryTrust).not.toHaveBeenCalled()+ expect(probe).not.toHaveBeenCalled()+ expect(run.mock.calls).toHaveLength(1)+ })+ it('keeps unrelated quarantined paths on the external Gatekeeper policy', async () => {+ guards.candidate.mockReturnValue('/downloads/ffmpeg')+ guards.authenticated.mockReturnValue(undefined)+ const run = vi.fn(async (command: string) => ({+ code: command.endsWith('xattr') ? 0 : 3,+ stdout: 'com.apple.quarantine\n',+ stderr: 'not an app',+ }))+ const probe = vi.fn()+ await expect(+ makeElectronFfmpegProbe({+ userDataDir,+ platform: 'darwin',+ resolve: async () => '/downloads/ffmpeg',+ run,+ probe,+ })('/downloads/ffmpeg')+ ).resolves.toMatchObject({ available: false, failureReason: 'untrusted' })+ expect(guards.legacy).not.toHaveBeenCalled()+ expect(probe).not.toHaveBeenCalled()+ })})describe('authenticated managed macOS FFmpeg probing', () => {it('requires the authenticated target and full CLI notarization before executing the version probe', async () => {diff --git a/src/renderer/routes/settings/cards/integration/media-tools-section.test.tsx b/src/renderer/routes/settings/cards/integration/media-tools-section.test.tsxindex eb62961f..00a0690b 100644--- a/src/renderer/routes/settings/cards/integration/media-tools-section.test.tsx+++ b/src/renderer/routes/settings/cards/integration/media-tools-section.test.tsx@@ -596,6 +596,97 @@ describe('MediaToolsSection', () => {).not.toBeInTheDocument()})+ it('shows a retryable initial detection failure and recovers on Refresh without a macOS blocked warning', async () => {+ let unavailable = true+ vi.mocked(transport.invoke).mockImplementation(async (channel) => {+ if (channel === Queries.GetFfmpegDetection && unavailable)+ throw new Error('FFMPEG_RELEASE_UNAVAILABLE')+ return {+ active: { path: '/legacy/ffmpeg', version: '9.0.2' },+ candidates: [+ { kind: 'userData', path: '/legacy/ffmpeg', state: 'active' },+ ],+ }+ })+ render(<TestForm />)+ expect(+ await screen.findByText(/Couldn’t refresh FFmpeg detection/)+ ).toBeInTheDocument()+ expect(+ screen.queryByText('FFmpeg was blocked by macOS')+ ).not.toBeInTheDocument()+ unavailable = false+ fireEvent.click(screen.getByRole('button', { name: /^Refresh$/ }))+ expect(await screen.findByText('FFmpeg 9.0.2')).toBeInTheDocument()+ expect(+ screen.queryByText(/Couldn’t refresh FFmpeg detection/)+ ).not.toBeInTheDocument()+ })++ it('does not let a late initial failure overwrite a successful retry', async () => {+ let rejectInitial!: (error: Error) => void+ const initial = new Promise((_, reject) => {+ rejectInitial = reject+ })+ let calls = 0+ vi.mocked(transport.invoke).mockImplementation(async (channel) => {+ if (channel === Queries.GetFfmpegDetection && ++calls === 1)+ return initial+ return {+ active: { path: '/legacy/ffmpeg', version: '9.0.2' },+ candidates: [+ { kind: 'userData', path: '/legacy/ffmpeg', state: 'active' },+ ],+ }+ })+ render(<TestForm />)+ fireEvent.click(screen.getByRole('button', { name: /^Refresh$/ }))+ expect(await screen.findByText('FFmpeg 9.0.2')).toBeInTheDocument()+ await act(async () => rejectInitial(new Error('old request timed out')))+ expect(+ screen.queryByText(/Couldn’t refresh FFmpeg detection/)+ ).not.toBeInTheDocument()+ })++ it.each(['manual', 'path', 'none'])(+ 'shows incomplete verification while preserving the %s detection result',+ async (source) => {+ vi.mocked(transport.invoke).mockResolvedValue({+ active:+ source === 'none'+ ? null+ : { path: '/custom/ffmpeg', version: '9.0.2' },+ candidates: [+ ...(source === 'none'+ ? []+ : [{ kind: source, path: '/custom/ffmpeg', state: 'active' }]),+ {+ kind: 'userData',+ path: '/legacy/ffmpeg',+ state: 'verification_unavailable',+ },+ ],+ })+ render(<TestForm />)+ expect(+ await screen.findByText(/Couldn’t refresh FFmpeg detection/)+ ).toBeInTheDocument()+ expect(+ screen.queryByText('FFmpeg was blocked by macOS')+ ).not.toBeInTheDocument()+ if (source !== 'none')+ expect(screen.getByText('FFmpeg 9.0.2')).toBeInTheDocument()+ fireEvent.click(+ screen.getByRole('button', { name: 'Show detection details' })+ )+ expect(+ within(screen.getByTestId('candidate-row-userData')).getByText(+ 'Verification unavailable'+ )+ ).toBeInTheDocument()+ }+ )+it('shows a macOS trust failure instead of reporting the file as missing', async () => {vi.mocked(transport.invoke).mockResolvedValue({active: null,diff --git a/src/renderer/routes/settings/cards/integration/media-tools-section.tsx b/src/renderer/routes/settings/cards/integration/media-tools-section.tsxindex b1012790..50c2e068 100644--- a/src/renderer/routes/settings/cards/integration/media-tools-section.tsx+++ b/src/renderer/routes/settings/cards/integration/media-tools-section.tsx@@ -35,7 +35,7 @@ import { transport } from '@renderer/lib/transport'import { cn } from '@renderer/lib/utils'import { EXTERNAL_URLS, getFfmpegManualUrl } from '@shared/external-urls'import { Queries } from '@shared/protocol/queries'-import { useEffect, useId, useState } from 'react'+import { useEffect, useId, useRef, useState } from 'react'import { useFormContext } from 'react-hook-form'import { useTranslation } from 'react-i18next'import type { IntegrationFormValues } from './integration-dialog'@@ -50,6 +50,7 @@ type CandidateStateUI =| 'available'| 'missing'| 'untrusted'+ | 'verification_unavailable'| 'unconfigured'| 'version_mismatch'@@ -92,6 +93,7 @@ export function MediaToolsSection() {>(null)const [installError, setInstallError] = useState<string | null>(null)const [detectionRefreshFailed, setDetectionRefreshFailed] = useState(false)+ const detectionGeneration = useRef(0)const canInstall = ['darwin', 'linux', 'win32'].includes(transport.platform)const visibleResult =installResult ?? (installStatus?.phase === 'failed' ? 'failed' : null)@@ -118,28 +120,36 @@ export function MediaToolsSection() {useEffect(() => {let cancelled = false+ const generation = ++detectionGeneration.currenttransport.invoke(Queries.GetFfmpegDetection).then((d) => {- if (cancelled) return+ if (cancelled || generation !== detectionGeneration.current) returnsetDetection(d as FfmpegDetectionResultUI)+ setDetectionRefreshFailed(false)+ })+ .catch(() => {+ if (!cancelled && generation === detectionGeneration.current)+ setDetectionRefreshFailed(true)})- .catch(() => {})return () => {cancelled = true}}, [])const refresh = async () => {+ const generation = ++detectionGeneration.currenttry {const r = (await transport.invoke(Queries.GetFfmpegDetection)) as FfmpegDetectionResultUI+ if (generation !== detectionGeneration.current) returnsetDetection(r)setDetectionRefreshFailed(false)} catch {// Detection is independent of the already committed installation result.- setDetectionRefreshFailed(true)+ if (generation === detectionGeneration.current)+ setDetectionRefreshFailed(true)}}@@ -167,6 +177,9 @@ export function MediaToolsSection() {const hasUntrustedCandidate =!detection?.active &&detection?.candidates.some((candidate) => candidate.state === 'untrusted')+ const verificationUnavailable = detection?.candidates.some(+ (candidate) => candidate.state === 'verification_unavailable'+ )const activeLabel = detection?.active? t('settings.integration.media.detection.readyTitle', {version: detection.active.version,@@ -425,16 +438,15 @@ export function MediaToolsSection() {/></div>)}- {detectionRefreshFailed && (- <p role="alert">- {t(- 'settings.integration.media.download.detectionRefreshFailed'- )}- </p>- )}</div>)}+ {(detectionRefreshFailed || verificationUnavailable) && (+ <p role="alert" className="text-xs text-muted-foreground">+ {t('settings.integration.media.download.detectionRefreshFailed')}+ </p>+ )}+{transport.platform !== 'web' &&(detailsOpen || Boolean(pathError)) && (<p className="text-xs text-muted-foreground">@@ -616,7 +628,11 @@ export function MediaToolsSection() {variant={candidateStateVariant(c.state)}className="justify-self-end rounded-md">- {t(`settings.integration.media.state.${c.state}`)}+ {t(+ c.state === 'verification_unavailable'+ ? 'settings.integration.media.state.verificationUnavailable'+ : `settings.integration.media.state.${c.state}`+ )}</Badge></div>))}diff --git a/src/shared/locales/ar.json b/src/shared/locales/ar.jsonindex a1caf85c..0aefd9c7 100644--- a/src/shared/locales/ar.json+++ b/src/shared/locales/ar.json@@ -2670,7 +2670,8 @@"missing": "غير موجود","unconfigured": "غير معيّن","untrusted": "محظور بواسطة macOS",- "version_mismatch": "غير مدعوم"+ "version_mismatch": "غير مدعوم",+ "verificationUnavailable": "التحقق غير متاح"},"title": "أدوات الوسائط","validation": {diff --git a/src/shared/locales/bg.json b/src/shared/locales/bg.jsonindex 151b008f..44d296b3 100644--- a/src/shared/locales/bg.json+++ b/src/shared/locales/bg.json@@ -2590,7 +2590,8 @@"missing": "Не е намерен","unconfigured": "Не е зададен","untrusted": "Блокиран от macOS",- "version_mismatch": "Неподдържан"+ "version_mismatch": "Неподдържан",+ "verificationUnavailable": "Проверката е недостъпна"},"title": "Мултимедийни инструменти","validation": {diff --git a/src/shared/locales/ca.json b/src/shared/locales/ca.jsonindex 25148922..aae6d908 100644--- a/src/shared/locales/ca.json+++ b/src/shared/locales/ca.json@@ -2610,7 +2610,8 @@"missing": "No trobat","unconfigured": "No establert","untrusted": "Bloquejat pel macOS",- "version_mismatch": "No compatible"+ "version_mismatch": "No compatible",+ "verificationUnavailable": "Verificació no disponible"},"title": "Eines multimèdia","validation": {diff --git a/src/shared/locales/de.json b/src/shared/locales/de.jsonindex 211f1674..04e9fe15 100644--- a/src/shared/locales/de.json+++ b/src/shared/locales/de.json@@ -2142,7 +2142,8 @@"missing": "Nicht gefunden","untrusted": "Von macOS blockiert","unconfigured": "Nicht festgelegt",- "version_mismatch": "Nicht unterstützt"+ "version_mismatch": "Nicht unterstützt",+ "verificationUnavailable": "Prüfung nicht verfügbar"},"stagingMB": "Limit für temporäre Dateien (MB)","stagingMBDesc": "Speicherplatz für Zwischendateien pro Plugin und Aufgabe.",diff --git a/src/shared/locales/el.json b/src/shared/locales/el.jsonindex b52360bb..378450b0 100644--- a/src/shared/locales/el.json+++ b/src/shared/locales/el.json@@ -2590,7 +2590,8 @@"missing": "Δεν βρέθηκε","unconfigured": "Δεν έχει οριστεί","untrusted": "Αποκλείστηκε από το macOS",- "version_mismatch": "Δεν υποστηρίζεται"+ "version_mismatch": "Δεν υποστηρίζεται",+ "verificationUnavailable": "Η επαλήθευση δεν είναι διαθέσιμη"},"title": "Εργαλεία πολυμέσων","validation": {diff --git a/src/shared/locales/en-US.json b/src/shared/locales/en-US.jsonindex 7b0d8660..e783c13d 100644--- a/src/shared/locales/en-US.json+++ b/src/shared/locales/en-US.json@@ -2142,7 +2142,8 @@"missing": "Not found","untrusted": "Blocked by macOS","unconfigured": "Not set",- "version_mismatch": "Unsupported"+ "version_mismatch": "Unsupported",+ "verificationUnavailable": "Verification unavailable"},"stagingMB": "Temporary file limit (MB)","stagingMBDesc": "Space for intermediate files, per plugin and task.",diff --git a/src/shared/locales/es.json b/src/shared/locales/es.jsonindex 89915cb8..3254aae4 100644--- a/src/shared/locales/es.json+++ b/src/shared/locales/es.json@@ -2157,7 +2157,8 @@"missing": "No encontrado","untrusted": "Bloqueado por macOS","unconfigured": "Sin definir",- "version_mismatch": "No compatible"+ "version_mismatch": "No compatible",+ "verificationUnavailable": "Verificación no disponible"},"stagingMB": "Límite de archivos temporales (MB)","stagingMBDesc": "Espacio para archivos intermedios, por plugin y tarea.",diff --git a/src/shared/locales/fa.json b/src/shared/locales/fa.jsonindex 02c106ec..a80ae370 100644--- a/src/shared/locales/fa.json+++ b/src/shared/locales/fa.json@@ -2590,7 +2590,8 @@"missing": "پیدا نشد","unconfigured": "تنظیم نشده","untrusted": "مسدودشده توسط macOS",- "version_mismatch": "پشتیبانی نمیشود"+ "version_mismatch": "پشتیبانی نمیشود",+ "verificationUnavailable": "تأیید در دسترس نیست"},"title": "ابزارهای رسانه","validation": {diff --git a/src/shared/locales/fr.json b/src/shared/locales/fr.jsonindex 30b1fe0b..552c2f94 100644--- a/src/shared/locales/fr.json+++ b/src/shared/locales/fr.json@@ -2610,7 +2610,8 @@"missing": "Introuvable","unconfigured": "Non défini","untrusted": "Bloqué par macOS",- "version_mismatch": "Non pris en charge"+ "version_mismatch": "Non pris en charge",+ "verificationUnavailable": "Vérification indisponible"},"title": "Outils multimédias","validation": {diff --git a/src/shared/locales/hu.json b/src/shared/locales/hu.jsonindex bb4ade8b..2a6ff0f0 100644--- a/src/shared/locales/hu.json+++ b/src/shared/locales/hu.json@@ -2142,7 +2142,8 @@"missing": "Nem található","untrusted": "A macOS blokkolta","unconfigured": "Nincs beállítva",- "version_mismatch": "Nem támogatott"+ "version_mismatch": "Nem támogatott",+ "verificationUnavailable": "Az ellenőrzés nem érhető el"},"stagingMB": "Ideiglenes fájlok méretkorlátja (MB)","stagingMBDesc": "A köztes fájlok számára rendelkezésre álló tárhely bővítményenként és feladatonként.",diff --git a/src/shared/locales/id.json b/src/shared/locales/id.jsonindex 3b8e0b15..9f0ae29d 100644--- a/src/shared/locales/id.json+++ b/src/shared/locales/id.json@@ -2127,7 +2127,8 @@"missing": "Tidak ditemukan","untrusted": "Diblokir oleh macOS","unconfigured": "Belum diatur",- "version_mismatch": "Tidak didukung"+ "version_mismatch": "Tidak didukung",+ "verificationUnavailable": "Verifikasi tidak tersedia"},"stagingMB": "Batas berkas sementara (MB)","stagingMBDesc": "Ruang untuk berkas perantara, per plugin dan tugas.",diff --git a/src/shared/locales/it.json b/src/shared/locales/it.jsonindex c45be749..d199158a 100644--- a/src/shared/locales/it.json+++ b/src/shared/locales/it.json@@ -2157,7 +2157,8 @@"missing": "Non trovato","untrusted": "Bloccato da macOS","unconfigured": "Non impostato",- "version_mismatch": "Non supportato"+ "version_mismatch": "Non supportato",+ "verificationUnavailable": "Verifica non disponibile"},"stagingMB": "Limite dei file temporanei (MB)","stagingMBDesc": "Spazio per i file intermedi, per plugin e attività.",diff --git a/src/shared/locales/ja.json b/src/shared/locales/ja.jsonindex 635a154e..8123167d 100644--- a/src/shared/locales/ja.json+++ b/src/shared/locales/ja.json@@ -2127,7 +2127,8 @@"missing": "見つかりません","untrusted": "macOS によりブロック","unconfigured": "未設定",- "version_mismatch": "非対応"+ "version_mismatch": "非対応",+ "verificationUnavailable": "検証できません"},"stagingMB": "一時ファイルの上限(MB)","stagingMBDesc": "プラグインおよびタスクごとの中間ファイル用の容量です。",diff --git a/src/shared/locales/ko.json b/src/shared/locales/ko.jsonindex e34b8abe..8541b7a0 100644--- a/src/shared/locales/ko.json+++ b/src/shared/locales/ko.json@@ -2127,7 +2127,8 @@"missing": "찾을 수 없음","untrusted": "macOS에서 차단됨","unconfigured": "설정되지 않음",- "version_mismatch": "지원되지 않음"+ "version_mismatch": "지원되지 않음",+ "verificationUnavailable": "검증할 수 없음"},"stagingMB": "임시 파일 제한(MB)","stagingMBDesc": "플러그인과 작업별 중간 파일에 사용할 공간입니다.",diff --git a/src/shared/locales/nb.json b/src/shared/locales/nb.jsonindex 5ea22c73..450c4cb6 100644--- a/src/shared/locales/nb.json+++ b/src/shared/locales/nb.json@@ -2590,7 +2590,8 @@"missing": "Ikke funnet","unconfigured": "Ikke angitt","untrusted": "Blokkert av macOS",- "version_mismatch": "Støttes ikke"+ "version_mismatch": "Støttes ikke",+ "verificationUnavailable": "Verifisering utilgjengelig"},"title": "Medieverktøy","validation": {diff --git a/src/shared/locales/nl.json b/src/shared/locales/nl.jsonindex 97603479..eda46241 100644--- a/src/shared/locales/nl.json+++ b/src/shared/locales/nl.json@@ -2590,7 +2590,8 @@"missing": "Niet gevonden","unconfigured": "Niet ingesteld","untrusted": "Geblokkeerd door macOS",- "version_mismatch": "Niet ondersteund"+ "version_mismatch": "Niet ondersteund",+ "verificationUnavailable": "Verificatie niet beschikbaar"},"title": "Mediahulpmiddelen","validation": {diff --git a/src/shared/locales/pl.json b/src/shared/locales/pl.jsonindex b659cb18..9ef4b8df 100644--- a/src/shared/locales/pl.json+++ b/src/shared/locales/pl.json@@ -2172,7 +2172,8 @@"missing": "Nie znaleziono","untrusted": "Zablokowany przez macOS","unconfigured": "Nie ustawiono",- "version_mismatch": "Nieobsługiwany"+ "version_mismatch": "Nieobsługiwany",+ "verificationUnavailable": "Weryfikacja niedostępna"},"stagingMB": "Limit plików tymczasowych (MB)","stagingMBDesc": "Miejsce na pliki pośrednie dla każdej wtyczki i każdego zadania.",diff --git a/src/shared/locales/pt-BR.json b/src/shared/locales/pt-BR.jsonindex 9d9d08e1..4cf76de7 100644--- a/src/shared/locales/pt-BR.json+++ b/src/shared/locales/pt-BR.json@@ -2157,7 +2157,8 @@"missing": "Não encontrado","untrusted": "Bloqueado pelo macOS","unconfigured": "Não definido",- "version_mismatch": "Não compatível"+ "version_mismatch": "Não compatível",+ "verificationUnavailable": "Verificação indisponível"},"stagingMB": "Limite de arquivos temporários (MB)","stagingMBDesc": "Espaço para arquivos intermediários, por plugin e tarefa.",diff --git a/src/shared/locales/ro.json b/src/shared/locales/ro.jsonindex dea8b477..d994b87d 100644--- a/src/shared/locales/ro.json+++ b/src/shared/locales/ro.json@@ -2610,7 +2610,8 @@"missing": "Negăsit","unconfigured": "Nesetat","untrusted": "Blocat de macOS",- "version_mismatch": "Neacceptat"+ "version_mismatch": "Neacceptat",+ "verificationUnavailable": "Verificare indisponibilă"},"title": "Instrumente media","validation": {diff --git a/src/shared/locales/ru.json b/src/shared/locales/ru.jsonindex 637d0d85..10ca7c5d 100644--- a/src/shared/locales/ru.json+++ b/src/shared/locales/ru.json@@ -2172,7 +2172,8 @@"missing": "Не найден","untrusted": "Заблокирован macOS","unconfigured": "Не задано",- "version_mismatch": "Не поддерживается"+ "version_mismatch": "Не поддерживается",+ "verificationUnavailable": "Проверка недоступна"},"stagingMB": "Лимит временных файлов (МБ)","stagingMBDesc": "Место для промежуточных файлов, отдельно для каждого плагина и задачи.",diff --git a/src/shared/locales/th.json b/src/shared/locales/th.jsonindex 57ea2b3c..58ee220b 100644--- a/src/shared/locales/th.json+++ b/src/shared/locales/th.json@@ -2570,7 +2570,8 @@"missing": "ไม่พบ","unconfigured": "ยังไม่ได้ตั้งค่า","untrusted": "ถูก macOS บล็อก",- "version_mismatch": "ไม่รองรับ"+ "version_mismatch": "ไม่รองรับ",+ "verificationUnavailable": "ไม่สามารถตรวจสอบได้"},"title": "เครื่องมือสื่อ","validation": {diff --git a/src/shared/locales/tr.json b/src/shared/locales/tr.jsonindex 9827f216..560f91d4 100644--- a/src/shared/locales/tr.json+++ b/src/shared/locales/tr.json@@ -2142,7 +2142,8 @@"missing": "Bulunamadı","untrusted": "macOS tarafından engellendi","unconfigured": "Ayarlanmadı",- "version_mismatch": "Desteklenmiyor"+ "version_mismatch": "Desteklenmiyor",+ "verificationUnavailable": "Doğrulama kullanılamıyor"},"stagingMB": "Geçici dosya sınırı (MB)","stagingMBDesc": "Eklenti ve görev başına ara dosyalar için ayrılan alan.",diff --git a/src/shared/locales/uk.json b/src/shared/locales/uk.jsonindex bee1e49b..c0769bab 100644--- a/src/shared/locales/uk.json+++ b/src/shared/locales/uk.json@@ -2630,7 +2630,8 @@"missing": "Не знайдено","unconfigured": "Не задано","untrusted": "Заблоковано macOS",- "version_mismatch": "Не підтримується"+ "version_mismatch": "Не підтримується",+ "verificationUnavailable": "Перевірка недоступна"},"title": "Медіаінструменти","validation": {diff --git a/src/shared/locales/vi.json b/src/shared/locales/vi.jsonindex 657a0071..105671fb 100644--- a/src/shared/locales/vi.json+++ b/src/shared/locales/vi.json@@ -2127,7 +2127,8 @@"missing": "Không tìm thấy","untrusted": "Bị macOS chặn","unconfigured": "Chưa đặt",- "version_mismatch": "Không được hỗ trợ"+ "version_mismatch": "Không được hỗ trợ",+ "verificationUnavailable": "Không thể xác minh"},"stagingMB": "Giới hạn tệp tạm (MB)","stagingMBDesc": "Dung lượng cho tệp trung gian, tính riêng theo từng tiện ích và tác vụ.",diff --git a/src/shared/locales/zh-CN.json b/src/shared/locales/zh-CN.jsonindex 1912be37..983ab262 100644--- a/src/shared/locales/zh-CN.json+++ b/src/shared/locales/zh-CN.json@@ -2127,7 +2127,8 @@"missing": "未找到","untrusted": "macOS 已阻止","unconfigured": "未设置",- "version_mismatch": "不受支持"+ "version_mismatch": "不受支持",+ "verificationUnavailable": "暂时无法验证"},"stagingMB": "临时文件空间上限(MB)","stagingMBDesc": "每个插件、每个任务处理媒体时可用的临时空间。",diff --git a/src/shared/locales/zh-TW.json b/src/shared/locales/zh-TW.jsonindex 9671978d..e56f667b 100644--- a/src/shared/locales/zh-TW.json+++ b/src/shared/locales/zh-TW.json@@ -2127,7 +2127,8 @@"missing": "找不到","untrusted": "macOS 已阻擋","unconfigured": "未設定",- "version_mismatch": "不支援"+ "version_mismatch": "不支援",+ "verificationUnavailable": "暫時無法驗證"},"stagingMB": "暫存檔案空間上限(MB)","stagingMBDesc": "每個外掛、每個任務處理媒體時可用的暫存空間。",