diff --git a/docs/development/DEEP_AUDIT_OVERLAP_2026-02-28.md b/docs/development/DEEP_AUDIT_OVERLAP_2026-02-28.md new file mode 100644 index 00000000..ff010281 --- /dev/null +++ b/docs/development/DEEP_AUDIT_OVERLAP_2026-02-28.md @@ -0,0 +1,42 @@ +# Deep Audit Overlap Ledger (2026-02-28) + +## Purpose +Track overlap against currently open audit PRs so this branch remains incremental and avoids duplicate fixes where possible. + +## Open Audit PRs Reviewed +- #44 `audit/architect-deep-audit-2026-02-28` -> `main` +- #45 `audit/phase-1-deps-security-20260228` -> `main` +- #46 `audit/phase-2-oauth-hardening-20260228` -> `audit/phase-1-deps-security-20260228` +- #47 `audit/phase-3-rate-limit-units-20260228` -> `audit/phase-2-oauth-hardening-20260228` +- #48 `audit/full-code-quality-main-20260228` -> `main` + +## Overlap Assessment + +### Dependency hardening overlap +- Potential overlap area: #45 and #48 both touch dependency remediation. +- This branch kept dependency work scoped to currently reproducible high vulnerabilities from `npm audit` on `main`. +- Effective changes here: + - `hono` floor raised to `^4.12.3` + - `rollup` floor raised to `^4.59.0` + - `minimatch` floors raised to `^10.2.4` and `^9.0.9` for `@typescript-eslint/typescript-estree` +- Result: high vulnerabilities cleared in this branch; follow-up dev-tooling update also cleared the remaining moderate `ajv` advisory. + +### Auth/server overlap +- PR #44/#46 touch auth-related files including `index.ts` and `lib/auth/server.ts`. +- This branch intentionally targets distinct controls not represented in those PR descriptions: + - Manual OAuth callback URL trust boundary validation (protocol/host/port/path enforcement). + - Removal of sensitive OAuth URL query logging (state/challenge leak reduction). + - Local callback server hardening: method allowlist (`GET` only), no-store headers, one-time code consumption semantics. + +### Rate-limit overlap +- PR #47 focuses retry-after unit parsing in `lib/request/fetch-helpers.ts`. +- This branch does not modify retry-after parsing logic and therefore does not duplicate that unit-conversion patchline. + +## Exclusions in This Branch +- No medium/low-only cleanup work. +- No refactor-only churn. +- No duplication of chained phase-branch mechanics used by PR #45 -> #46 -> #47. + +## Verification Snapshot +- Baseline before fixes: `npm audit --audit-level=high` reported 3 high + 1 moderate. +- Final state after dependency and tooling updates: `npm audit` reports 0 vulnerabilities. diff --git a/docs/development/DEEP_AUDIT_REPORT_2026-02-28.md b/docs/development/DEEP_AUDIT_REPORT_2026-02-28.md new file mode 100644 index 00000000..3b1c1557 --- /dev/null +++ b/docs/development/DEEP_AUDIT_REPORT_2026-02-28.md @@ -0,0 +1,86 @@ +# Deep Comprehensive Audit Report (2026-02-28) + +## Scope +Full repository deep audit focused on high-impact risk classes: +- Dependency and supply-chain vulnerabilities. +- OAuth callback security boundaries. +- Local OAuth callback server hardening and reliability behavior. + +## Branch and Baseline +- Branch: `audit/deep-comprehensive-20260228-111117` +- Base: `origin/main` (`ab970af` at branch creation) + +## Findings and Actions + +### Phase 1: Dependency vulnerability remediation +**Risk class:** High severity supply-chain vulnerabilities reported by `npm audit`. + +**Baseline findings:** +- High: `hono` (GHSA-xh87-mx6m-69f3) +- High: `minimatch` (GHSA-3ppc-4f35-3m26, GHSA-7r86-cg39-jmmj, GHSA-23c5-xmqv-rm74) +- High: `rollup` (GHSA-mw96-cpmx-2vgc) +- Moderate: `ajv` (GHSA-2g4f-4pwh-qvx6) + +**Remediation:** +- Updated override and dependency floors: + - `hono`: `^4.12.3` + - `rollup`: `^4.59.0` + - `minimatch`: `^10.2.4` + - `@typescript-eslint/typescript-estree` nested `minimatch`: `^9.0.9` + +**Outcome:** +- Initial pass cleared all high/critical findings. +- Follow-up tooling update (`npm update eslint`) removed the remaining moderate `ajv` advisory. +- Final audit status: `npm audit` reports 0 vulnerabilities. + +### Phase 2: Manual OAuth callback trust hardening +**Risk class:** Callback URL trust boundary and OAuth state handling hardening. + +**Remediation:** +- Added manual callback URL validation in `index.ts` for manual paste flow: + - Protocol must be `http`. + - Host must be `localhost` or `127.0.0.1`. + - Port must be `1455`. + - Path must be `/auth/callback`. +- Validation is applied in both `validate` and `callback` paths. +- Removed sensitive full OAuth URL logging with query parameters; replaced with non-sensitive auth endpoint logging. + +**Tests added/updated:** +- `test/index.test.ts`: + - Reject non-localhost host in manual callback URL. + - Reject unexpected protocol in manual callback URL. + +### Phase 3: Local OAuth server behavior hardening +**Risk class:** Local callback endpoint attack surface and callback handling reliability. + +**Remediation:** +- `lib/auth/server.ts`: + - Enforced `GET`-only callback handling (returns `405` + `Allow: GET` for others). + - Added no-cache controls (`Cache-Control: no-store`, `Pragma: no-cache`). + - Implemented one-time captured-code consumption semantics in `waitForCode`. + +**Tests added/updated:** +- `test/server.unit.test.ts`: + - Reject non-GET methods. + - Assert cache-control headers on success. + - Assert captured authorization code is consumed once. + +## Deferred/Residual Items +- No remaining vulnerabilities from `npm audit` at time of verification. +- Medium/low style and refactor-only opportunities remain out of scope for this security-focused pass. + +## Verification Evidence +Commands executed after remediation: +- `npm run lint` -> pass +- `npm run typecheck` -> pass +- `npm test` -> pass +- `npx vitest run test/server.unit.test.ts test/index.test.ts` -> pass +- `npm run audit:all` -> pass +- `npm audit` -> pass (0 vulnerabilities) + +## Atomic Commit Map +1. `fix(audit phase 1): remediate high dependency vulnerabilities` +2. `fix(audit phase 2): harden manual OAuth callback validation` +3. `fix(audit phase 3): tighten local OAuth callback server behavior` +4. `docs(audit): publish overlap ledger and deep audit report` +5. `chore(audit): refresh eslint toolchain to clear residual moderate advisory` diff --git a/index.ts b/index.ts index 4f7a4a59..ebaf2695 100644 --- a/index.ts +++ b/index.ts @@ -30,6 +30,7 @@ import { createAuthorizationFlow, exchangeAuthorizationCode, parseAuthorizationInput, + AUTHORIZE_URL, REDIRECT_URI, } from "./lib/auth/auth.js"; import { queuedRefresh, getRefreshQueueMetrics } from "./lib/refresh-queue.js"; @@ -377,6 +378,36 @@ export const OpenAIOAuthPlugin: Plugin = async ({ client }: PluginInput) => { }; }; + const MANUAL_OAUTH_ALLOWED_HOSTS = new Set(["127.0.0.1", "localhost"]); + + const getManualOAuthUrlValidationError = ( + input: string, + ): string | undefined => { + const raw = input.trim(); + if (!raw) return undefined; + + let parsedUrl: URL; + try { + parsedUrl = new URL(raw); + } catch { + return undefined; + } + + if (parsedUrl.protocol !== "http:") { + return `Invalid callback URL protocol. Use ${REDIRECT_URI}`; + } + if (!MANUAL_OAUTH_ALLOWED_HOSTS.has(parsedUrl.hostname.toLowerCase())) { + return `Invalid callback URL host. Use ${REDIRECT_URI}`; + } + if (parsedUrl.port !== "1455") { + return `Invalid callback URL port. Use ${REDIRECT_URI}`; + } + if (parsedUrl.pathname !== "/auth/callback") { + return `Invalid callback URL path. Use ${REDIRECT_URI}`; + } + return undefined; + }; + const buildManualOAuthFlow = ( pkce: { verifier: string }, url: string, @@ -387,6 +418,10 @@ export const OpenAIOAuthPlugin: Plugin = async ({ client }: PluginInput) => { method: "code" as const, instructions: AUTH_LABELS.INSTRUCTIONS_MANUAL, validate: (input: string): string | undefined => { + const callbackValidationError = getManualOAuthUrlValidationError(input); + if (callbackValidationError) { + return callbackValidationError; + } const parsed = parseAuthorizationInput(input); if (!parsed.code) { return "No authorization code found. Paste the full callback URL (e.g., http://localhost:1455/auth/callback?code=...)"; @@ -400,6 +435,14 @@ export const OpenAIOAuthPlugin: Plugin = async ({ client }: PluginInput) => { return undefined; }, callback: async (input: string) => { + const callbackValidationError = getManualOAuthUrlValidationError(input); + if (callbackValidationError) { + return { + type: "failed" as const, + reason: "invalid_response" as const, + message: callbackValidationError, + }; + } const parsed = parseAuthorizationInput(input); if (!parsed.code || !parsed.state) { return { @@ -437,7 +480,7 @@ export const OpenAIOAuthPlugin: Plugin = async ({ client }: PluginInput) => { forceNewLogin: boolean = false, ): Promise => { const { pkce, state, url } = await createAuthorizationFlow({ forceNewLogin }); - logInfo(`OAuth URL: ${url}`); + logInfo(`OAuth authorization flow initialized at ${AUTHORIZE_URL}`); let serverInfo: Awaited> | null = null; try { diff --git a/lib/auth/server.ts b/lib/auth/server.ts index 1f83a105..e2cfbdc6 100644 --- a/lib/auth/server.ts +++ b/lib/auth/server.ts @@ -16,8 +16,15 @@ const successHtml = fs.readFileSync(path.join(__dirname, "..", "oauth-success.ht */ export function startLocalOAuthServer({ state }: { state: string }): Promise { let pollAborted = false; + let capturedCode: string | undefined; const server = http.createServer((req, res) => { try { + if ((req.method ?? "GET").toUpperCase() !== "GET") { + res.statusCode = 405; + res.setHeader("Allow", "GET"); + res.end("Method not allowed"); + return; + } const url = new URL(req.url || "", "http://localhost"); if (url.pathname !== "/auth/callback") { res.statusCode = 404; @@ -40,13 +47,17 @@ export function startLocalOAuthServer({ state }: { state: string }): Promise { - const POLL_INTERVAL_MS = 100; - const TIMEOUT_MS = 5 * 60 * 1000; - const maxIterations = Math.floor(TIMEOUT_MS / POLL_INTERVAL_MS); - const poll = () => new Promise((r) => setTimeout(r, POLL_INTERVAL_MS)); - for (let i = 0; i < maxIterations; i++) { - if (pollAborted) return null; - const lastCode = (server as http.Server & { _lastCode?: string })._lastCode; - if (lastCode) return { code: lastCode }; - await poll(); - } - logWarn("OAuth poll timeout after 5 minutes"); - return null; - }, + waitForCode: async () => { + const POLL_INTERVAL_MS = 100; + const TIMEOUT_MS = 5 * 60 * 1000; + const maxIterations = Math.floor(TIMEOUT_MS / POLL_INTERVAL_MS); + const poll = () => new Promise((r) => setTimeout(r, POLL_INTERVAL_MS)); + for (let i = 0; i < maxIterations; i++) { + if (pollAborted) return null; + if (capturedCode) { + const code = capturedCode; + capturedCode = undefined; + return { code }; + } + await poll(); + } + logWarn("OAuth poll timeout after 5 minutes"); + return null; + }, }); }) .on("error", (err: NodeJS.ErrnoException) => { @@ -84,14 +98,14 @@ export function startLocalOAuthServer({ state }: { state: string }): Promise { - pollAborted = true; - try { - server.close(); - } catch (err) { - logError(`Failed to close OAuth server: ${(err as Error)?.message ?? String(err)}`); - } - }, + close: () => { + pollAborted = true; + try { + server.close(); + } catch (err) { + logError(`Failed to close OAuth server: ${(err as Error)?.message ?? String(err)}`); + } + }, waitForCode: () => Promise.resolve(null), }); }); diff --git a/package-lock.json b/package-lock.json index 0b6d3dff..16cf3e75 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11,7 +11,7 @@ "dependencies": { "@openauthjs/openauth": "^0.4.3", "@opencode-ai/plugin": "^1.2.9", - "hono": "^4.12.0", + "hono": "^4.12.3", "zod": "^4.3.6" }, "bin": { @@ -572,15 +572,15 @@ } }, "node_modules/@eslint/config-array": { - "version": "0.23.1", - "resolved": "https://registry.npmjs.org/@eslint/config-array/-/config-array-0.23.1.tgz", - "integrity": "sha512-uVSdg/V4dfQmTjJzR0szNczjOH/J+FyUMMjYtr07xFRXR7EDf9i1qdxrD0VusZH9knj1/ecxzCQQxyic5NzAiA==", + "version": "0.23.2", + "resolved": "https://registry.npmjs.org/@eslint/config-array/-/config-array-0.23.2.tgz", + "integrity": "sha512-YF+fE6LV4v5MGWRGj7G404/OZzGNepVF8fxk7jqmqo3lrza7a0uUcDnROGRBG1WFC1omYUS/Wp1f42i0M+3Q3A==", "dev": true, "license": "Apache-2.0", "dependencies": { - "@eslint/object-schema": "^3.0.1", + "@eslint/object-schema": "^3.0.2", "debug": "^4.3.1", - "minimatch": "^10.1.1" + "minimatch": "^10.2.1" }, "engines": { "node": "^20.19.0 || ^22.13.0 || >=24" @@ -613,9 +613,9 @@ } }, "node_modules/@eslint/object-schema": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/@eslint/object-schema/-/object-schema-3.0.1.tgz", - "integrity": "sha512-P9cq2dpr+LU8j3qbLygLcSZrl2/ds/pUpfnHNNuk5HW7mnngHs+6WSq5C9mO3rqRX8A1poxqLTC9cu0KOyJlBg==", + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/@eslint/object-schema/-/object-schema-3.0.2.tgz", + "integrity": "sha512-HOy56KJt48Bx8KmJ+XGQNSUMT/6dZee/M54XyUyuvTvPXJmsERRvBchsUVx1UMe1WwIH49XLAczNC7V2INsuUw==", "dev": true, "license": "Apache-2.0", "engines": { @@ -845,9 +845,9 @@ "license": "MIT" }, "node_modules/@rollup/rollup-android-arm-eabi": { - "version": "4.56.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.56.0.tgz", - "integrity": "sha512-LNKIPA5k8PF1+jAFomGe3qN3bbIgJe/IlpDBwuVjrDKrJhVWywgnJvflMt/zkbVNLFtF1+94SljYQS6e99klnw==", + "version": "4.59.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.59.0.tgz", + "integrity": "sha512-upnNBkA6ZH2VKGcBj9Fyl9IGNPULcjXRlg0LLeaioQWueH30p6IXtJEbKAgvyv+mJaMxSm1l6xwDXYjpEMiLMg==", "cpu": [ "arm" ], @@ -859,9 +859,9 @@ ] }, "node_modules/@rollup/rollup-android-arm64": { - "version": "4.56.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.56.0.tgz", - "integrity": "sha512-lfbVUbelYqXlYiU/HApNMJzT1E87UPGvzveGg2h0ktUNlOCxKlWuJ9jtfvs1sKHdwU4fzY7Pl8sAl49/XaEk6Q==", + "version": "4.59.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.59.0.tgz", + "integrity": "sha512-hZ+Zxj3SySm4A/DylsDKZAeVg0mvi++0PYVceVyX7hemkw7OreKdCvW2oQ3T1FMZvCaQXqOTHb8qmBShoqk69Q==", "cpu": [ "arm64" ], @@ -873,9 +873,9 @@ ] }, "node_modules/@rollup/rollup-darwin-arm64": { - "version": "4.56.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.56.0.tgz", - "integrity": "sha512-EgxD1ocWfhoD6xSOeEEwyE7tDvwTgZc8Bss7wCWe+uc7wO8G34HHCUH+Q6cHqJubxIAnQzAsyUsClt0yFLu06w==", + "version": "4.59.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.59.0.tgz", + "integrity": "sha512-W2Psnbh1J8ZJw0xKAd8zdNgF9HRLkdWwwdWqubSVk0pUuQkoHnv7rx4GiF9rT4t5DIZGAsConRE3AxCdJ4m8rg==", "cpu": [ "arm64" ], @@ -887,9 +887,9 @@ ] }, "node_modules/@rollup/rollup-darwin-x64": { - "version": "4.56.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.56.0.tgz", - "integrity": "sha512-1vXe1vcMOssb/hOF8iv52A7feWW2xnu+c8BV4t1F//m9QVLTfNVpEdja5ia762j/UEJe2Z1jAmEqZAK42tVW3g==", + "version": "4.59.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.59.0.tgz", + "integrity": "sha512-ZW2KkwlS4lwTv7ZVsYDiARfFCnSGhzYPdiOU4IM2fDbL+QGlyAbjgSFuqNRbSthybLbIJ915UtZBtmuLrQAT/w==", "cpu": [ "x64" ], @@ -901,9 +901,9 @@ ] }, "node_modules/@rollup/rollup-freebsd-arm64": { - "version": "4.56.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.56.0.tgz", - "integrity": "sha512-bof7fbIlvqsyv/DtaXSck4VYQ9lPtoWNFCB/JY4snlFuJREXfZnm+Ej6yaCHfQvofJDXLDMTVxWscVSuQvVWUQ==", + "version": "4.59.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.59.0.tgz", + "integrity": "sha512-EsKaJ5ytAu9jI3lonzn3BgG8iRBjV4LxZexygcQbpiU0wU0ATxhNVEpXKfUa0pS05gTcSDMKpn3Sx+QB9RlTTA==", "cpu": [ "arm64" ], @@ -915,9 +915,9 @@ ] }, "node_modules/@rollup/rollup-freebsd-x64": { - "version": "4.56.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.56.0.tgz", - "integrity": "sha512-KNa6lYHloW+7lTEkYGa37fpvPq+NKG/EHKM8+G/g9WDU7ls4sMqbVRV78J6LdNuVaeeK5WB9/9VAFbKxcbXKYg==", + "version": "4.59.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.59.0.tgz", + "integrity": "sha512-d3DuZi2KzTMjImrxoHIAODUZYoUUMsuUiY4SRRcJy6NJoZ6iIqWnJu9IScV9jXysyGMVuW+KNzZvBLOcpdl3Vg==", "cpu": [ "x64" ], @@ -929,9 +929,9 @@ ] }, "node_modules/@rollup/rollup-linux-arm-gnueabihf": { - "version": "4.56.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.56.0.tgz", - "integrity": "sha512-E8jKK87uOvLrrLN28jnAAAChNq5LeCd2mGgZF+fGF5D507WlG/Noct3lP/QzQ6MrqJ5BCKNwI9ipADB6jyiq2A==", + "version": "4.59.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.59.0.tgz", + "integrity": "sha512-t4ONHboXi/3E0rT6OZl1pKbl2Vgxf9vJfWgmUoCEVQVxhW6Cw/c8I6hbbu7DAvgp82RKiH7TpLwxnJeKv2pbsw==", "cpu": [ "arm" ], @@ -943,9 +943,9 @@ ] }, "node_modules/@rollup/rollup-linux-arm-musleabihf": { - "version": "4.56.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.56.0.tgz", - "integrity": "sha512-jQosa5FMYF5Z6prEpTCCmzCXz6eKr/tCBssSmQGEeozA9tkRUty/5Vx06ibaOP9RCrW1Pvb8yp3gvZhHwTDsJw==", + "version": "4.59.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.59.0.tgz", + "integrity": "sha512-CikFT7aYPA2ufMD086cVORBYGHffBo4K8MQ4uPS/ZnY54GKj36i196u8U+aDVT2LX4eSMbyHtyOh7D7Zvk2VvA==", "cpu": [ "arm" ], @@ -957,9 +957,9 @@ ] }, "node_modules/@rollup/rollup-linux-arm64-gnu": { - "version": "4.56.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.56.0.tgz", - "integrity": "sha512-uQVoKkrC1KGEV6udrdVahASIsaF8h7iLG0U0W+Xn14ucFwi6uS539PsAr24IEF9/FoDtzMeeJXJIBo5RkbNWvQ==", + "version": "4.59.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.59.0.tgz", + "integrity": "sha512-jYgUGk5aLd1nUb1CtQ8E+t5JhLc9x5WdBKew9ZgAXg7DBk0ZHErLHdXM24rfX+bKrFe+Xp5YuJo54I5HFjGDAA==", "cpu": [ "arm64" ], @@ -971,9 +971,9 @@ ] }, "node_modules/@rollup/rollup-linux-arm64-musl": { - "version": "4.56.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.56.0.tgz", - "integrity": "sha512-vLZ1yJKLxhQLFKTs42RwTwa6zkGln+bnXc8ueFGMYmBTLfNu58sl5/eXyxRa2RarTkJbXl8TKPgfS6V5ijNqEA==", + "version": "4.59.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.59.0.tgz", + "integrity": "sha512-peZRVEdnFWZ5Bh2KeumKG9ty7aCXzzEsHShOZEFiCQlDEepP1dpUl/SrUNXNg13UmZl+gzVDPsiCwnV1uI0RUA==", "cpu": [ "arm64" ], @@ -985,9 +985,9 @@ ] }, "node_modules/@rollup/rollup-linux-loong64-gnu": { - "version": "4.56.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-gnu/-/rollup-linux-loong64-gnu-4.56.0.tgz", - "integrity": "sha512-FWfHOCub564kSE3xJQLLIC/hbKqHSVxy8vY75/YHHzWvbJL7aYJkdgwD/xGfUlL5UV2SB7otapLrcCj2xnF1dg==", + "version": "4.59.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-gnu/-/rollup-linux-loong64-gnu-4.59.0.tgz", + "integrity": "sha512-gbUSW/97f7+r4gHy3Jlup8zDG190AuodsWnNiXErp9mT90iCy9NKKU0Xwx5k8VlRAIV2uU9CsMnEFg/xXaOfXg==", "cpu": [ "loong64" ], @@ -999,9 +999,9 @@ ] }, "node_modules/@rollup/rollup-linux-loong64-musl": { - "version": "4.56.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-musl/-/rollup-linux-loong64-musl-4.56.0.tgz", - "integrity": "sha512-z1EkujxIh7nbrKL1lmIpqFTc/sr0u8Uk0zK/qIEFldbt6EDKWFk/pxFq3gYj4Bjn3aa9eEhYRlL3H8ZbPT1xvA==", + "version": "4.59.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-musl/-/rollup-linux-loong64-musl-4.59.0.tgz", + "integrity": "sha512-yTRONe79E+o0FWFijasoTjtzG9EBedFXJMl888NBEDCDV9I2wGbFFfJQQe63OijbFCUZqxpHz1GzpbtSFikJ4Q==", "cpu": [ "loong64" ], @@ -1013,9 +1013,9 @@ ] }, "node_modules/@rollup/rollup-linux-ppc64-gnu": { - "version": "4.56.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-gnu/-/rollup-linux-ppc64-gnu-4.56.0.tgz", - "integrity": "sha512-iNFTluqgdoQC7AIE8Q34R3AuPrJGJirj5wMUErxj22deOcY7XwZRaqYmB6ZKFHoVGqRcRd0mqO+845jAibKCkw==", + "version": "4.59.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-gnu/-/rollup-linux-ppc64-gnu-4.59.0.tgz", + "integrity": "sha512-sw1o3tfyk12k3OEpRddF68a1unZ5VCN7zoTNtSn2KndUE+ea3m3ROOKRCZxEpmT9nsGnogpFP9x6mnLTCaoLkA==", "cpu": [ "ppc64" ], @@ -1027,9 +1027,9 @@ ] }, "node_modules/@rollup/rollup-linux-ppc64-musl": { - "version": "4.56.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-musl/-/rollup-linux-ppc64-musl-4.56.0.tgz", - "integrity": "sha512-MtMeFVlD2LIKjp2sE2xM2slq3Zxf9zwVuw0jemsxvh1QOpHSsSzfNOTH9uYW9i1MXFxUSMmLpeVeUzoNOKBaWg==", + "version": "4.59.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-musl/-/rollup-linux-ppc64-musl-4.59.0.tgz", + "integrity": "sha512-+2kLtQ4xT3AiIxkzFVFXfsmlZiG5FXYW7ZyIIvGA7Bdeuh9Z0aN4hVyXS/G1E9bTP/vqszNIN/pUKCk/BTHsKA==", "cpu": [ "ppc64" ], @@ -1041,9 +1041,9 @@ ] }, "node_modules/@rollup/rollup-linux-riscv64-gnu": { - "version": "4.56.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.56.0.tgz", - "integrity": "sha512-in+v6wiHdzzVhYKXIk5U74dEZHdKN9KH0Q4ANHOTvyXPG41bajYRsy7a8TPKbYPl34hU7PP7hMVHRvv/5aCSew==", + "version": "4.59.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.59.0.tgz", + "integrity": "sha512-NDYMpsXYJJaj+I7UdwIuHHNxXZ/b/N2hR15NyH3m2qAtb/hHPA4g4SuuvrdxetTdndfj9b1WOmy73kcPRoERUg==", "cpu": [ "riscv64" ], @@ -1055,9 +1055,9 @@ ] }, "node_modules/@rollup/rollup-linux-riscv64-musl": { - "version": "4.56.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-musl/-/rollup-linux-riscv64-musl-4.56.0.tgz", - "integrity": "sha512-yni2raKHB8m9NQpI9fPVwN754mn6dHQSbDTwxdr9SE0ks38DTjLMMBjrwvB5+mXrX+C0npX0CVeCUcvvvD8CNQ==", + "version": "4.59.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-musl/-/rollup-linux-riscv64-musl-4.59.0.tgz", + "integrity": "sha512-nLckB8WOqHIf1bhymk+oHxvM9D3tyPndZH8i8+35p/1YiVoVswPid2yLzgX7ZJP0KQvnkhM4H6QZ5m0LzbyIAg==", "cpu": [ "riscv64" ], @@ -1069,9 +1069,9 @@ ] }, "node_modules/@rollup/rollup-linux-s390x-gnu": { - "version": "4.56.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.56.0.tgz", - "integrity": "sha512-zhLLJx9nQPu7wezbxt2ut+CI4YlXi68ndEve16tPc/iwoylWS9B3FxpLS2PkmfYgDQtosah07Mj9E0khc3Y+vQ==", + "version": "4.59.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.59.0.tgz", + "integrity": "sha512-oF87Ie3uAIvORFBpwnCvUzdeYUqi2wY6jRFWJAy1qus/udHFYIkplYRW+wo+GRUP4sKzYdmE1Y3+rY5Gc4ZO+w==", "cpu": [ "s390x" ], @@ -1083,9 +1083,9 @@ ] }, "node_modules/@rollup/rollup-linux-x64-gnu": { - "version": "4.56.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.56.0.tgz", - "integrity": "sha512-MVC6UDp16ZSH7x4rtuJPAEoE1RwS8N4oK9DLHy3FTEdFoUTCFVzMfJl/BVJ330C+hx8FfprA5Wqx4FhZXkj2Kw==", + "version": "4.59.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.59.0.tgz", + "integrity": "sha512-3AHmtQq/ppNuUspKAlvA8HtLybkDflkMuLK4DPo77DfthRb71V84/c4MlWJXixZz4uruIH4uaa07IqoAkG64fg==", "cpu": [ "x64" ], @@ -1097,9 +1097,9 @@ ] }, "node_modules/@rollup/rollup-linux-x64-musl": { - "version": "4.56.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.56.0.tgz", - "integrity": "sha512-ZhGH1eA4Qv0lxaV00azCIS1ChedK0V32952Md3FtnxSqZTBTd6tgil4nZT5cU8B+SIw3PFYkvyR4FKo2oyZIHA==", + "version": "4.59.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.59.0.tgz", + "integrity": "sha512-2UdiwS/9cTAx7qIUZB/fWtToJwvt0Vbo0zmnYt7ED35KPg13Q0ym1g442THLC7VyI6JfYTP4PiSOWyoMdV2/xg==", "cpu": [ "x64" ], @@ -1111,9 +1111,9 @@ ] }, "node_modules/@rollup/rollup-openbsd-x64": { - "version": "4.56.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-openbsd-x64/-/rollup-openbsd-x64-4.56.0.tgz", - "integrity": "sha512-O16XcmyDeFI9879pEcmtWvD/2nyxR9mF7Gs44lf1vGGx8Vg2DRNx11aVXBEqOQhWb92WN4z7fW/q4+2NYzCbBA==", + "version": "4.59.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-openbsd-x64/-/rollup-openbsd-x64-4.59.0.tgz", + "integrity": "sha512-M3bLRAVk6GOwFlPTIxVBSYKUaqfLrn8l0psKinkCFxl4lQvOSz8ZrKDz2gxcBwHFpci0B6rttydI4IpS4IS/jQ==", "cpu": [ "x64" ], @@ -1125,9 +1125,9 @@ ] }, "node_modules/@rollup/rollup-openharmony-arm64": { - "version": "4.56.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-openharmony-arm64/-/rollup-openharmony-arm64-4.56.0.tgz", - "integrity": "sha512-LhN/Reh+7F3RCgQIRbgw8ZMwUwyqJM+8pXNT6IIJAqm2IdKkzpCh/V9EdgOMBKuebIrzswqy4ATlrDgiOwbRcQ==", + "version": "4.59.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-openharmony-arm64/-/rollup-openharmony-arm64-4.59.0.tgz", + "integrity": "sha512-tt9KBJqaqp5i5HUZzoafHZX8b5Q2Fe7UjYERADll83O4fGqJ49O1FsL6LpdzVFQcpwvnyd0i+K/VSwu/o/nWlA==", "cpu": [ "arm64" ], @@ -1139,9 +1139,9 @@ ] }, "node_modules/@rollup/rollup-win32-arm64-msvc": { - "version": "4.56.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.56.0.tgz", - "integrity": "sha512-kbFsOObXp3LBULg1d3JIUQMa9Kv4UitDmpS+k0tinPBz3watcUiV2/LUDMMucA6pZO3WGE27P7DsfaN54l9ing==", + "version": "4.59.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.59.0.tgz", + "integrity": "sha512-V5B6mG7OrGTwnxaNUzZTDTjDS7F75PO1ae6MJYdiMu60sq0CqN5CVeVsbhPxalupvTX8gXVSU9gq+Rx1/hvu6A==", "cpu": [ "arm64" ], @@ -1153,9 +1153,9 @@ ] }, "node_modules/@rollup/rollup-win32-ia32-msvc": { - "version": "4.56.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.56.0.tgz", - "integrity": "sha512-vSSgny54D6P4vf2izbtFm/TcWYedw7f8eBrOiGGecyHyQB9q4Kqentjaj8hToe+995nob/Wv48pDqL5a62EWtg==", + "version": "4.59.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.59.0.tgz", + "integrity": "sha512-UKFMHPuM9R0iBegwzKF4y0C4J9u8C6MEJgFuXTBerMk7EJ92GFVFYBfOZaSGLu6COf7FxpQNqhNS4c4icUPqxA==", "cpu": [ "ia32" ], @@ -1167,9 +1167,9 @@ ] }, "node_modules/@rollup/rollup-win32-x64-gnu": { - "version": "4.56.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-gnu/-/rollup-win32-x64-gnu-4.56.0.tgz", - "integrity": "sha512-FeCnkPCTHQJFbiGG49KjV5YGW/8b9rrXAM2Mz2kiIoktq2qsJxRD5giEMEOD2lPdgs72upzefaUvS+nc8E3UzQ==", + "version": "4.59.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-gnu/-/rollup-win32-x64-gnu-4.59.0.tgz", + "integrity": "sha512-laBkYlSS1n2L8fSo1thDNGrCTQMmxjYY5G0WFWjFFYZkKPjsMBsgJfGf4TLxXrF6RyhI60L8TMOjBMvXiTcxeA==", "cpu": [ "x64" ], @@ -1181,9 +1181,9 @@ ] }, "node_modules/@rollup/rollup-win32-x64-msvc": { - "version": "4.56.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.56.0.tgz", - "integrity": "sha512-H8AE9Ur/t0+1VXujj90w0HrSOuv0Nq9r1vSZF2t5km20NTfosQsGGUXDaKdQZzwuLts7IyL1fYT4hM95TI9c4g==", + "version": "4.59.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.59.0.tgz", + "integrity": "sha512-2HRCml6OztYXyJXAvdDXPKcawukWY2GpR5/nxKp4iBgiO3wcoEGkAaqctIbZcNB6KlUQBIqt8VYkNSj2397EfA==", "cpu": [ "x64" ], @@ -1445,13 +1445,13 @@ } }, "node_modules/@typescript-eslint/typescript-estree/node_modules/minimatch": { - "version": "9.0.5", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.5.tgz", - "integrity": "sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==", + "version": "9.0.9", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.9.tgz", + "integrity": "sha512-OBwBN9AL4dqmETlpS2zasx+vTeWclWzkblfZk7KTA5j3jeOONz/tRCnZomUyvNg83wL5Zv9Ss6HMJXAgL8R2Yg==", "dev": true, "license": "ISC", "dependencies": { - "brace-expansion": "^2.0.1" + "brace-expansion": "^2.0.2" }, "engines": { "node": ">=16 || 14 >=14.17" @@ -1710,9 +1710,9 @@ } }, "node_modules/ajv": { - "version": "6.12.6", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", - "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", + "version": "6.14.0", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.14.0.tgz", + "integrity": "sha512-IWrosm/yrn43eiKqkfkHis7QioDleaXQHdDVPKg0FSwwd/DuvyX79TZnFOnYpB7dcsFAMmtFztZuXPDvSePkFw==", "dev": true, "license": "MIT", "dependencies": { @@ -1796,26 +1796,26 @@ "license": "MIT" }, "node_modules/balanced-match": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-4.0.3.tgz", - "integrity": "sha512-1pHv8LX9CpKut1Zp4EXey7Z8OfH11ONNH6Dhi2WDUt31VVZFXZzKwXcysBgqSumFCmR+0dqjMK5v5JiFHzi0+g==", + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-4.0.4.tgz", + "integrity": "sha512-BLrgEcRTwX2o6gGxGOCNyMvGSp35YofuYzw9h1IMTRmKqttAZZVU67bdb9Pr2vUHA8+j3i2tJfjO6C6+4myGTA==", "dev": true, "license": "MIT", "engines": { - "node": "20 || >=22" + "node": "18 || 20 || >=22" } }, "node_modules/brace-expansion": { - "version": "5.0.2", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-5.0.2.tgz", - "integrity": "sha512-Pdk8c9poy+YhOgVWw1JNN22/HcivgKWwpxKq04M/jTmHyCZn12WPJebZxdjSa5TmBqISrUSgNYU3eRORljfCCw==", + "version": "5.0.4", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-5.0.4.tgz", + "integrity": "sha512-h+DEnpVvxmfVefa4jFbCf5HdH5YMDXRsmKflpf1pILZWRFlTbJpxeU55nJl4Smt5HQaGzg1o6RHFPJaOqnmBDg==", "dev": true, "license": "MIT", "dependencies": { "balanced-match": "^4.0.2" }, "engines": { - "node": "20 || >=22" + "node": "18 || 20 || >=22" } }, "node_modules/braces": { @@ -2014,15 +2014,15 @@ } }, "node_modules/eslint": { - "version": "10.0.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-10.0.0.tgz", - "integrity": "sha512-O0piBKY36YSJhlFSG8p9VUdPV/SxxS4FYDWVpr/9GJuMaepzwlf4J8I4ov1b+ySQfDTPhc3DtLaxcT1fN0yqCg==", + "version": "10.0.2", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-10.0.2.tgz", + "integrity": "sha512-uYixubwmqJZH+KLVYIVKY1JQt7tysXhtj21WSvjcSmU5SVNzMus1bgLe+pAt816yQ8opKfheVVoPLqvVMGejYw==", "dev": true, "license": "MIT", "dependencies": { "@eslint-community/eslint-utils": "^4.8.0", "@eslint-community/regexpp": "^4.12.2", - "@eslint/config-array": "^0.23.0", + "@eslint/config-array": "^0.23.2", "@eslint/config-helpers": "^0.5.2", "@eslint/core": "^1.1.0", "@eslint/plugin-kit": "^0.6.0", @@ -2030,13 +2030,13 @@ "@humanwhocodes/module-importer": "^1.0.1", "@humanwhocodes/retry": "^0.4.2", "@types/estree": "^1.0.6", - "ajv": "^6.12.4", + "ajv": "^6.14.0", "cross-spawn": "^7.0.6", "debug": "^4.3.2", "escape-string-regexp": "^4.0.0", - "eslint-scope": "^9.1.0", - "eslint-visitor-keys": "^5.0.0", - "espree": "^11.1.0", + "eslint-scope": "^9.1.1", + "eslint-visitor-keys": "^5.0.1", + "espree": "^11.1.1", "esquery": "^1.7.0", "esutils": "^2.0.2", "fast-deep-equal": "^3.1.3", @@ -2047,7 +2047,7 @@ "imurmurhash": "^0.1.4", "is-glob": "^4.0.0", "json-stable-stringify-without-jsonify": "^1.0.1", - "minimatch": "^10.1.1", + "minimatch": "^10.2.1", "natural-compare": "^1.4.0", "optionator": "^0.9.3" }, @@ -2070,9 +2070,9 @@ } }, "node_modules/eslint-scope": { - "version": "9.1.0", - "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-9.1.0.tgz", - "integrity": "sha512-CkWE42hOJsNj9FJRaoMX9waUFYhqY4jmyLFdAdzZr6VaCg3ynLYx4WnOdkaIifGfH4gsUcBTn4OZbHXkpLD0FQ==", + "version": "9.1.1", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-9.1.1.tgz", + "integrity": "sha512-GaUN0sWim5qc8KVErfPBWmc31LEsOkrUJbvJZV+xuL3u2phMUK4HIvXlWAakfC8W4nzlK+chPEAkYOYb5ZScIw==", "dev": true, "license": "BSD-2-Clause", "dependencies": { @@ -2102,9 +2102,9 @@ } }, "node_modules/eslint/node_modules/eslint-visitor-keys": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-5.0.0.tgz", - "integrity": "sha512-A0XeIi7CXU7nPlfHS9loMYEKxUaONu/hTEzHTGba9Huu94Cq1hPivf+DE5erJozZOky0LfvXAyrV/tcswpLI0Q==", + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-5.0.1.tgz", + "integrity": "sha512-tD40eHxA35h0PEIZNeIjkHoDR4YjjJp34biM0mDvplBe//mB+IHCqHDGV7pxF+7MklTvighcCPPZC7ynWyjdTA==", "dev": true, "license": "Apache-2.0", "engines": { @@ -2125,15 +2125,15 @@ } }, "node_modules/espree": { - "version": "11.1.0", - "resolved": "https://registry.npmjs.org/espree/-/espree-11.1.0.tgz", - "integrity": "sha512-WFWYhO1fV4iYkqOOvq8FbqIhr2pYfoDY0kCotMkDeNtGpiGGkZ1iov2u8ydjtgM8yF8rzK7oaTbw2NAzbAbehw==", + "version": "11.1.1", + "resolved": "https://registry.npmjs.org/espree/-/espree-11.1.1.tgz", + "integrity": "sha512-AVHPqQoZYc+RUM4/3Ly5udlZY/U4LS8pIG05jEjWM2lQMU/oaZ7qshzAl2YP1tfNmXfftH3ohurfwNAug+MnsQ==", "dev": true, "license": "BSD-2-Clause", "dependencies": { - "acorn": "^8.15.0", + "acorn": "^8.16.0", "acorn-jsx": "^5.3.2", - "eslint-visitor-keys": "^5.0.0" + "eslint-visitor-keys": "^5.0.1" }, "engines": { "node": "^20.19.0 || ^22.13.0 || >=24" @@ -2143,9 +2143,9 @@ } }, "node_modules/espree/node_modules/eslint-visitor-keys": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-5.0.0.tgz", - "integrity": "sha512-A0XeIi7CXU7nPlfHS9loMYEKxUaONu/hTEzHTGba9Huu94Cq1hPivf+DE5erJozZOky0LfvXAyrV/tcswpLI0Q==", + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-5.0.1.tgz", + "integrity": "sha512-tD40eHxA35h0PEIZNeIjkHoDR4YjjJp34biM0mDvplBe//mB+IHCqHDGV7pxF+7MklTvighcCPPZC7ynWyjdTA==", "dev": true, "license": "Apache-2.0", "engines": { @@ -2395,9 +2395,9 @@ } }, "node_modules/hono": { - "version": "4.12.0", - "resolved": "https://registry.npmjs.org/hono/-/hono-4.12.0.tgz", - "integrity": "sha512-NekXntS5M94pUfiVZ8oXXK/kkri+5WpX2/Ik+LVsl+uvw+soj4roXIsPqO+XsWrAw20mOzaXOZf3Q7PfB9A/IA==", + "version": "4.12.3", + "resolved": "https://registry.npmjs.org/hono/-/hono-4.12.3.tgz", + "integrity": "sha512-SFsVSjp8sj5UumXOOFlkZOG6XS9SJDKw0TbwFeV+AJ8xlST8kxK5Z/5EYa111UY8732lK2S/xB653ceuaoGwpg==", "license": "MIT", "engines": { "node": ">=16.9.0" @@ -2747,9 +2747,9 @@ } }, "node_modules/minimatch": { - "version": "10.2.2", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-10.2.2.tgz", - "integrity": "sha512-+G4CpNBxa5MprY+04MbgOw1v7So6n5JY166pFi9KfYwT78fxScCeSNQSNzp6dpPSW2rONOps6Ocam1wFhCgoVw==", + "version": "10.2.4", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-10.2.4.tgz", + "integrity": "sha512-oRjTw/97aTBN0RHbYCdtF1MQfvusSIBQM0IZEgzl6426+8jSC0nF1a/GmnVLpfB9yyr6g6FTqWqiZVbxrtaCIg==", "dev": true, "license": "BlueOak-1.0.0", "dependencies": { @@ -3046,9 +3046,9 @@ "license": "MIT" }, "node_modules/rollup": { - "version": "4.56.0", - "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.56.0.tgz", - "integrity": "sha512-9FwVqlgUHzbXtDg9RCMgodF3Ua4Na6Gau+Sdt9vyCN4RhHfVKX2DCHy3BjMLTDd47ITDhYAnTwGulWTblJSDLg==", + "version": "4.59.0", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.59.0.tgz", + "integrity": "sha512-2oMpl67a3zCH9H79LeMcbDhXW/UmWG/y2zuqnF2jQq5uq9TbM9TVyXvA4+t+ne2IIkBdrLpAaRQAvo7YI/Yyeg==", "dev": true, "license": "MIT", "dependencies": { @@ -3062,31 +3062,31 @@ "npm": ">=8.0.0" }, "optionalDependencies": { - "@rollup/rollup-android-arm-eabi": "4.56.0", - "@rollup/rollup-android-arm64": "4.56.0", - "@rollup/rollup-darwin-arm64": "4.56.0", - "@rollup/rollup-darwin-x64": "4.56.0", - "@rollup/rollup-freebsd-arm64": "4.56.0", - "@rollup/rollup-freebsd-x64": "4.56.0", - "@rollup/rollup-linux-arm-gnueabihf": "4.56.0", - "@rollup/rollup-linux-arm-musleabihf": "4.56.0", - "@rollup/rollup-linux-arm64-gnu": "4.56.0", - "@rollup/rollup-linux-arm64-musl": "4.56.0", - "@rollup/rollup-linux-loong64-gnu": "4.56.0", - "@rollup/rollup-linux-loong64-musl": "4.56.0", - "@rollup/rollup-linux-ppc64-gnu": "4.56.0", - "@rollup/rollup-linux-ppc64-musl": "4.56.0", - "@rollup/rollup-linux-riscv64-gnu": "4.56.0", - "@rollup/rollup-linux-riscv64-musl": "4.56.0", - "@rollup/rollup-linux-s390x-gnu": "4.56.0", - "@rollup/rollup-linux-x64-gnu": "4.56.0", - "@rollup/rollup-linux-x64-musl": "4.56.0", - "@rollup/rollup-openbsd-x64": "4.56.0", - "@rollup/rollup-openharmony-arm64": "4.56.0", - "@rollup/rollup-win32-arm64-msvc": "4.56.0", - "@rollup/rollup-win32-ia32-msvc": "4.56.0", - "@rollup/rollup-win32-x64-gnu": "4.56.0", - "@rollup/rollup-win32-x64-msvc": "4.56.0", + "@rollup/rollup-android-arm-eabi": "4.59.0", + "@rollup/rollup-android-arm64": "4.59.0", + "@rollup/rollup-darwin-arm64": "4.59.0", + "@rollup/rollup-darwin-x64": "4.59.0", + "@rollup/rollup-freebsd-arm64": "4.59.0", + "@rollup/rollup-freebsd-x64": "4.59.0", + "@rollup/rollup-linux-arm-gnueabihf": "4.59.0", + "@rollup/rollup-linux-arm-musleabihf": "4.59.0", + "@rollup/rollup-linux-arm64-gnu": "4.59.0", + "@rollup/rollup-linux-arm64-musl": "4.59.0", + "@rollup/rollup-linux-loong64-gnu": "4.59.0", + "@rollup/rollup-linux-loong64-musl": "4.59.0", + "@rollup/rollup-linux-ppc64-gnu": "4.59.0", + "@rollup/rollup-linux-ppc64-musl": "4.59.0", + "@rollup/rollup-linux-riscv64-gnu": "4.59.0", + "@rollup/rollup-linux-riscv64-musl": "4.59.0", + "@rollup/rollup-linux-s390x-gnu": "4.59.0", + "@rollup/rollup-linux-x64-gnu": "4.59.0", + "@rollup/rollup-linux-x64-musl": "4.59.0", + "@rollup/rollup-openbsd-x64": "4.59.0", + "@rollup/rollup-openharmony-arm64": "4.59.0", + "@rollup/rollup-win32-arm64-msvc": "4.59.0", + "@rollup/rollup-win32-ia32-msvc": "4.59.0", + "@rollup/rollup-win32-x64-gnu": "4.59.0", + "@rollup/rollup-win32-x64-msvc": "4.59.0", "fsevents": "~2.3.2" } }, diff --git a/package.json b/package.json index 99934cf4..e19e14f0 100644 --- a/package.json +++ b/package.json @@ -93,14 +93,16 @@ "dependencies": { "@openauthjs/openauth": "^0.4.3", "@opencode-ai/plugin": "^1.2.9", - "hono": "^4.12.0", + "hono": "^4.12.3", "zod": "^4.3.6" }, "overrides": { - "hono": "^4.12.0", + "hono": "^4.12.3", "vite": "^7.3.1", + "rollup": "^4.59.0", + "minimatch": "^10.2.4", "@typescript-eslint/typescript-estree": { - "minimatch": "^9.0.5" + "minimatch": "^9.0.9" } } } diff --git a/test/index.test.ts b/test/index.test.ts index 02e79061..47c67a60 100644 --- a/test/index.test.ts +++ b/test/index.test.ts @@ -37,6 +37,7 @@ vi.mock("../lib/auth/auth.js", () => ({ state: stateMatch?.[1], }; }), + AUTHORIZE_URL: "https://auth.openai.com/oauth/authorize", REDIRECT_URI: "http://127.0.0.1:1455/auth/callback", })); @@ -491,6 +492,46 @@ describe("OpenAIOAuthPlugin", () => { expect(result.reason).toBe("invalid_response"); expect(vi.mocked(authModule.exchangeAuthorizationCode)).not.toHaveBeenCalled(); }); + + it("rejects manual OAuth callback URLs with non-localhost host", async () => { + const authModule = await import("../lib/auth/auth.js"); + const manualMethod = plugin.auth.methods[1] as unknown as { + authorize: () => Promise<{ + validate: (input: string) => string | undefined; + callback: (input: string) => Promise<{ type: string; reason?: string; message?: string }>; + }>; + }; + + const flow = await manualMethod.authorize(); + const invalidInput = "http://evil.example/auth/callback?code=abc123&state=test-state"; + expect(flow.validate(invalidInput)).toContain("Invalid callback URL host"); + + const result = await flow.callback(invalidInput); + expect(result.type).toBe("failed"); + expect(result.reason).toBe("invalid_response"); + expect(result.message).toContain("Invalid callback URL host"); + expect(vi.mocked(authModule.exchangeAuthorizationCode)).not.toHaveBeenCalled(); + }); + + it("rejects manual OAuth callback URLs with unexpected protocol", async () => { + const authModule = await import("../lib/auth/auth.js"); + const manualMethod = plugin.auth.methods[1] as unknown as { + authorize: () => Promise<{ + validate: (input: string) => string | undefined; + callback: (input: string) => Promise<{ type: string; reason?: string; message?: string }>; + }>; + }; + + const flow = await manualMethod.authorize(); + const invalidInput = "https://localhost:1455/auth/callback?code=abc123&state=test-state"; + expect(flow.validate(invalidInput)).toContain("Invalid callback URL protocol"); + + const result = await flow.callback(invalidInput); + expect(result.type).toBe("failed"); + expect(result.reason).toBe("invalid_response"); + expect(result.message).toContain("Invalid callback URL protocol"); + expect(vi.mocked(authModule.exchangeAuthorizationCode)).not.toHaveBeenCalled(); + }); }); describe("event handler", () => { diff --git a/test/server.unit.test.ts b/test/server.unit.test.ts index ec6fb6a4..eae23cf6 100644 --- a/test/server.unit.test.ts +++ b/test/server.unit.test.ts @@ -13,7 +13,6 @@ vi.mock('node:http', () => { close: vi.fn(), unref: vi.fn(), on: vi.fn(), - _lastCode: undefined as string | undefined, }; return { @@ -45,13 +44,11 @@ import { logError, logWarn } from '../lib/logger.js'; describe('OAuth Server Unit Tests', () => { let mockServer: ReturnType & { _handler?: (req: IncomingMessage, res: ServerResponse) => void; - _lastCode?: string; }; beforeEach(() => { vi.clearAllMocks(); mockServer = http.createServer(() => {}) as typeof mockServer; - mockServer._lastCode = undefined; }); afterEach(() => { @@ -115,9 +112,10 @@ describe('OAuth Server Unit Tests', () => { requestHandler = mockServer._handler!; }); - function createMockRequest(url: string): IncomingMessage { + function createMockRequest(url: string, method: string = "GET"): IncomingMessage { const req = new EventEmitter() as IncomingMessage; req.url = url; + req.method = method; return req; } @@ -146,6 +144,17 @@ describe('OAuth Server Unit Tests', () => { expect(res.end).toHaveBeenCalledWith('Not found'); }); + it('should return 405 for non-GET methods', () => { + const req = createMockRequest('/auth/callback?code=abc&state=test-state', 'POST'); + const res = createMockResponse(); + + requestHandler(req, res); + + expect(res.statusCode).toBe(405); + expect(res.setHeader).toHaveBeenCalledWith('Allow', 'GET'); + expect(res.end).toHaveBeenCalledWith('Method not allowed'); + }); + it('should return 400 for state mismatch', () => { const req = createMockRequest('/auth/callback?code=abc&state=wrong-state'); const res = createMockResponse(); @@ -180,18 +189,11 @@ describe('OAuth Server Unit Tests', () => { 'Content-Security-Policy', "default-src 'self'; script-src 'none'" ); + expect(res.setHeader).toHaveBeenCalledWith('Cache-Control', 'no-store'); + expect(res.setHeader).toHaveBeenCalledWith('Pragma', 'no-cache'); expect(res.end).toHaveBeenCalledWith('Success'); }); - it('should store the code in server._lastCode', () => { - const req = createMockRequest('/auth/callback?code=captured-code&state=test-state'); - const res = createMockResponse(); - - requestHandler(req, res); - - expect(mockServer._lastCode).toBe('captured-code'); - }); - it('should handle request handler errors gracefully', () => { const req = createMockRequest('/auth/callback?code=test&state=test-state'); const res = createMockResponse(); @@ -249,6 +251,21 @@ describe('OAuth Server Unit Tests', () => { }); describe('waitForCode function', () => { + function createMockRequest(url: string): IncomingMessage { + const req = new EventEmitter() as IncomingMessage; + req.url = url; + req.method = 'GET'; + return req; + } + + function createMockResponse(): ServerResponse { + return { + statusCode: 200, + setHeader: vi.fn(), + end: vi.fn(), + } as unknown as ServerResponse; + } + it('should return null immediately when ready=false', async () => { (mockServer.listen as ReturnType).mockReturnValue(mockServer); (mockServer.on as ReturnType).mockImplementation( @@ -278,13 +295,41 @@ describe('OAuth Server Unit Tests', () => { (mockServer.on as ReturnType).mockReturnValue(mockServer); const result = await startLocalOAuthServer({ state: 'test-state' }); - - mockServer._lastCode = 'the-code'; + mockServer._handler?.( + createMockRequest('/auth/callback?code=the-code&state=test-state'), + createMockResponse(), + ); const code = await result.waitForCode('test-state'); expect(code).toEqual({ code: 'the-code' }); }); + it('should consume captured code only once', async () => { + vi.useFakeTimers(); + (mockServer.listen as ReturnType).mockImplementation( + (_port: number, _host: string, callback: () => void) => { + callback(); + return mockServer; + } + ); + (mockServer.on as ReturnType).mockReturnValue(mockServer); + + const result = await startLocalOAuthServer({ state: 'test-state' }); + mockServer._handler?.( + createMockRequest('/auth/callback?code=one-time-code&state=test-state'), + createMockResponse(), + ); + + const first = await result.waitForCode('test-state'); + expect(first).toEqual({ code: 'one-time-code' }); + + const secondPromise = result.waitForCode('test-state'); + await vi.advanceTimersByTimeAsync(5 * 60 * 1000 + 100); + const second = await secondPromise; + expect(second).toBeNull(); + vi.useRealTimers(); + }); + it('should return null after 5 minute timeout', async () => { vi.useFakeTimers();