diff --git a/docs/integrations/cloudflare.md b/docs/integrations/cloudflare.md index 736a0a291..61ae5c508 100644 --- a/docs/integrations/cloudflare.md +++ b/docs/integrations/cloudflare.md @@ -360,7 +360,7 @@ ISR uses the shared cache protocol. Entries are scoped to a deployment and hostn With Cloudflare selected, `void secret`, `void domain`, `void project status|list|logs|rollback`, and remote `void db` commands use the saved Worker and account. Database commands operate on the selected D1 database. Logs are a live tail; Void doesn't provide hosted log history for direct deploys. -Custom domain changes update routes immediately without rewriting schedules, queues, or workflows. Removing the final custom domain requires `CLOUDFLARE_API_TOKEN` with Workers Scripts: Edit because that operation uses Cloudflare's domain-record API. +Custom domain changes update routes immediately without rewriting schedules, queues, or workflows. Removing the final custom domain uses your browser session from `void cloudflare login` or an API token with Workers Scripts: Edit permission. `void project delete` doesn't remove direct Cloudflare resources, which may be shared. Review their use and remove them explicitly in Cloudflare. diff --git a/docs/reference/cli.md b/docs/reference/cli.md index 4ef1ed2ca..fe6fe898e 100644 --- a/docs/reference/cli.md +++ b/docs/reference/cli.md @@ -1522,7 +1522,7 @@ Add a custom domain to the saved target. Hosted Void projects print the DNS reco void domain delete [--project ] ``` -Direct Cloudflare projects apply the change immediately. Deleting the final custom domain requires `CLOUDFLARE_API_TOKEN` with Workers Scripts: Edit permission because the standard trigger operation does not reconcile an empty custom-domain set; Void fails before changing local or remote state when that token is unavailable. +Direct Cloudflare projects apply the change immediately. Deleting the final custom domain uses your browser session from `void cloudflare login` or an API token with Workers Scripts: Edit permission. If Cloudflare rejects the change, Void attempts to restore the previous domain configuration and reports whether recovery succeeded. Remove a custom domain from the saved target. For Cloudflare, this removes the matching `custom_domain` route and synchronizes triggers. If Cloudflare rejects the update, Void restores the exact previous local config and immediately reapplies it remotely. If that second synchronization also fails, the CLI reports that remote route state may be partial instead of claiming a successful rollback. diff --git a/packages/deploy-cloudflare/src/version.ts b/packages/deploy-cloudflare/src/version.ts index dc8dbf445..0803ccd8d 100644 --- a/packages/deploy-cloudflare/src/version.ts +++ b/packages/deploy-cloudflare/src/version.ts @@ -838,6 +838,14 @@ async function activateCloudflareVersionWithSecretsFile( return { ok: false, reason: 'uploader-changed' }; } const previousVersionId = previous.versionId; + // Activation can succeed before trigger synchronization or the local receipt + // cleanup fails. Once its last recorded candidate owns all live traffic, the + // receipt no longer authorizes any *inactive* successor. The history checks + // below still reject a newer upload from another operation. + const trustedInheritanceVersionIds = + previousVersionId && options.trustedInheritanceVersionIds?.at(-1) === previousVersionId + ? [] + : options.trustedInheritanceVersionIds; let inheritanceBaseline: Array | undefined; let trustedCandidateChain = false; if (options.expectedPreviousVersionId !== undefined || options.verifyInheritedSecrets === true) { @@ -848,22 +856,22 @@ async function activateCloudflareVersionWithSecretsFile( const latestVersionId = recent.at(-1)?.id ?? null; if ( options.expectedPreviousVersionId !== undefined || - options.trustedInheritanceVersionIds !== undefined + trustedInheritanceVersionIds !== undefined ) { const activeIndex = recent.findIndex((version) => version.id === previous.versionId); const inheritedChain = activeIndex < 0 ? [] : recent.slice(activeIndex); const inheritedCandidates = inheritedChain.slice(1).map((version) => version.id); trustedCandidateChain = - options.trustedInheritanceVersionIds !== undefined && - options.trustedInheritanceVersionIds.length > 0 && - arraysEqual(inheritedCandidates, options.trustedInheritanceVersionIds); + trustedInheritanceVersionIds !== undefined && + trustedInheritanceVersionIds.length > 0 && + arraysEqual(inheritedCandidates, trustedInheritanceVersionIds); const safeInheritanceChain = inheritedChain.length > 0 && inheritedChain.every( (version, index) => index === 0 || version.number === inheritedChain[index - 1]!.number + 1, ) && - (arraysEqual(inheritedCandidates, options.trustedInheritanceVersionIds ?? []) || + (arraysEqual(inheritedCandidates, trustedInheritanceVersionIds ?? []) || options.pinActiveSecrets !== undefined); if (!safeInheritanceChain) { return { diff --git a/packages/deploy-cloudflare/test/unit/version.test.ts b/packages/deploy-cloudflare/test/unit/version.test.ts index 3c3f4289b..c40978e1d 100644 --- a/packages/deploy-cloudflare/test/unit/version.test.ts +++ b/packages/deploy-cloudflare/test/unit/version.test.ts @@ -376,6 +376,46 @@ describe('Cloudflare version activation', () => { ).resolves.toMatchObject({ ok: true, versionId: NEXT }); }); + it('recovers a receipt whose last candidate already owns production', async () => { + const runWrangler = runner(); + const recordVerifiedCandidate = vi.fn(); + await expect( + activateCloudflareVersion({ + runWrangler, + workerName: 'my-worker', + verifyUploader: () => true, + verifyInheritedSecrets: true, + trustedInheritanceVersionIds: [CONCURRENT, CURRENT], + message: encodeCloudflareVersionMessage([]), + fetch: async () => Response.json({ ready: true }), + recordVerifiedCandidate, + }), + ).resolves.toMatchObject({ ok: true, versionId: NEXT, previousVersionId: CURRENT }); + expect(recordVerifiedCandidate).toHaveBeenCalledWith(NEXT, CURRENT); + }); + + it('still rejects a foreign upload after the recorded candidate became active', async () => { + const runWrangler = runner({ + versions: ok( + JSON.stringify([ + { id: CURRENT, number: 1 }, + { id: CONCURRENT, number: 2 }, + ]), + ), + }); + await expect( + activateCloudflareVersion({ + runWrangler, + workerName: 'my-worker', + verifyUploader: () => true, + verifyInheritedSecrets: true, + trustedInheritanceVersionIds: [CURRENT], + message: encodeCloudflareVersionMessage([]), + }), + ).resolves.toMatchObject({ ok: false, reason: 'inheritance-source-changed' }); + expect(runWrangler.mock.calls.some(([args]) => args[1] === 'upload')).toBe(false); + }); + it('does not inherit any remote secret from a failed candidate newer than production', async () => { const failed = '44444444-4444-4444-8444-444444444444'; const directory = mkdtempSync(join(tmpdir(), 'void-active-secret-inheritance-')); diff --git a/packages/void/package.json b/packages/void/package.json index 80c8b97d9..12e40413e 100644 --- a/packages/void/package.json +++ b/packages/void/package.json @@ -328,6 +328,7 @@ "@cloudflare/config": "0.20.0", "@cloudflare/sandbox": "^0.12.9", "@cloudflare/vite-plugin": "1.54.7", + "@cloudflare/workers-auth": "0.9.4", "@cloudflare/workers-types": "catalog:", "@napi-rs/keyring": "2.0.0", "@void/deploy-cloudflare": "workspace:*", diff --git a/packages/void/src/cli/cf-build-output.ts b/packages/void/src/cli/cf-build-output.ts index 59f4e9a59..3ed48ecfa 100644 --- a/packages/void/src/cli/cf-build-output.ts +++ b/packages/void/src/cli/cf-build-output.ts @@ -48,6 +48,11 @@ const moduleTypes: Record = { '.cjs': 'cjs', '.wasm': 'wasm', '.bin': 'data', + '.woff': 'data', + '.woff2': 'data', + '.ttf': 'data', + '.otf': 'data', + '.eot': 'data', '.txt': 'text', '.html': 'text', '.sql': 'text', @@ -92,7 +97,9 @@ function copyBundle( } const type = moduleTypes[extname(entry.name).toLowerCase()]; if (!type) { - return null; + throw new Error( + `The built Worker contains an unsupported module ${JSON.stringify(name)}. Emit public assets into the client output or configure the plugin that produced this file to run only in the client environment.`, + ); } const destinationPath = join(destination, name); mkdirSync(dirname(destinationPath), { recursive: true }); @@ -123,9 +130,24 @@ export async function prepareCfBuildOutput( if (!config.worker) { throw new Error('cf did not produce a Worker configuration.'); } - const main = raw.main; - if (typeof main !== 'string' || basename(main) !== main || !existsSync(join(source, main))) { - return null; + if (typeof raw.main !== 'string' || !raw.main) { + throw new Error('The built Worker configuration is missing its main entry. Rebuild the app.'); + } + const entry = raw.main.replaceAll('\\', '/'); + const main = relative(source, resolve(source, entry)); + if ( + isAbsolute(entry) || + /^[a-z]:/i.test(entry) || + !main || + main === '..' || + main.startsWith('../') + ) { + throw new Error('The built Worker main entry must be inside its output directory.'); + } + if (!existsSync(join(source, main))) { + throw new Error( + `The built Worker main entry ${JSON.stringify(main)} is missing. Rebuild the app.`, + ); } const assets = object(raw.assets); diff --git a/packages/void/src/cli/cf-compat.ts b/packages/void/src/cli/cf-compat.ts index 4da2c8f52..08a2beaaf 100644 --- a/packages/void/src/cli/cf-compat.ts +++ b/packages/void/src/cli/cf-compat.ts @@ -13,12 +13,16 @@ import { parse } from 'jsonc-parser'; import { dirname, join, resolve } from 'pathslash'; import { EnvHttpProxyAgent, fetch as httpFetch } from 'undici'; import { prepareCfBuildOutput } from './cf-build-output.ts'; +import { persistCfKeyringPreference, readCfSessionCredential } from './cf-session.ts'; type Result = { status: number; stdout: string; stderr: string }; type Json = Record; const cf = join(dirname(fileURLToPath(import.meta.resolve('cf/package.json'))), 'bin', 'cf'); const args = process.argv.slice(2); +// This dedicated transport process uses the same encrypted OAuth store for +// login, deployment, and ancillary API calls. API-token overrides still win. +process.env.CLOUDFLARE_AUTH_USE_KEYRING = 'true'; function cfEnvironment(): NodeJS.ProcessEnv { // The pinned bin otherwise delegates to any cf installed by the project. @@ -51,14 +55,9 @@ function result(status: number, stdout = '', stderr = ''): Result { return { status, stdout, stderr }; } -function runCf(command: Array, cwd = process.cwd(), useLoginProfile = false): Result { +function runCf(command: Array, cwd = process.cwd()): Result { const env = cfEnvironment(); env.CF_QUIET = '1'; - if (useLoginProfile) { - // Void's browser login uses cf's regular profile. Deploy's legacy Wrangler - // keyring pin must not switch the credential source while borrowing it. - delete env.CLOUDFLARE_AUTH_USE_KEYRING; - } const child = spawnSync(process.execPath, [cf, ...command], { cwd, env, @@ -290,6 +289,52 @@ async function clearWorkerCronSchedules(worker: string): Promise { } } +async function clearWorkerCustomDomains(worker: string): Promise { + const base = ( + process.env.CLOUDFLARE_API_BASE_URL ?? 'https://api.cloudflare.com/client/v4' + ).replace(/\/$/, ''); + const endpoint = `${base}/accounts/${encodeURIComponent(accountId())}/workers/scripts/${encodeURIComponent(worker)}/domains/records`; + const proxy = + process.env.HTTP_PROXY || + process.env.HTTPS_PROXY || + process.env.http_proxy || + process.env.https_proxy + ? new EnvHttpProxyAgent() + : null; + try { + const response = await httpFetch(endpoint, { + method: 'PUT', + headers: { ...apiHeaders(), 'Content-Type': 'application/json' }, + body: JSON.stringify({ + override_scope: true, + override_existing_origin: false, + override_existing_dns_record: false, + origins: [], + }), + redirect: 'error', + signal: AbortSignal.timeout(30_000), + ...(proxy ? { dispatcher: proxy } : {}), + }); + if (!response.ok) { + throw new Error(`Cloudflare rejected the empty custom-domain set (HTTP ${response.status}).`); + } + let body: unknown; + try { + body = await response.json(); + } catch { + throw new Error( + `Cloudflare returned HTTP ${response.status} with a non-JSON custom-domain response.`, + ); + } + if (object(body).success !== true) { + throw new Error(`Cloudflare rejected the empty custom-domain set (HTTP ${response.status}).`); + } + return result(0); + } finally { + await proxy?.close(); + } +} + async function assertExistingProvisionableResources( directory: string, account: string, @@ -405,7 +450,7 @@ function sessionCredential(): { type: 'oauth' | 'api_token'; token: string } | n if (token) { return { type: 'api_token', token }; } - const identity = runCf(['auth', 'whoami'], process.cwd(), true); + const identity = runCf(['auth', 'whoami']); if (identity.status !== 0) { return null; } @@ -413,21 +458,17 @@ function sessionCredential(): { type: 'oauth' | 'api_token'; token: string } | n if (state.authenticated !== true || state.tokenValid !== true) { return null; } - const source = state.authSource; - if (typeof source !== 'string' || !source.startsWith('OAuth token from ')) { - return null; - } - const credential = object( - parsedJson(readFileSync(source.slice('OAuth token from '.length), 'utf8')), - ); - return typeof credential.oauth_token === 'string' && credential.oauth_token - ? { type: 'oauth', token: credential.oauth_token } - : null; + const credential = readCfSessionCredential(process.cwd(), state); + return credential ? { type: 'oauth', token: credential } : null; } function auth(): Result { if (args[0] === 'login') { - return runInteractiveCf(['auth', 'login', '--force']); + const loggedIn = runInteractiveCf(['auth', 'login', '--force']); + if (loggedIn.status === 0) { + persistCfKeyringPreference(process.cwd()); + } + return loggedIn; } if (args[0] === 'logout') { return runCf(['auth', 'logout']); @@ -445,6 +486,9 @@ function auth(): Result { 'Cloudflare authentication is required.', ); } + if (String(identity.authSource).startsWith('OAuth token from ')) { + persistCfKeyringPreference(process.cwd()); + } return result( 0, JSON.stringify({ @@ -1029,6 +1073,14 @@ async function workerChanges(): Promise { } return await clearWorkerCronSchedules(name); } + if (args[0] === 'triggers' && args[1] === 'clear-domains') { + const raw = config(); + const name = workerName(); + if (raw.name !== name || (raw.account_id !== undefined && raw.account_id !== accountId())) { + throw new Error('Cloudflare trigger target changed.'); + } + return await clearWorkerCustomDomains(name); + } if ((args[0] === 'versions' && args[1] === 'upload') || args[0] === 'deploy') { const raw = config(); const path = configPath()!; diff --git a/packages/void/src/cli/cf-session.ts b/packages/void/src/cli/cf-session.ts new file mode 100644 index 000000000..00d9a32b1 --- /dev/null +++ b/packages/void/src/cli/cf-session.ts @@ -0,0 +1,58 @@ +import { + createCfAuth, + createCfProfileStore, + setKeyringPreference, +} from '@cloudflare/workers-auth/cf'; + +const logger = { + debug() {}, + info() {}, + log() {}, + warn() {}, + error() {}, +}; + +function session(root: string) { + const auth = createCfAuth({ + logger, + userAgent: 'void', + prompt: async () => { + throw new Error('Cloudflare session reads cannot prompt.'); + }, + select: async () => { + throw new Error('Cloudflare session reads cannot prompt.'); + }, + isNoDefaultValueProvidedError: () => false, + }); + auth.setProfile(createCfProfileStore({ logger }).resolve({ cwd: root })); + return auth; +} + +/** Borrow only the profile just verified by cf, including its encrypted store. */ +export function readCfSessionCredential( + root: string, + identity: Record, +): string | null { + if (identity.authenticated !== true || identity.tokenValid !== true) { + return null; + } + const auth = session(root); + if (identity.authSource !== `OAuth token from ${auth.getCredentialStore().path()}`) { + return null; + } + const token = auth.readAuthCredentials()?.oauth_token; + if (typeof token === 'string' && token.length > 0) { + persistCfKeyringPreference(root); + } + return typeof token === 'string' && token.length > 0 ? token : null; +} + +/** Keep subsequent cf logins on the encrypted profile adopted by Void. */ +export function persistCfKeyringPreference(root: string): void { + const auth = session(root); + if ( + !setKeyringPreference(true, { logger, getCredentialStore: auth.getCredentialStore }).enabled + ) { + throw new Error('Cloudflare encrypted credential storage is unavailable.'); + } +} diff --git a/packages/void/src/cli/cloudflare-candidate.ts b/packages/void/src/cli/cloudflare-candidate.ts index b11d452d3..762b8bbc8 100644 --- a/packages/void/src/cli/cloudflare-candidate.ts +++ b/packages/void/src/cli/cloudflare-candidate.ts @@ -81,13 +81,20 @@ export function recordCloudflareCandidateUpload( expected && (expected.accountId !== accountId || expected.workerName !== workerName || - expected.parentVersionId !== parentVersionId) + (expected.parentVersionId !== parentVersionId && + expected.versionIds.at(-1) !== parentVersionId)) ) { throw new Error( 'The saved Cloudflare candidate belongs to a different Worker or live version. Inspect the deployment before retrying.', ); } - const versionIds = [...(expected?.versionIds ?? []), versionId]; + // The activation runner supplies its verified live parent. If the last saved + // candidate already became that parent, begin a new chain instead of retaining + // the interrupted deployment's old parent and inactive-version authorization. + const versionIds = [ + ...(expected?.parentVersionId === parentVersionId ? expected.versionIds : []), + versionId, + ]; mkdirSync(join(root, '.void'), { recursive: true }); const path = join(root, CANDIDATE_FILE); const temp = `${path}.${process.pid}.tmp`; diff --git a/packages/void/src/cli/cloudflare-operations.ts b/packages/void/src/cli/cloudflare-operations.ts index 6b9eac7b6..c2fc9fde5 100644 --- a/packages/void/src/cli/cloudflare-operations.ts +++ b/packages/void/src/cli/cloudflare-operations.ts @@ -617,13 +617,6 @@ export async function changeCloudflareDomain( if (!update.modified) { return update; } - if (update.domains.length === 0 && !emptyDomainPublisher && !resolveCloudflareApiToken()) { - writeFileSync(before.configPath, original); - persistCloudflareConfig(root); - throw new Error( - 'Deleting the final Cloudflare custom domain requires CLOUDFLARE_API_TOKEN for the empty-domain API update. Export a scoped token with Workers Scripts: Edit permission and retry. No local or remote state changed.', - ); - } const triggerConfigDir = mkdtempSync(join(tmpdir(), 'void-domain-triggers-')); const triggerConfigPath = join(triggerConfigDir, 'wrangler.json'); const deployRoutes = async (): Promise => { @@ -668,55 +661,14 @@ export async function changeCloudflareDomain( } /** - * Reconcile an empty Custom Domain set through the API Wrangler itself uses. - * Wrangler 4.130 skips `publishCustomDomains()` when its configured set is - * empty, so `triggers deploy` exits successfully without removing the final - * domain. Direct API access is deliberately limited to an explicit API token; - * OAuth credential storage is Wrangler-private and must not be scraped. + * Publish an explicit empty Custom Domain set through the pinned cf transport. + * Trigger deploy omits empty domain sets; this operation must reconcile them + * explicitly using the same verified browser/API credentials as other commands. */ export async function publishEmptyCloudflareCustomDomainSet( context: CloudflareOperationContext, ): Promise { - const token = resolveCloudflareApiToken(); - if (!token) { - throw new Error( - 'CLOUDFLARE_API_TOKEN is required to restore an empty custom-domain set after the Cloudflare trigger update failed.', - ); - } - const response = await fetch( - `${context.apiBaseUrl}/accounts/${context.accountId}/workers/scripts/${context.workerName}/domains/records`, - { - method: 'PUT', - headers: { - Authorization: `Bearer ${token}`, - 'Content-Type': 'application/json', - }, - body: JSON.stringify({ - override_scope: true, - override_existing_origin: false, - override_existing_dns_record: false, - origins: [], - }), - redirect: 'error', - signal: AbortSignal.timeout(30_000), - }, - ); - let body: unknown; - try { - body = await response.json(); - } catch { - throw new Error( - `Cloudflare returned HTTP ${response.status} with a non-JSON custom-domain response.`, - ); - } - if ( - !response.ok || - typeof body !== 'object' || - body === null || - (body as Record).success !== true - ) { - throw new Error(`Cloudflare rejected the empty custom-domain set (HTTP ${response.status}).`); - } + await run(context, ['triggers', 'clear-domains', ...targetArgs(context)]); } /** Adapt the direct empty-domain API call to the deployment package's result contract. */ @@ -746,11 +698,6 @@ export function createCloudflareEmptyCronPublisher( }; } -function resolveCloudflareApiToken(): string | undefined { - const token = process.env.CLOUDFLARE_API_TOKEN || process.env.CF_API_TOKEN; - return token || undefined; -} - /** * Build a route-only Wrangler config for a domain update. `triggers deploy` * also reconciles cron, queue-consumer, and workflow triggers found in its diff --git a/packages/void/test/unit/cf-build-output.test.ts b/packages/void/test/unit/cf-build-output.test.ts index e63757143..c8ca223d0 100644 --- a/packages/void/test/unit/cf-build-output.test.ts +++ b/packages/void/test/unit/cf-build-output.test.ts @@ -43,7 +43,10 @@ function worker(config: Record): string { join(output, 'index.js'), 'export default { fetch() { return new Response("ok") } };\n', ); - writeFileSync(join(output, 'wrangler.json'), JSON.stringify(config)); + writeFileSync( + join(output, 'wrangler.json'), + JSON.stringify({ compatibility_date: '2026-09-29', ...config }), + ); return output; } @@ -254,6 +257,71 @@ it( CF_BUILD_TIMEOUT_MS, ); +it( + 'accepts a nested hashed Worker entry with binary font modules', + async () => { + const output = worker({ + name: 'void-test', + compatibility_date: '2026-09-29', + main: './assets/index-hash.js', + }); + mkdirSync(join(output, 'assets')); + writeFileSync( + join(output, 'assets/index-hash.js'), + "import font from './font.woff2'; export default { fetch() { return new Response(String(font.byteLength)) } };\n", + ); + writeFileSync(join(output, 'assets/font.woff2'), Buffer.from([1, 2, 3])); + rmSync(join(output, 'index.js')); + const prepared = await prepareCfBuildOutput(output, 'account-id'); + expect(prepared).not.toBeNull(); + if (!prepared) { + return; + } + try { + const built = await readBuildOutput(prepared.directory); + expect(built.workers.default.config.manifest).toMatchObject({ + mainModule: 'assets/index-hash.js', + modules: { 'assets/font.woff2': { type: 'data' } }, + }); + const cf = join(dirname(fileURLToPath(import.meta.resolve('cf/package.json'))), 'bin', 'cf'); + const dryRun = spawnSync( + process.execPath, + [cf, 'workers', 'versions', 'create', '--prebuilt', '--dry-run'], + { cwd: prepared.directory, encoding: 'utf8' }, + ); + expect(dryRun.status, `${dryRun.stdout}\n${dryRun.stderr}`).toBe(0); + } finally { + prepared.dispose(); + } + }, + CF_BUILD_TIMEOUT_MS, +); + +it.each(['../index.js', '/index.js', 'C:\\index.js'])( + 'rejects an out-of-bundle entry %s', + async (main) => { + const output = worker({ name: 'void-test', main }); + await expect(prepareCfBuildOutput(output, 'account-id')).rejects.toThrow( + 'inside its output directory', + ); + }, +); + +it('names the file when a plugin emits an unsupported module', async () => { + const output = worker({ name: 'void-test', main: 'index.js' }); + writeFileSync(join(output, 'plugin.unknown'), 'unexpected'); + await expect(prepareCfBuildOutput(output, 'account-id')).rejects.toThrow( + 'unsupported module "plugin.unknown"', + ); +}); + +it('reports a missing built entry', async () => { + const output = worker({ name: 'void-test', main: 'assets/missing.js' }); + await expect(prepareCfBuildOutput(output, 'account-id')).rejects.toThrow( + '"assets/missing.js" is missing', + ); +}); + it('preserves worker settings that the previous bridge dropped', async () => { const output = worker({ name: 'void-test', diff --git a/packages/void/test/unit/cf-compat.test.ts b/packages/void/test/unit/cf-compat.test.ts index 353124d11..cf2f3c15d 100644 --- a/packages/void/test/unit/cf-compat.test.ts +++ b/packages/void/test/unit/cf-compat.test.ts @@ -9,131 +9,214 @@ import { pathToFileURL } from 'node:url'; import { expect, it } from 'vite-plus/test'; import { resolveWranglerArgv } from '../../src/cli/preset.ts'; -it('clears Worker Cron Triggers through the pinned account API', async () => { - const directory = mkdtempSync(join(tmpdir(), 'void-cf-clear-crons-')); - let requested = false; - const server = createServer(async (request, response) => { - requested = true; - expect(request.method).toBe('PUT'); - expect(request.url).toBe( - '/client/v4/accounts/test-account/workers/scripts/test-worker/schedules', - ); - expect(request.headers.authorization).toBe('Bearer synthetic-token'); - let body = ''; - for await (const chunk of request) { - body += chunk; - } - expect(body).toBe('[]'); - response.setHeader('Content-Type', 'application/json'); - response.end(JSON.stringify({ success: true, result: { schedules: [] } })); - }); - await new Promise((resolve) => server.listen(0, '127.0.0.1', resolve)); - try { - const configPath = join(directory, 'wrangler.json'); - writeFileSync(configPath, JSON.stringify({ name: 'test-worker', account_id: 'test-account' })); - const [command, ...prefix] = resolveWranglerArgv(directory); - const output = await new Promise<{ status: number; stderr: string }>((resolve) => { - execFile( - command!, - [...prefix, 'triggers', 'clear-crons', '-c', configPath, '--name', 'test-worker'], - { - cwd: directory, - encoding: 'utf8', - timeout: 20_000, - env: { - PATH: process.env.PATH, - SYSTEMROOT: process.env.SYSTEMROOT, - WINDIR: process.env.WINDIR, - CI: 'true', - CLOUDFLARE_API_TOKEN: 'synthetic-token', - CLOUDFLARE_ACCOUNT_ID: 'test-account', - CLOUDFLARE_API_BASE_URL: `http://127.0.0.1:${(server.address() as AddressInfo).port}/client/v4`, +it.each([200, 503])( + 'reports HTTP %i when domain cleanup returns a non-JSON response', + async (status) => { + const directory = mkdtempSync(join(tmpdir(), 'void-cf-domain-error-')); + const server = createServer((request, response) => { + request.resume(); + response.statusCode = status; + response.end('temporary upstream response'); + }); + await new Promise((resolve) => server.listen(0, '127.0.0.1', resolve)); + try { + const configPath = join(directory, 'wrangler.json'); + writeFileSync( + configPath, + JSON.stringify({ name: 'test-worker', account_id: 'test-account' }), + ); + const [command, ...prefix] = resolveWranglerArgv(directory); + const output = await new Promise<{ status: number; stderr: string }>((resolve) => { + execFile( + command!, + [...prefix, 'triggers', 'clear-domains', '-c', configPath, '--name', 'test-worker'], + { + cwd: directory, + encoding: 'utf8', + timeout: 20_000, + env: { + PATH: process.env.PATH, + SYSTEMROOT: process.env.SYSTEMROOT, + WINDIR: process.env.WINDIR, + CI: 'true', + CLOUDFLARE_API_TOKEN: 'synthetic-token', + CLOUDFLARE_ACCOUNT_ID: 'test-account', + CLOUDFLARE_API_BASE_URL: `http://127.0.0.1:${(server.address() as AddressInfo).port}/client/v4`, + }, }, - }, - (error, _stdout, stderr) => resolve({ status: error ? 1 : 0, stderr }), + (error, _stdout, stderr) => resolve({ status: error ? 1 : 0, stderr }), + ); + }); + expect(output.status).toBe(1); + expect(output.stderr).toContain(`HTTP ${status}`); + expect(output.stderr).not.toContain('synthetic-token'); + } finally { + await new Promise((resolve) => { + server.close(() => resolve()); + server.closeAllConnections(); + }); + rmSync(directory, { recursive: true, force: true }); + } + }, + 30_000, +); + +it.each(['clear-crons', 'clear-domains'])( + 'clears %s through the pinned account API', + async (operation) => { + const directory = mkdtempSync(join(tmpdir(), 'void-cf-clear-crons-')); + let requested = false; + const server = createServer(async (request, response) => { + requested = true; + expect(request.method).toBe('PUT'); + expect(request.url).toBe( + `/client/v4/accounts/test-account/workers/scripts/test-worker/${operation === 'clear-crons' ? 'schedules' : 'domains/records'}`, ); + expect(request.headers.authorization).toBe('Bearer synthetic-token'); + let body = ''; + for await (const chunk of request) { + body += chunk; + } + expect(JSON.parse(body)).toEqual( + operation === 'clear-crons' + ? [] + : { + override_scope: true, + override_existing_origin: false, + override_existing_dns_record: false, + origins: [], + }, + ); + response.setHeader('Content-Type', 'application/json'); + response.end(JSON.stringify({ success: true, result: { schedules: [] } })); }); - expect(output.status, output.stderr).toBe(0); - expect(requested).toBe(true); - } finally { - await new Promise((resolve) => { - server.close(() => resolve()); - server.closeAllConnections(); - }); - rmSync(directory, { recursive: true, force: true }); - } -}, 30_000); + await new Promise((resolve) => server.listen(0, '127.0.0.1', resolve)); + try { + const configPath = join(directory, 'wrangler.json'); + writeFileSync( + configPath, + JSON.stringify({ name: 'test-worker', account_id: 'test-account' }), + ); + const [command, ...prefix] = resolveWranglerArgv(directory); + const output = await new Promise<{ status: number; stderr: string }>((resolve) => { + execFile( + command!, + [...prefix, 'triggers', operation, '-c', configPath, '--name', 'test-worker'], + { + cwd: directory, + encoding: 'utf8', + timeout: 20_000, + env: { + PATH: process.env.PATH, + SYSTEMROOT: process.env.SYSTEMROOT, + WINDIR: process.env.WINDIR, + CI: 'true', + CLOUDFLARE_API_TOKEN: 'synthetic-token', + CLOUDFLARE_ACCOUNT_ID: 'test-account', + CLOUDFLARE_API_BASE_URL: `http://127.0.0.1:${(server.address() as AddressInfo).port}/client/v4`, + }, + }, + (error, _stdout, stderr) => resolve({ status: error ? 1 : 0, stderr }), + ); + }); + expect(output.status, output.stderr).toBe(0); + expect(requested).toBe(true); + } finally { + await new Promise((resolve) => { + server.close(() => resolve()); + server.closeAllConnections(); + }); + rmSync(directory, { recursive: true, force: true }); + } + }, + 30_000, +); -it('uses the browser login profile for Cron Trigger cleanup during a keyring-pinned deploy', async () => { - const directory = mkdtempSync(join(tmpdir(), 'void-cf-clear-crons-oauth-')); - const server = createServer((request, response) => { - expect(request.headers.authorization).toBe('Bearer synthetic-oauth-token'); - request.resume(); - response.setHeader('Content-Type', 'application/json'); - response.end(JSON.stringify({ success: true, result: { schedules: [] } })); - }); - await new Promise((resolve) => server.listen(0, '127.0.0.1', resolve)); - try { - const configPath = join(directory, 'wrangler.json'); - const credentialPath = join(directory, 'credential.json'); - const preload = join(directory, 'mock-cf.mjs'); - writeFileSync(configPath, JSON.stringify({ name: 'test-worker', account_id: 'test-account' })); - writeFileSync(credentialPath, JSON.stringify({ oauth_token: 'synthetic-oauth-token' })); - writeFileSync( - preload, - `import child from 'node:child_process'; +it.each(['clear-crons', 'clear-domains'])( + 'uses encrypted browser credentials for %s', + async (operation) => { + const directory = mkdtempSync(join(tmpdir(), 'void-cf-clear-crons-oauth-')); + const server = createServer((request, response) => { + expect(request.headers.authorization).toBe('Bearer synthetic-oauth-token'); + request.resume(); + response.setHeader('Content-Type', 'application/json'); + response.end(JSON.stringify({ success: true, result: { schedules: [] } })); + }); + await new Promise((resolve) => server.listen(0, '127.0.0.1', resolve)); + try { + const configPath = join(directory, 'wrangler.json'); + const preload = join(directory, 'mock-cf.mjs'); + writeFileSync( + configPath, + JSON.stringify({ name: 'test-worker', account_id: 'test-account' }), + ); + writeFileSync( + preload, + `import child from 'node:child_process'; import { syncBuiltinESMExports } from 'node:module'; +import { setKeyProviderFactoryForTesting } from ${JSON.stringify(import.meta.resolve('@cloudflare/workers-auth'))}; +import { createCfAuth } from ${JSON.stringify(import.meta.resolve('@cloudflare/workers-auth/cf'))}; +let key; +setKeyProviderFactoryForTesting(() => ({ getKey: () => key, setKey: (value) => { key = value; }, deleteKey: () => { key = undefined; }, describe: () => 'synthetic provider' })); +const logger = { debug() {}, info() {}, log() {}, warn() {}, error() {} }; +const auth = createCfAuth({ logger, userAgent: 'void-test', prompt: async () => '', select: async () => '', isNoDefaultValueProvidedError: () => false }); +auth.writeAuthCredentials({ oauth_token: 'synthetic-oauth-token', refresh_token: 'synthetic-refresh', expiration_time: new Date(Date.now() + 3600000).toISOString(), scopes: [] }); +const credentialPath = auth.getCredentialStore().path(); child.spawnSync = (_binary, args, options) => { - if (args[1] !== 'auth' || args[2] !== 'whoami' || options.env.CLOUDFLARE_AUTH_USE_KEYRING) { + if (args[1] !== 'auth' || args[2] !== 'whoami' || options.env.CLOUDFLARE_AUTH_USE_KEYRING !== 'true') { return { status: 1, stdout: '', stderr: 'Wrong authentication source.' }; } - return { status: 0, stdout: JSON.stringify({ authenticated: true, tokenValid: true, authSource: 'OAuth token from ' + process.env.VOID_TEST_CREDENTIAL }), stderr: '' }; + return { status: 0, stdout: JSON.stringify({ authenticated: true, tokenValid: true, authSource: 'OAuth token from ' + credentialPath }), stderr: '' }; }; syncBuiltinESMExports(); `, - ); - const entry = join(import.meta.dirname, '..', '..', 'src', 'cli', 'cf-compat.ts'); - const output = await new Promise<{ status: number; stderr: string }>((resolve) => { - execFile( - process.execPath, - [ - '--import', - pathToFileURL(preload).href, - entry, - 'triggers', - 'clear-crons', - '-c', - configPath, - '--name', - 'test-worker', - ], - { - cwd: directory, - encoding: 'utf8', - timeout: 20_000, - env: { - PATH: process.env.PATH, - SYSTEMROOT: process.env.SYSTEMROOT, - WINDIR: process.env.WINDIR, - CI: 'true', - CLOUDFLARE_AUTH_USE_KEYRING: 'true', - CLOUDFLARE_ACCOUNT_ID: 'test-account', - CLOUDFLARE_API_BASE_URL: `http://127.0.0.1:${(server.address() as AddressInfo).port}/client/v4`, - VOID_TEST_CREDENTIAL: credentialPath, - }, - }, - (error, _stdout, stderr) => resolve({ status: error ? 1 : 0, stderr }), ); - }); - expect(output.status, output.stderr).toBe(0); - } finally { - await new Promise((resolve) => { - server.close(() => resolve()); - server.closeAllConnections(); - }); - rmSync(directory, { recursive: true, force: true }); - } -}, 30_000); + const entry = join(import.meta.dirname, '..', '..', 'src', 'cli', 'cf-compat.ts'); + const output = await new Promise<{ status: number; stderr: string }>((resolve) => { + execFile( + process.execPath, + [ + '--import', + pathToFileURL(preload).href, + entry, + 'triggers', + operation, + '-c', + configPath, + '--name', + 'test-worker', + ], + { + cwd: directory, + encoding: 'utf8', + timeout: 20_000, + env: { + PATH: process.env.PATH, + SYSTEMROOT: process.env.SYSTEMROOT, + WINDIR: process.env.WINDIR, + CI: 'true', + CLOUDFLARE_AUTH_USE_KEYRING: 'true', + CLOUDFLARE_ACCOUNT_ID: 'test-account', + CLOUDFLARE_API_BASE_URL: `http://127.0.0.1:${(server.address() as AddressInfo).port}/client/v4`, + HOME: directory, + USERPROFILE: directory, + XDG_CONFIG_HOME: directory, + }, + }, + (error, _stdout, stderr) => resolve({ status: error ? 1 : 0, stderr }), + ); + }); + expect(output.status, output.stderr).toBe(0); + } finally { + await new Promise((resolve) => { + server.close(() => resolve()); + server.closeAllConnections(); + }); + rmSync(directory, { recursive: true, force: true }); + } + }, + 30_000, +); it('reports an absent cf session as authentication failure', async () => { const directory = mkdtempSync(join(tmpdir(), 'void-cf-no-auth-')); diff --git a/packages/void/test/unit/cf-session.test.ts b/packages/void/test/unit/cf-session.test.ts new file mode 100644 index 000000000..e64e9baa9 --- /dev/null +++ b/packages/void/test/unit/cf-session.test.ts @@ -0,0 +1,124 @@ +import { mkdtempSync, readFileSync, rmSync } from 'node:fs'; +import { tmpdir } from 'node:os'; +import { join } from 'node:path'; +import { + clearCredentialStorageState, + setKeyProviderFactoryForTesting, +} from '@cloudflare/workers-auth'; +import { + createCfAuth, + createCfProfileStore, + readUserPreferences, + writeAuthConfigFile, +} from '@cloudflare/workers-auth/cf'; +import { afterEach, beforeEach, expect, it, vi } from 'vite-plus/test'; +import { persistCfKeyringPreference, readCfSessionCredential } from '../../src/cli/cf-session.ts'; + +let root: string; +const logger = { debug() {}, info() {}, log() {}, warn() {}, error() {} }; +const authContext = { + logger, + userAgent: 'void-test', + prompt: async () => { + throw new Error('Unexpected prompt'); + }, + select: async () => { + throw new Error('Unexpected prompt'); + }, + isNoDefaultValueProvidedError: () => false, +}; + +beforeEach(() => { + root = mkdtempSync(join(tmpdir(), 'void-cf-session-')); + for (const key of ['HOME', 'USERPROFILE', 'XDG_CONFIG_HOME']) { + vi.stubEnv(key, root); + } + vi.stubEnv('CLOUDFLARE_AUTH_USE_KEYRING', 'true'); + vi.stubEnv('CLOUDFLARE_API_TOKEN', ''); + vi.stubEnv('CF_API_TOKEN', ''); + clearCredentialStorageState(); + const keys = new Map(); + setKeyProviderFactoryForTesting((service, profile) => { + const name = `${service}:${profile}`; + return { + getKey: () => keys.get(name), + setKey: (key) => { + keys.set(name, key); + }, + deleteKey: () => { + keys.delete(name); + }, + describe: () => 'synthetic key provider', + }; + }); +}); +afterEach(() => { + setKeyProviderFactoryForTesting(undefined); + clearCredentialStorageState(); + vi.unstubAllEnvs(); + rmSync(root, { recursive: true, force: true }); +}); + +function stored(profile = 'default') { + const auth = createCfAuth(authContext); + auth.setProfile(profile); + auth.writeAuthCredentials({ + oauth_token: `synthetic-${profile}`, + refresh_token: 'synthetic-refresh', + expiration_time: new Date(Date.now() + 3600_000).toISOString(), + scopes: [], + }); + const path = auth.getCredentialStore().path(); + expect(path).toMatch(/\.enc$/); + expect(readFileSync(path, 'utf8')).not.toContain(`synthetic-${profile}`); + return { authenticated: true, tokenValid: true, authSource: `OAuth token from ${path}` }; +} + +it('borrows a verified encrypted session and persists the store preference', () => { + expect(readCfSessionCredential(root, stored())).toBe('synthetic-default'); + expect(readUserPreferences().keyring_enabled).toBe(true); +}); + +it('uses the named profile bound to the project, never another profile', () => { + const other = stored(); + const team = stored('team'); + createCfProfileStore({ logger }).bindings.activate('team', root); + expect(readCfSessionCredential(root, other)).toBeNull(); + expect(readCfSessionCredential(root, team)).toBe('synthetic-team'); +}); + +it('does not borrow an invalid session or a different credential source', () => { + const identity = stored(); + expect(readCfSessionCredential(root, { ...identity, tokenValid: false })).toBeNull(); + expect(readCfSessionCredential(root, { ...identity, authenticated: false })).toBeNull(); + expect( + readCfSessionCredential(root, { ...identity, authSource: 'OAuth token from /untrusted/path' }), + ).toBeNull(); +}); + +it('adopts a legacy plaintext profile through Cloudflare encrypted storage', () => { + writeAuthConfigFile({ + oauth_token: 'synthetic-legacy', + refresh_token: 'synthetic-refresh', + expiration_time: new Date(Date.now() + 3600_000).toISOString(), + scopes: [], + }); + const auth = createCfAuth(authContext); + const path = auth.getCredentialStore().path(); + expect( + readCfSessionCredential(root, { + authenticated: true, + tokenValid: true, + authSource: `OAuth token from ${path}`, + }), + ).toBe('synthetic-legacy'); + expect(readFileSync(path, 'utf8')).not.toContain('synthetic-legacy'); + expect(readUserPreferences().keyring_enabled).toBe(true); +}); + +it('retains the encrypted preference for later compatible CLI logins', () => { + stored(); + persistCfKeyringPreference(root); + vi.stubEnv('CLOUDFLARE_AUTH_USE_KEYRING', undefined); + expect(createCfAuth(authContext).getCredentialStore().kind).toBe('encrypted-file'); +}); diff --git a/packages/void/test/unit/cloudflare-candidate.test.ts b/packages/void/test/unit/cloudflare-candidate.test.ts index b420bc5e6..2e3555ddd 100644 --- a/packages/void/test/unit/cloudflare-candidate.test.ts +++ b/packages/void/test/unit/cloudflare-candidate.test.ts @@ -52,4 +52,39 @@ describe('ordinary Cloudflare candidate receipt', () => { rmSync(root, { recursive: true, force: true }); } }); + + it('starts a new chain only when the verified parent is the last saved candidate', () => { + const root = mkdtempSync(join(tmpdir(), 'void-candidate-activated-')); + try { + recordCloudflareCandidateUpload(root, null, 'account', 'worker', 'live', 'draft'); + recordCloudflareCandidateUpload( + root, + readCloudflareCandidate(root), + 'account', + 'worker', + 'live', + 'draft-2', + ); + const receipt = readCloudflareCandidate(root); + expect(() => + recordCloudflareCandidateUpload(root, receipt, 'account', 'worker', 'draft', 'next'), + ).toThrow('different Worker'); + expect(() => + recordCloudflareCandidateUpload(root, receipt, 'other', 'worker', 'draft-2', 'next'), + ).toThrow('different Worker'); + expect(() => + recordCloudflareCandidateUpload(root, receipt, 'account', 'other', 'draft-2', 'next'), + ).toThrow('different Worker'); + expect(readCloudflareCandidate(root)).toEqual(receipt); + recordCloudflareCandidateUpload(root, receipt, 'account', 'worker', 'draft-2', 'next'); + expect(readCloudflareCandidate(root)).toEqual({ + accountId: 'account', + workerName: 'worker', + parentVersionId: 'draft-2', + versionIds: ['next'], + }); + } finally { + rmSync(root, { recursive: true, force: true }); + } + }); }); diff --git a/packages/void/test/unit/cloudflare-operations.test.ts b/packages/void/test/unit/cloudflare-operations.test.ts index 48fa928e9..bf00fdb37 100644 --- a/packages/void/test/unit/cloudflare-operations.test.ts +++ b/packages/void/test/unit/cloudflare-operations.test.ts @@ -721,50 +721,50 @@ describe('Cloudflare custom domains', () => { const root = project( '{"name":"my-worker","account_id":"account-1","routes":[{"pattern":"app.example.com","custom_domain":true}]}', ); - vi.stubEnv('CLOUDFLARE_API_TOKEN', 'test-token'); - const fetchMock = vi.fn(async () => - Response.json({ success: true, errors: [], messages: [], result: null }), - ); - vi.stubGlobal('fetch', fetchMock); - - await changeCloudflareDomain(root, 'app.example.com', 'delete', vi.fn()); - - expect(fetchMock).toHaveBeenCalledTimes(1); - const [url, init] = fetchMock.mock.calls[0]!; - expect(url).toBe( - 'https://api.cloudflare.com/client/v4/accounts/account-1/workers/scripts/my-worker/domains/records', + vi.stubEnv('CLOUDFLARE_API_TOKEN', ''); + vi.stubEnv('CF_API_TOKEN', ''); + const runner = vi + .fn() + .mockResolvedValue({ status: 0, stdout: '', stderr: '' }); + await changeCloudflareDomain(root, 'app.example.com', 'delete', runner); + expect(runner).toHaveBeenCalledWith( + [ + 'triggers', + 'clear-domains', + '-c', + join(root, 'wrangler.jsonc'), + '--env=', + '--name', + 'my-worker', + ], + { capture: true }, ); - expect(init).toMatchObject({ - method: 'PUT', - headers: { - Authorization: 'Bearer test-token', - 'Content-Type': 'application/json', - }, - body: JSON.stringify({ - override_scope: true, - override_existing_origin: false, - override_existing_dns_record: false, - origins: [], - }), - redirect: 'error', - }); }); - it('fails closed before deleting the final domain without an API token', async () => { + it('restores the final domain when the authenticated clear operation is rejected', async () => { const root = project( '{"name":"my-worker","account_id":"account-1","routes":[{"pattern":"app.example.com","custom_domain":true}]}', ); const before = readFileSync(join(root, 'wrangler.jsonc'), 'utf-8'); - const runner = vi.fn(); + const runner = vi + .fn() + .mockResolvedValueOnce({ + status: 1, + stdout: '', + stderr: 'Cloudflare authentication is required.', + }) + .mockResolvedValue({ status: 0, stdout: '', stderr: '' }); vi.stubEnv('CLOUDFLARE_API_TOKEN', ''); vi.stubEnv('CF_API_TOKEN', ''); await expect(changeCloudflareDomain(root, 'app.example.com', 'delete', runner)).rejects.toThrow( - 'No local or remote state changed', + 'both the local config and remote triggers were restored', ); expect(readFileSync(join(root, 'wrangler.jsonc'), 'utf-8')).toBe(before); - expect(runner).not.toHaveBeenCalled(); + expect(runner).toHaveBeenCalledTimes(2); + expect(runner.mock.calls[0]?.[0].slice(0, 2)).toEqual(['triggers', 'clear-domains']); + expect(runner.mock.calls[1]?.[0].slice(0, 2)).toEqual(['triggers', 'deploy']); }); it('lists configured domains without an account mutation', () => { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index bd06b2077..9a031ec6b 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -646,6 +646,9 @@ importers: vite: specifier: npm:@voidzero-dev/vite-plus-core@0.3.1 version: '@voidzero-dev/vite-plus-core@0.3.1(@types/node@26.5.1)(esbuild@0.27.7)(jiti@2.7.0)(sass@1.99.0)(terser@5.51.2)(tsx@4.23.0)(typescript@7.0.2)(yaml@2.9.0)' + "@cloudflare/workers-auth": + specifier: 0.9.4 + version: 0.9.4(vitest@4.1.11) devDependencies: '@clack/core': specifier: 1.5.0 @@ -11186,6 +11189,29 @@ packages: zwitch@2.0.4: resolution: {integrity: sha512-bXE4cR/kVZhKZX/RjPEflHaKVhUVl85noU3v6b8apfQEc1x4A+zBxjZ4lN8LqGd6WZ3dl98pY4o717VFmoPp+A==} + "@cloudflare/workers-auth@0.9.4": + resolution: {integrity: sha512-Rmia49NzDLU+tHEwzv2yKkoDb4k4Gk1kAEyUe8nJ+BfhcfUwJ2otSaN/4PbP4QRjUBH9g/ERzniIgktb6K/QuQ==} + peerDependencies: + msw: 2.14.6 + vitest: ^4.1.0 + peerDependenciesMeta: + msw: + optional: true + vitest: + optional: true + "@cloudflare/workers-utils@0.44.0": + resolution: {integrity: sha512-3IpuKdIXpkICftrg75IO5rKLTweOfY82gH1cTqnP1Zj5lS40VOW7OJ3j9ZlI+TnP1IzeCsN8nk6R7FMypXQTtg==} + peerDependencies: + vitest: ^4.1.0 + peerDependenciesMeta: + vitest: + optional: true + dotenv@16.3.1: + resolution: {integrity: sha512-IPzF4w4/Rd94bA9imS68tZBaYyBWSCE47V1RGuMrB94iyTOIEwRmVL2x/4An+6mETpLrKJ5hQkB8W4kFAadeIQ==} + engines: {node: '>=12'} + chalk@5.3.0: + resolution: {integrity: sha512-dLitG79d+GV1Nb/VYcCDFivJeK1hiukt9QjRNVOsUtTy1rR1YJsmpGGTZ3qJos+uw7WmWF4wUwBd9jxjocFC2w==} + engines: {node: ^12.17.0 || ^14.13 || >=16.0.0} snapshots: @@ -22853,3 +22879,18 @@ snapshots: zod@4.6.5: {} zwitch@2.0.4: {} + "@cloudflare/workers-auth@0.9.4(vitest@4.1.11)": + dependencies: + '@cloudflare/workers-utils': 0.44.0(vitest@4.1.11) + undici: 7.29.0 + optionalDependencies: + vitest: 4.1.11(@types/node@26.5.1)(@vitest/browser-preview@4.1.11)(@voidzero-dev/vite-plus-core@0.3.1(@types/node@26.5.1)(esbuild@0.27.7)(jiti@2.7.0)(sass@1.99.0)(terser@5.51.2)(tsx@4.23.0)(typescript@7.0.2)(yaml@2.9.0)) + "@cloudflare/workers-utils@0.44.0(vitest@4.1.11)": + dependencies: + chalk: 5.3.0 + dotenv: 16.3.1 + undici: 7.29.0 + optionalDependencies: + vitest: 4.1.11(@types/node@26.5.1)(@vitest/browser-preview@4.1.11)(@voidzero-dev/vite-plus-core@0.3.1(@types/node@26.5.1)(esbuild@0.27.7)(jiti@2.7.0)(sass@1.99.0)(terser@5.51.2)(tsx@4.23.0)(typescript@7.0.2)(yaml@2.9.0)) + dotenv@16.3.1: {} + chalk@5.3.0: {}