diff --git a/CLAUDE.md b/CLAUDE.md index 94d21577..936176ff 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -62,7 +62,7 @@ TRUST_PROXY_HOPS=1 # optional; proxy hops in front of the app (1 on Re ## Conventions - Always import via the `@/` alias (`@/utils/helper`) — `src/*` in dev (tsconfig-paths), `dist/*` in prod (module-alias, `src/alias.ts`). -- Middleware order is `runServer` in `src/server.ts`. `/health` and `/api-docs` are registered before the rate limiter on purpose (exempt). +- Middleware order is `createApp` in `src/server.ts`. `/health` and `/api-docs` are registered before the rate limiter on purpose (exempt). - New CV section → `src/candidate_profile/
/` controller + service + validate, built on `createCrudService()` (`BaseService.ts`) and `BaseController.ts`, like the existing sections. - CV-section models + `Application` + `Profile` soft-delete via nullable `deletedAt` (`Visit` doesn't). Localized free-text fields use `localizedTextSchema` (`{ vi, en }`), resolved per request by `?lang=`. - Errors: services throw `AppError` subclasses (`src/errors/`), never return `{ success:false }`. Every status comes from the `ERROR_STATUS` map in `errors/AppError.ts`; `withTimeout` throws `SERVICE_UNAVAILABLE` (503) on a DB/Redis timeout. diff --git a/agent-hub/evidence/implementer/2026-11-18/auth-http-integration-tests-diff.md b/agent-hub/evidence/implementer/2026-11-18/auth-http-integration-tests-diff.md new file mode 100644 index 00000000..dd1500e4 --- /dev/null +++ b/agent-hub/evidence/implementer/2026-11-18/auth-http-integration-tests-diff.md @@ -0,0 +1,141 @@ +# 2026-11-18 - auth-http-integration-tests (diff) +Worker: implementer · Version: 0.1.0 · Node: `haven/diagrams/dev-loop.prime-mermaid.md` → `auth-http-integration-tests` · Task: `/todo #463` — "Add HTTP-level integration tests for the auth flow (supertest + in-memory Mongo)" · Branch: `chore/463-auth-integration-tests` (cut from `staging` @ 33fcfb1) +Plan: `evidence/implementer/2026-11-18/auth-http-integration-tests-plan.md` + +## Hub bytes before: 97851 + +## Feature doc: doctrine/features/auth-session-tokens.md, doctrine/features/auth-register-login.md +Unchanged — tests assert their Behavior; no behavior change. Not a `feat` (operator chose branch type `chore`), so the docs' own `## Acceptance criteria` aren't this node's; the Behavior items exercised: +| Doc · Behavior | Test (Acceptance row) | +|---|---| +| register-login #1 (valid register body), #3 (register → 201) | `beforeAll` asserts `[201, 201, 201, 201]` | +| register-login #6 (login 200 + `token`/`tokenRefresh` + cookies) | `login()` helper asserts 200, reads both tokens + `set-cookie` (used by criterion 3) | +| session #3 (cookie-only non-GET without `x-csrf-token` → 403 `CSRF_TOKEN_INVALID`) | criterion 3 | +| session #4 (`req.body.candidateId` overwritten) | criterion 4 | +| session #5 (refresh → new pair; rotated token unusable) | criteria 1, 2 | +| session #6 (reuse > 10s → all sessions revoked, same 401) | criterion 2 | +| session #7 (logout blacklists access + body `refreshToken`; later refresh → 401 `TOKEN_REVOKED`) | criterion 1 | +| session #2 (blacklisted / pre-revocation token → 401) | criteria 1, 2 | +| session #9 (Redis absent → memory fallback) | criterion 6 | +| session doc acceptance row "After logout, same access token → 401 `TOKEN_REVOKED`" | criterion 1 | + +## Diff +| File | Why | +|---|---| +| `src/server.ts` | Middleware chain moved verbatim from `runServer` into exported `createApp()` (returns the app); `runServer` calls it. `startServer()` + the `unhandledRejection` handler now run only under `if (require.main === module)`, so importing the module (tests) has no Mongo/listen/process-handler side effects. `void` added to the startup call. | +| `src/__tests__/integration/auth.http.test.ts` (new) | 6 supertest tests over `createApp()` with `mongodb-memory-server`: Redis-absent precondition; register→login→GET→refresh→GET→logout → GET 401 `TOKEN_REVOKED` + refresh with logged-out refresh 401; rotated refresh reuse with `Date.now` +11s → 401, original + rotated access tokens 401, rotated refresh 401; cookie-only `POST /profile/create` without `x-csrf-token` → 403 `CSRF_TOKEN_INVALID`, nothing written; `candidateId` of another user in body → profile stored under the caller (IDOR); unknown route → 404 `{ success:false, error:{ code:'ROUTE_NOT_FOUND', message } }`. Logger mocked (`jest.mock('@/logger')`, as other suites); `memStore.clear()` per test. | +| `package.json` / `package-lock.json` | devDependencies `supertest@^7.3.2`, `@types/supertest@^7.2.1`, `mongodb-memory-server@^11.3.0`. Lockfile also re-hoists/dedupes transitive entries (npm's own rewrite); `npm ls --all` → exit 0. | +| `CLAUDE.md` | Conventions line "Middleware order is `runServer`" → `createApp` (would be stale after the move). | + +## Command +From `/Users/_david/Workspace/Project/resume/resume-nodejs-api` (copied from `doctrine/MEMORY.md`): +- `npx jest src/__tests__/integration/auth.http.test.ts` +- `npm test` +- `npm run build` (Typecheck row = `inside Build`); also `npx tsc --noEmit` +- `npm run lint`; plus `npx eslint src/server.ts src/__tests__/integration/auth.http.test.ts` and the same on `git show staging:src/server.ts` via `--stdin` for the before count +- Entry-point smoke: `MONGO_URI=mongodb://127.0.0.1:1/x NODE_ENV=development LOCAL_PORT=3999 perl -e 'alarm 50; exec @ARGV' node dist/server.js` and `node -e "require('./dist/server.js'); console.log('imported, no start')"` + +## Output (final run, after review fixes) +``` +PASS src/__tests__/integration/auth.http.test.ts (5.121 s) + ✓ runs with Redis absent (in-memory blacklist/revocation fallback) + ✓ register → login → authenticated GET → refresh → logout, then the logged-out token is rejected (269 ms) + ✓ reusing a rotated refresh token after the 10s grace window revokes every session (238 ms) + ✓ rejects a cookie-only state-changing request without the CSRF header (236 ms) + ✓ ignores a client-supplied candidateId (IDOR) (235 ms) + ✓ answers an unknown route with 404 in the standard error shape (5 ms) + +Test Suites: 1 passed, 1 total +Tests: 6 passed, 6 total +Snapshots: 0 total +Time: 5.186 s +Ran all test suites matching /src\/__tests__\/integration\/auth.http.test.ts/i. +Jest did not exit one second after the test run has completed. +``` +`npm test`: +``` +Test Suites: 74 passed, 74 total +Tests: 790 passed, 790 total +``` +(no `FAIL` lines in the grep of `^(Tests:|Test Suites:|FAIL)`) + +Build / typecheck: +``` +build exit 0 +tsc exit 0 +``` +Lint: +``` +✖ 273 problems (273 errors, 0 warnings) +``` +Changed files (`npx eslint src/server.ts src/__tests__/integration/auth.http.test.ts`): +``` + 7:1 error A `require()` style import is forbidden @typescript-eslint/no-require-imports + 8:1 error A `require()` style import is forbidden @typescript-eslint/no-require-imports + 146:5 error Promises must be awaited, ... @typescript-eslint/no-floating-promises + 146:5 error Expected an assignment or function call and instead saw an expression @typescript-eslint/no-unused-expressions +✖ 4 problems (4 errors, 0 warnings) +``` +Same file on `staging` (before): +``` + 7:1 error ... no-require-imports + 8:1 error ... no-require-imports + 144:5 error ... no-floating-promises + 144:5 error ... no-unused-expressions + 150:1 error ... no-floating-promises +✖ 5 problems (5 errors, 0 warnings) +``` +→ all 4 remaining are pre-existing (lines 7/8 module-alias requires, `isConnected && runServer(...)` moved 144→146); the 5th (`startServer();` floating) is gone. Test file: 0 problems. + +Smoke: +``` +[MongoDB] Connect failed !!! MongooseServerSelectionError: connect ECONNREFUSED 127.0.0.1:1 +``` +(direct run still reaches `startServer` → `connectMongo`) +``` +imported, no start +``` +(import alone starts nothing) + +First run (before fixing the test itself) failed 2/6 — CSRF test got 401 (same-second access-token collision with a token blacklisted by the logout test, see Noticed #1) and IDOR create got 400 `_id` required (Joi `_id` is required-but-nullable → body sends `_id: null`). Both were test-setup errors, fixed by one user per flow + `_id: null`; no app code changed for them. + +## Acceptance +| Criterion | Evidence | +|---|---| +| 1. register→login→GET→refresh→logout, token rejected after | `✓ register → login → authenticated GET → refresh → logout, then the logged-out token is rejected` (asserts GET 401 `TOKEN_REVOKED`, refresh 401 `TOKEN_REVOKED`) | +| 2. rotated refresh reuse after grace revokes all sessions | `✓ reusing a rotated refresh token after the 10s grace window revokes every session` (reuse 401; both access tokens 401; rotated refresh 401 `TOKEN_REVOKED`) | +| 3. cookie-only state-changing request w/o CSRF → 403 | `✓ rejects a cookie-only state-changing request without the CSRF header` (403 `CSRF_TOKEN_INVALID`, `countDocuments` 0) | +| 4. client `candidateId` ignored | `✓ ignores a client-supplied candidateId (IDOR)` (stored `candidateId` = caller's id, not the body's) | +| 5. unknown route → 404 standard shape | `✓ answers an unknown route with 404 in the standard error shape` | +| 6. Redis absent → in-memory fallback | `✓ runs with Redis absent ...` (`isRedisAvailable()` false) + criteria 1–3 pass with no Redis initialised | +| Full suite green | `Tests: 790 passed, 790 total` | +| Typecheck (`inside Build`) | `build exit 0`, `tsc exit 0` | +| Lint ≤ 274, none new in changed files | `✖ 273 problems`; changed files 4 vs 5 on staging, all pre-existing | +| Entry point unchanged | smoke: direct run → `[MongoDB] Connect failed ... ECONNREFUSED 127.0.0.1:1`; import → `imported, no start` | +| comments per code-comments.md | Added: `/** */` JSDoc on exported `createApp` (WHY: tests drive it); `//` on the `require.main` guard (WHY: import must not connect/bind/install handlers); test `//` notes on one-user-per-flow (jti trap), `memStore.clear()` (shared 127.0.0.1 bucket), revocation predating. Moved unchanged: the `unhandledRejection` safety-net comment. No `(#N)` refs. | + +## Supersedes: none +`grep "#463"` on the active diagram → only this node. + +## Still open: none + +## Review +`/code-review medium` (background fork) — 9 findings: +1. Access tokens lack `jti` → same-second tokens identical, logout blacklists another session → real pre-existing prod bug, not introduced here → `## Noticed, not done` #1. +2. Reuse test didn't assert the rotated refresh token is rejected → **fixed** (added refresh with `newRefresh` → 401 `TOKEN_REVOKED`). +3. Tests sat just under the shared authLimiter bucket → **fixed** (`beforeEach(() => memStore.clear())`, `memStore` already exported). +4. Real Winston logger writes to `logs/` and floods console → **fixed** (`jest.mock('@/logger')`, same as `errors.test.ts`). +5. Importing `server.ts` runs `dotenv.config()` + registers `unhandledRejection` → handler **fixed** (moved under the `require.main` guard); dotenv part false positive — `src/config/process.config.ts:6` already `import 'dotenv/config'` on any import, so moving server's call changes nothing. +6. Redis-absent assertion is tautological → kept intentionally as a precondition guard: it fails if `createApp()` ever starts initialising Redis, which would silently stop the suite from covering the fallback path the issue asks for. +7. `mongodb-memory-server` postinstall downloads a mongod binary on `npm ci` (Docker deps stage, CI) → `## Noticed, not done` #2. +8. `CLAUDE.md` names `runServer` for middleware order → **fixed** (`createApp`). +9. Sequential bcrypt registers → **fixed** (`Promise.all`). +Re-ran step 5 after fixes (Output above is the post-fix run). No `security` label → no `/security-review`. + +## Noticed, not done +1. **Access tokens have no `jti`** (`src/auth/auth.service.ts` `handlerLogin`, `src/auth/auth.controller.ts:167` `authRefreshToken`): two access tokens for one candidate signed in the same second are byte-identical, so logout on one device (or a refresh in the same second as login) blacklists the other device's token → 401 `TOKEN_REVOKED`. Reproduced by this suite's first run. Fix = `jti: crypto.randomUUID()` in the access payload like refresh tokens. Suggest its own issue/node (`fix-access-token-jti`). +2. `mongodb-memory-server` has a postinstall that downloads mongod on `npm ci` (CI, Docker `deps` stage). Locally it was blocked by npm `allow-scripts` and the binary downloaded lazily on first `MongoMemoryServer.create()`. Option: `MONGOMS_DISABLE_POSTINSTALL=1` in the Dockerfile deps stage, or `mongodb-memory-server-core`. CI run on GitHub not observed yet. +3. `withTimeout` (`src/utils/timeout.ts:21`) never clears its timer when no `signal` is passed → each DB call leaves a 5s timer; cause of Jest's "did not exit one second after" (process exits within ~5s). Pre-existing. + +## Seal gate +No outward-facing action (no commit/push). `gh issue develop` created the remote branch ref as part of `/todo` Step 0. diff --git a/agent-hub/evidence/implementer/2026-11-18/auth-http-integration-tests-plan.md b/agent-hub/evidence/implementer/2026-11-18/auth-http-integration-tests-plan.md new file mode 100644 index 00000000..f45afebd --- /dev/null +++ b/agent-hub/evidence/implementer/2026-11-18/auth-http-integration-tests-plan.md @@ -0,0 +1,25 @@ +# 2026-11-18 - auth-http-integration-tests (plan) +Worker: implementer · Version: 0.1.0 · Node: `haven/diagrams/dev-loop.prime-mermaid.md` → `auth-http-integration-tests` · Task: `/todo #463` — "Add HTTP-level integration tests for the auth flow (supertest + in-memory Mongo)" + +## Hub bytes before: 97851 + +## Feature doc: doctrine/features/auth-session-tokens.md (Behavior #2, #3, #4, #5, #6, #7, #9), doctrine/features/auth-register-login.md (Behavior #1, #3, #5, #6) +Spec only — tests assert the documented behavior, no behavior change. + +## Task type +Operator picked branch type `chore` (2026-11-18, AskUserQuestion) → not a `feat`; pass 0 analyst skipped (auth area already has verified docs in `doctrine/features/INDEX.md`). + +## Acceptance (node criteria) +1. register → login → authenticated GET → refresh → logout; the logged-out access token → 401 `TOKEN_REVOKED` (session Behavior #7, acceptance row "After logout…"). +2. Reuse of a rotated refresh token > 10s after rotation → 401 and every session of that candidate revoked (Behavior #6). +3. Cookie-only state-changing request without `x-csrf-token` → 403 `CSRF_TOKEN_INVALID` (Behavior #3). +4. Client-supplied `candidateId` ignored on create (Behavior #4). +5. Unknown route → 404 `{ success:false, error:{ code:'ROUTE_NOT_FOUND', message } }`. +6. Redis never initialised → `isRedisAvailable()` false, flows above pass on the in-memory fallback (Behavior #9). +Commands: `npx jest src/__tests__/integration/auth.http.test.ts`, `npm test`, `npm run build`, `npm run lint` (≤ 274). + +## Anchors +- `src/server.ts` — `runServer` builds the app inline and `startServer()` runs on import → factor the middleware chain into exported `createApp()`, guard `startServer()` with `require.main === module`. +- `src/routers/api/v1/auth.route.ts`, `src/auth/auth.controller.ts` (refresh reuse grace `REFRESH_REUSE_GRACE_SECONDS`), `src/middlewares/verifyToken.middleware.ts`, `src/utils/tokenBlacklist.ts`, `src/utils/sessionRevocation.ts`, `src/middlewares/errors.middleware.ts` (`notFoundHandler`). +- IDOR target: `POST /api/v1/profile/create` (only `name` required). +- New dev deps: `supertest`, `@types/supertest`, `mongodb-memory-server`. diff --git a/agent-hub/evidence/verifier/2026-11-18/auth-http-integration-tests-seal.md b/agent-hub/evidence/verifier/2026-11-18/auth-http-integration-tests-seal.md new file mode 100644 index 00000000..b82394fb --- /dev/null +++ b/agent-hub/evidence/verifier/2026-11-18/auth-http-integration-tests-seal.md @@ -0,0 +1,41 @@ +# auth-http-integration-tests — verify: SEAL + +- Worker: verifier 0.1.0 · Node: `auth-http-integration-tests` (#463, branch `chore/463-auth-integration-tests`) on `haven/diagrams/dev-loop.prime-mermaid.md` +- Notes graded: `evidence/implementer/2026-11-18/auth-http-integration-tests-plan.md`, `evidence/implementer/2026-11-18/auth-http-integration-tests-diff.md` +- New PM status: **SEALED** + +## Isolation proof +Agent-tool spawn, description "verify_seal auth-http-integration-tests", dispatched by `/todo #463` pass 2 on 2026-11-18, spawn=fresh. Did not write the diff; graded the notes only (diff itself not opened). + +## Reasoning +Commands match `doctrine/MEMORY.md` (Test one file, Test, Build = Typecheck `inside Build`, Lint with baseline 274), all run from the repo root. + +| Criterion | Evidence in note | OK | +|---|---|---| +| 1. register→login→GET→refresh→logout, logged-out token rejected | `✓ register → login → authenticated GET → refresh → logout, then the logged-out token is rejected` (GET 401 `TOKEN_REVOKED`, refresh 401 `TOKEN_REVOKED`) | yes | +| 2. rotated refresh reuse >10s revokes all sessions | `✓ reusing a rotated refresh token after the 10s grace window revokes every session` (reuse 401, both access tokens 401, rotated refresh 401) | yes | +| 3. cookie-only POST without CSRF → 403 | `✓ rejects a cookie-only state-changing request without the CSRF header` (403 `CSRF_TOKEN_INVALID`, nothing written) | yes | +| 4. client `candidateId` ignored (IDOR) | `✓ ignores a client-supplied candidateId (IDOR)` | yes | +| 5. unknown route → 404 standard shape | `✓ answers an unknown route with 404 in the standard error shape` | yes | +| 6. Redis absent → in-memory fallback | `✓ runs with Redis absent (in-memory blacklist/revocation fallback)`; criteria 1-3 pass with Redis never initialised | yes | +| One-file test green | `Tests: 6 passed, 6 total` | yes | +| `npm test` green | `Test Suites: 74 passed, 74 total` / `Tests: 790 passed, 790 total` | yes | +| `npm run build` green (typecheck) | `build exit 0`, `tsc exit 0` | yes | +| Lint ≤ 274, none in changed files | `✖ 273 problems`. Changed files: test file 0; `src/server.ts` 4, all pre-existing (5 on `staging`: lines 7/8 module-alias `require`, `isConnected && runServer(...)` 144→146; the floating `startServer();` is gone). Read as "none introduced": clearing pre-existing errors would be out of scope (`SmallestDiff`). Confirmed by re-run below. | yes | +| comments per code-comments.md | row present: JSDoc on `createApp`, WHY comment on `require.main` guard, test WHY notes, no `(#N)` refs | yes | +| Feature docs (`auth-session-tokens.md` #2-#7, #9; `auth-register-login.md` #1, #3, #5, #6) | Behavior → test mapping table in the diff note; I read both docs' Behavior sections, the mapping matches. Chore, not `feat` → doc Status untouched. | yes | +| Entry point unchanged | smoke: direct run reaches `connectMongo` (`ECONNREFUSED 127.0.0.1:1`); import → `imported, no start` | yes | + +- Supersedes / Still open: `none` (grep `#463` → only this node). OK. +- Review: `/code-review medium`, 9 findings, each fixed or justified (jti bug + postinstall download moved to Noticed). No `security` label → no `/security-review` required. OK. +- Doctrine proposal: none. +- Forbidden states (5): none hit. Node exists on the active diagram; evidence present; no code in `haven/`; no own work graded; PM status only moves forward. +- Seal gate: no outward-facing action (no commit/push). OK. +- Proportionality: `src/server.ts` refactor (`createApp()` + `require.main` guard) is the minimum needed to import the app in tests; `CLAUDE.md` one-line rename keeps the doc accurate; dev deps are the three the plan names. Lockfile churn is npm's rewrite (`npm ls --all` exit 0). OK. + +## Noted for the operator (not blocking) +- Diff note "Noticed, not done" #1, access tokens have no `jti`: same-second tokens are identical, so logout on one device can revoke another device's session. This is a real pre-existing prod bug and should get its own node/issue. +- #2: the `mongodb-memory-server` postinstall downloads mongod on `npm ci` (CI and the Docker deps stage). No GitHub CI run observed yet. + +## Re-run: partial +`npx eslint src/server.ts src/__tests__/integration/auth.http.test.ts` and `git show staging:src/server.ts | npx eslint --stdin --stdin-filename src/server.ts`. Reason: the note shortened the lint messages with `...` (the output looks cut). Result matches the note exactly: after = 4 problems (7:1, 8:1, 146:5 ×2), test file clean; before = 5 problems (7:1, 8:1, 144:5 ×2, 150:1). Tests, build and full lint were not re-run. diff --git a/agent-hub/evidence/worker-runs.log b/agent-hub/evidence/worker-runs.log index ecfea64d..94b4446e 100644 --- a/agent-hub/evidence/worker-runs.log +++ b/agent-hub/evidence/worker-runs.log @@ -1,3 +1,4 @@ 2026-11-17T08:37:32Z role=verifier outcome=SEAL node=logout-refresh-token-header rerun=none spawn=fresh hub_bytes_before=97847 hub_bytes_after=97849 2026-11-17T08:46:36Z role=verifier outcome=SEAL node=auth-service-throw-apperror rerun=none spawn=fresh hub_bytes_before=97847 hub_bytes_after=97849 2026-11-18T09:00:21Z role=verifier outcome=SEAL node=hide-password-select-false rerun=none spawn=fresh hub_bytes_before=97857 hub_bytes_after=97851 +2026-11-18T09:36:07Z role=verifier outcome=SEAL node=auth-http-integration-tests rerun=partial spawn=fresh hub_bytes_before=97851 hub_bytes_after=97855 diff --git a/agent-hub/haven/diagrams/dev-loop-archive.md b/agent-hub/haven/diagrams/dev-loop-archive.md index bc2285f4..772ee9b6 100644 --- a/agent-hub/haven/diagrams/dev-loop-archive.md +++ b/agent-hub/haven/diagrams/dev-loop-archive.md @@ -188,3 +188,4 @@ | `auth-service-throw-apperror` | SEALED | #460 — `src/auth/auth.service.ts` returns `{ success:false }` (register/verify-email/login/reset-password) instead of throwing `AppError` subclasses; controller branches on it. Acceptance: (1) `grep -n "success: false" src/auth/auth.service.ts` empty and the controller no longer branches on a service `success` flag; (2) contract tests assert `{ success:false, error:{ code, message } }` + status for invalid reset/verify tokens (400 `BAD_REQUEST`); (3) behavior per `features/auth-register-login.md` #2/#5 and `features/auth-password-reset.md` (409 `EMAIL_EXISTS`, 401 `INVALID_CREDENTIALS`, 400 on bad token) unchanged; (4) `npm test` + `npm run build` green, lint ≤ baseline with none in touched files. Plan: `evidence/implementer/2026-11-17/auth-service-throw-apperror-plan.md`. | | `logout-refresh-token-header` | SEALED | #475 — `authLogout` (`src/auth/auth.controller.ts`) looks up `refreshToken` via `extractTokenFromRequest`, which returns the `Authorization` header first, so it blacklists the access token twice and the real refresh token stays valid. Fix: that lookup skips the header (body/query/cookie only); `/auth/refresh` keeps header support (operator, 2026-11-17). Acceptance: new unit test logout with `Bearer ` + body `refreshToken` blacklists both; `npm test` + `npm run build` green; lint ≤ baseline, none in touched files; matches `features/auth-session-tokens.md` Behavior #7 (as amended). | | `hide-password-select-false` | SEALED | GitHub issue #459. `src/models/candidate.model.ts:25` — `password` returned by default, every query must remember `.select('-password')` (#152 regressed exactly this). Fix: `select: false` on the schema; opt in with `.select('+password')` only where the hash is compared (`auth.service.ts` `handlerLogin`; reset writes via `updateOne`, needs no read). Acceptance: (1) login reads the hash via `+password` — `npx jest src/__tests__/auth/auth.service.test.ts` green; (2) new test: a plain `CandidateModel.findById()` query sends a projection excluding `password` — `npx jest src/__tests__/models/candidatePassword.test.ts` green; (3) `npm test` + `npm run build` green, lint ≤ baseline with none in changed files. SEALED 2026-11-18 after independent verifier pass (audit-only, no re-run). Evidence: `evidence/implementer/2026-11-18/hide-password-select-false.md`, `evidence/verifier/2026-11-18/hide-password-select-false-seal.md`. | +| `auth-http-integration-tests` | SEALED | #463 — HTTP-level supertest + mongodb-memory-server tests over the real `runServer` middleware chain (`src/server.ts`, app factored into an exported `createApp()`): register→login→GET→refresh→logout (token rejected after); rotated refresh reuse >10s revokes all sessions; cookie-only POST without CSRF → 403; client `candidateId` ignored (IDOR); unknown route → 404 standard error shape; Redis absent (in-memory fallback). Accept: `npx jest src/__tests__/integration/auth.http.test.ts` + `npm test` + `npm run build` green; lint ≤ 274 baseline, none in changed files. SEALED 2026-11-18 after independent verifier pass (partial re-run: eslint on changed files). Evidence: `evidence/implementer/2026-11-18/auth-http-integration-tests-diff.md`, `evidence/verifier/2026-11-18/auth-http-integration-tests-seal.md`. | diff --git a/agent-hub/haven/diagrams/dev-loop.prime-mermaid.md b/agent-hub/haven/diagrams/dev-loop.prime-mermaid.md index b5beb8ea..c553722f 100644 --- a/agent-hub/haven/diagrams/dev-loop.prime-mermaid.md +++ b/agent-hub/haven/diagrams/dev-loop.prime-mermaid.md @@ -64,7 +64,6 @@ flowchart TD | `fix-refresh-token-expiry-unused` | PENDING | `TOKEN_EXP_IN` (`.env`, already exported in config) is never used at any `jwtSign()` call site (`auth.service.ts`, `auth.controller.ts`, `api/v1/auth/services/login.ts`) — access and refresh tokens always share the same default 1h expiry, so the refresh token is pointless. | | `ci-lint-ratchet` | SEALED | 2026-11-16 — archived, see `haven/diagrams/dev-loop-archive.md`. Evidence: `evidence/verifier/2026-11-16/ci-lint-ratchet-seal.md`. | | `job-applications-status-transitions` | SEALED | 2026-11-15 — archived, see `haven/diagrams/dev-loop-archive.md`. Evidence: `evidence/verifier/2026-11-15/job-applications-status-transitions-seal.md`. | -| `parsed-entries-bulk-shape` | SEALED | 2026-11-08 — archived, see `haven/diagrams/dev-loop-archive.md`. Evidence: `evidence/verifier/2026-11-08/parsed-entries-bulk-shape-seal.md`. | | `short-values-validation` | SEALED | 2026-11-08 — archived, see `haven/diagrams/dev-loop-archive.md`. Evidence: `evidence/verifier/2026-11-08/short-values-validation-seal-r2.md`. | | `paginate-visits` | SEALED | 2026-11-09 — archived, see `haven/diagrams/dev-loop-archive.md`. Evidence: `evidence/verifier/2026-11-09/paginate-visits-seal.md`. | | `search-in-profile-only` | SEALED | 2026-11-09 — archived, see `haven/diagrams/dev-loop-archive.md`. Evidence: `evidence/verifier/2026-11-09/search-in-profile-only-seal.md`. | @@ -81,3 +80,4 @@ flowchart TD | `contributing-kit-template` | SEALED | 2026-11-16 — archived, see `haven/diagrams/dev-loop-archive.md`. Evidence: `evidence/verifier/2026-11-16/contributing-kit-template-seal.md`. | | `auth-service-throw-apperror` | SEALED | 2026-11-17 — archived, see `haven/diagrams/dev-loop-archive.md`. Evidence: `evidence/verifier/2026-11-17/auth-service-throw-apperror-seal.md`. | | `hide-password-select-false` | SEALED | 2026-11-18 — archived, see `haven/diagrams/dev-loop-archive.md`. Evidence: `evidence/verifier/2026-11-18/hide-password-select-false-seal.md`. | +| `auth-http-integration-tests` | SEALED | 2026-11-18 — archived, see `haven/diagrams/dev-loop-archive.md`. Evidence: `evidence/verifier/2026-11-18/auth-http-integration-tests-seal.md`. | diff --git a/package-lock.json b/package-lock.json index 2e81fe52..f0081410 100644 --- a/package-lock.json +++ b/package-lock.json @@ -48,11 +48,14 @@ "@types/multer": "^2.2.0", "@types/node": "^20.14.12", "@types/pdf-parse": "^1.1.5", + "@types/supertest": "^7.2.1", "@types/swagger-jsdoc": "^6.0.4", "@types/swagger-ui-express": "^4.1.8", "eslint": "^9.39.5", "jest": "^29.7.0", + "mongodb-memory-server": "^11.3.0", "nodemon": "^3.1.0", + "supertest": "^7.3.2", "ts-jest": "^29.2.5", "ts-node": "^10.9.2", "tsconfig-paths": "^4.2.0", @@ -1475,30 +1478,6 @@ "node-pre-gyp": "bin/node-pre-gyp" } }, - "node_modules/@mapbox/node-pre-gyp/node_modules/make-dir": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.1.0.tgz", - "integrity": "sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw==", - "license": "MIT", - "dependencies": { - "semver": "^6.0.0" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/@mapbox/node-pre-gyp/node_modules/make-dir/node_modules/semver": { - "version": "6.3.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", - "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", - "license": "ISC", - "bin": { - "semver": "bin/semver.js" - } - }, "node_modules/@mapbox/node-pre-gyp/node_modules/semver": { "version": "7.6.3", "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.3.tgz", @@ -1512,14 +1491,37 @@ } }, "node_modules/@mongodb-js/saslprep": { - "version": "1.1.9", - "resolved": "https://registry.npmjs.org/@mongodb-js/saslprep/-/saslprep-1.1.9.tgz", - "integrity": "sha512-tVkljjeEaAhCqTzajSdgbQ6gE6f3oneVwa3iXR6csiEwXXOFsiC6Uh9iAjAhXPtqa/XMDHWjjeNH/77m/Yq2dw==", + "version": "1.6.3", + "resolved": "https://registry.npmjs.org/@mongodb-js/saslprep/-/saslprep-1.6.3.tgz", + "integrity": "sha512-aHGFvT95c82CoQ7hb6qXpz8Hcc5PJb3ZtQ+P01QDBbyQday0mjcrJPeNJOHCgWe0pGX0zKmKP+1mWi/I/BCX9Q==", "license": "MIT", "dependencies": { "sparse-bitfield": "^3.0.3" } }, + "node_modules/@noble/hashes": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.8.0.tgz", + "integrity": "sha512-jCs9ldd7NwzpgXDIf6P3+NrHh9/sD6CQdxHyjQI+h/6rDNo88ypBxxz45UDuZHz9r3tNz7N/VInSVoVdtXEI4A==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^14.21.3 || >=16" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/@paralleldrive/cuid2": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/@paralleldrive/cuid2/-/cuid2-2.3.1.tgz", + "integrity": "sha512-XO7cAxhnTZl0Yggq6jOgjiOHhbgcO4NqFqwSmQpjK3b6TEE6Uj/jfSk6wzYyemh3+I0sHirKSetjQwn5cZktFw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@noble/hashes": "^1.1.5" + } + }, "node_modules/@pdf-lib/standard-fonts": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/@pdf-lib/standard-fonts/-/standard-fonts-1.0.0.tgz", @@ -1844,6 +1846,13 @@ "@types/express": "*" } }, + "node_modules/@types/cookiejar": { + "version": "2.1.5", + "resolved": "https://registry.npmjs.org/@types/cookiejar/-/cookiejar-2.1.5.tgz", + "integrity": "sha512-he+DHOWReW0nghN24E1WUqM0efK4kI9oTqDm6XmK8ZPe2djZ90BSNdGnIyCLzCPw7/pogPlGbzI2wHGGmi4O/Q==", + "dev": true, + "license": "MIT" + }, "node_modules/@types/cors": { "version": "2.8.17", "resolved": "https://registry.npmjs.org/@types/cors/-/cors-2.8.17.tgz", @@ -1965,6 +1974,13 @@ "@types/node": "*" } }, + "node_modules/@types/methods": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/@types/methods/-/methods-1.1.4.tgz", + "integrity": "sha512-ymXWVrDiCxTBE3+RIrrP533E70eA+9qu7zdWoHuOmGujkYtzf4HQF96b8nwHLqhuf4ykX61IGRIB38CC6/sImQ==", + "dev": true, + "license": "MIT" + }, "node_modules/@types/mime": { "version": "1.3.5", "resolved": "https://registry.npmjs.org/@types/mime/-/mime-1.3.5.tgz", @@ -2046,6 +2062,30 @@ "dev": true, "license": "MIT" }, + "node_modules/@types/superagent": { + "version": "8.1.11", + "resolved": "https://registry.npmjs.org/@types/superagent/-/superagent-8.1.11.tgz", + "integrity": "sha512-KA7srSW/HENDtOw9DOqaFLgWuMqN9WgjEw62lh9dpvRaZDkhdOkazASd7X7i2eMUYLHa1U37ZttnePsH5zTDHw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/cookiejar": "^2.1.5", + "@types/methods": "^1.1.4", + "@types/node": "*", + "form-data": "^4.0.0" + } + }, + "node_modules/@types/supertest": { + "version": "7.2.1", + "resolved": "https://registry.npmjs.org/@types/supertest/-/supertest-7.2.1.tgz", + "integrity": "sha512-4CbBvoYVLHL7+yhbYrZET0vsvuyXTC05aRe7dNQkwMzm56auceoy6Yu3K50uZmwfHna1os3CMSgM/3QVkUtPTw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/methods": "^1.1.4", + "@types/superagent": "^8.1.0" + } + }, "node_modules/@types/swagger-jsdoc": { "version": "6.0.4", "resolved": "https://registry.npmjs.org/@types/swagger-jsdoc/-/swagger-jsdoc-6.0.4.tgz", @@ -2599,6 +2639,13 @@ "integrity": "sha512-PCVAQswWemu6UdxsDFFX/+gVeYqKAod3D3UVm91jHwynguOwAvYPhx8nNlM++NqRcK6CxxpUafjmhIdKiHibqg==", "license": "MIT" }, + "node_modules/asap": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/asap/-/asap-2.0.6.tgz", + "integrity": "sha512-BSHWgDSAiKs50o2Re8ppvp3seVHXSRM44cdSsT9FfNEUUZLOGWVCsiWaRPWM1Znn+mqZ1OfVZ3z3DWEzSp7hRA==", + "dev": true, + "license": "MIT" + }, "node_modules/ast-types": { "version": "0.13.4", "resolved": "https://registry.npmjs.org/ast-types/-/ast-types-0.13.4.tgz", @@ -2617,11 +2664,36 @@ "integrity": "sha512-htCUDlxyyCLMgaM3xXg0C0LW2xqfuQ6p05pCEIsXuyQ+a1koYKTuBMzRNwmybfLgvJDMd0r1LTn4+E0Ti6C2AA==", "license": "MIT" }, + "node_modules/async-mutex": { + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/async-mutex/-/async-mutex-0.5.0.tgz", + "integrity": "sha512-1A94B18jkJ3DYq284ohPxoXbfTA5HsQ7/Mf4DEhcyLx3Bz27Rh59iScbB6EPiP+B+joue6YCxcMXSbFC1tZKwA==", + "dev": true, + "license": "MIT", + "dependencies": { + "tslib": "^2.4.0" + } + }, + "node_modules/asynckit": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", + "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==", + "dev": true, + "license": "MIT" + }, "node_modules/b4a": { - "version": "1.6.7", - "resolved": "https://registry.npmjs.org/b4a/-/b4a-1.6.7.tgz", - "integrity": "sha512-OnAYlL5b7LEkALw87fUVafQw5rVR9RjwGd4KUwNQ6DrrNmaVaUCgLipfVlzrPQ4tWOR9P0IXGNOx50jYCCdSJg==", - "license": "Apache-2.0" + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/b4a/-/b4a-1.9.0.tgz", + "integrity": "sha512-dpfcF9fDNR6++cthXR67iyhgqWy9CBouAvIWhIntzBG6cvK/cnIPiZQjBwi/ZqjjBEDGfoNDtmB0kTjroOJ3pQ==", + "license": "Apache-2.0", + "peerDependencies": { + "react-native-b4a": "*" + }, + "peerDependenciesMeta": { + "react-native-b4a": { + "optional": true + } + } }, "node_modules/babel-jest": { "version": "29.7.0", @@ -2755,12 +2827,28 @@ "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", "license": "MIT" }, + "node_modules/bare-buffer": { + "version": "3.7.3", + "resolved": "https://registry.npmjs.org/bare-buffer/-/bare-buffer-3.7.3.tgz", + "integrity": "sha512-77owW16RX6YgdOzddHtM0oGz8wsd0/F9k/0coz6TPmjUHnr/9FwWODVMNKwyYWM/a/ESdTum855nfQxnsKUygA==", + "license": "Apache-2.0", + "engines": { + "bare": ">=1.20.0" + } + }, "node_modules/bare-events": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/bare-events/-/bare-events-2.5.0.tgz", - "integrity": "sha512-/E8dDe9dsbLyh2qrZ64PEPadOQ0F4gbl1sUJOrmph7xOiIxfY8vwab/4bFLh4Y88/Hk/ujKcrQKc+ps0mv873A==", + "version": "2.9.2", + "resolved": "https://registry.npmjs.org/bare-events/-/bare-events-2.9.2.tgz", + "integrity": "sha512-AIPKioV7/Y/8KfZ3AAhjPJxLLbY49S64Ym5DakZlUg75qQiTgUq9hEJoEwa4eUezPUlXRy/i5NpsKvo9jgKmoA==", "license": "Apache-2.0", - "optional": true + "peerDependencies": { + "bare-abort-controller": "*" + }, + "peerDependenciesMeta": { + "bare-abort-controller": { + "optional": true + } + } }, "node_modules/bare-fs": { "version": "2.3.5", @@ -2792,15 +2880,48 @@ } }, "node_modules/bare-stream": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/bare-stream/-/bare-stream-2.3.2.tgz", - "integrity": "sha512-EFZHSIBkDgSHIwj2l2QZfP4U5OcD4xFAOwhSb/vlr9PIqyGJGvB/nfClJbcnh3EY4jtPE4zsb5ztae96bVF79A==", + "version": "2.13.4", + "resolved": "https://registry.npmjs.org/bare-stream/-/bare-stream-2.13.4.tgz", + "integrity": "sha512-PcrQ8lVLbiJscNm1Kez+Yp4Gy4AHGcN1lzwjvf5NybWen7VvEgUfyfnXYJ2zNqWnzOfCb1Abq6lH8ti0syQszA==", + "license": "Apache-2.0", + "dependencies": { + "b4a": "^1.8.1", + "streamx": "^2.25.0", + "teex": "^1.0.1" + }, + "peerDependencies": { + "bare-abort-controller": "*", + "bare-buffer": "*", + "bare-events": "*" + }, + "peerDependenciesMeta": { + "bare-abort-controller": { + "optional": true + }, + "bare-buffer": { + "optional": true + }, + "bare-events": { + "optional": true + } + } + }, + "node_modules/bare-url": { + "version": "2.5.8", + "resolved": "https://registry.npmjs.org/bare-url/-/bare-url-2.5.8.tgz", + "integrity": "sha512-G5KTe5Bj6z5pqIxcn3lWlIFIv0rkXbccx0T0Xuf7t4RapfSWvFlcVbrwYXxFZ00PC4lp57OCIk6uXP/r3GbpDw==", "license": "Apache-2.0", - "optional": true, "dependencies": { - "streamx": "^2.20.0" + "bare-buffer": "^3.0.0", + "bare-path": "^3.0.0" } }, + "node_modules/bare-url/node_modules/bare-path": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/bare-path/-/bare-path-3.1.3.tgz", + "integrity": "sha512-8r+FVU/o4zcFmpCDqbqAYhHHbtXPP+cyZKo7DRGRWc7OLlNs4TMaSQEpXL/sIdzyEG0M7RHw4B7xYMGrTc+qrg==", + "license": "Apache-2.0" + }, "node_modules/base64-js": { "version": "1.5.1", "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", @@ -3049,17 +3170,27 @@ "node": ">= 0.8" } }, - "node_modules/call-bind": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.7.tgz", - "integrity": "sha512-GHTSNSYICQ7scH7sZ+M2rFopRoLh8t2bLSW6BbgrtLsahOIB5iyAVJf9GjWK3cYTDaMj4XdBpM1cA6pIS0Kv2w==", + "node_modules/call-bind-apply-helpers": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.2.tgz", + "integrity": "sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==", "license": "MIT", "dependencies": { - "es-define-property": "^1.0.0", "es-errors": "^1.3.0", - "function-bind": "^1.1.2", - "get-intrinsic": "^1.2.4", - "set-function-length": "^1.2.1" + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/call-bound": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/call-bound/-/call-bound-1.0.4.tgz", + "integrity": "sha512-+ys997U96po4Kx/ABpBCqhA9EuxJaQWDQg7295H4hBphv3IZg0boBKuwYpt4YXp6MZ5AmZQnU/tyMTlRpaSejg==", + "license": "MIT", + "dependencies": { + "call-bind-apply-helpers": "^1.0.2", + "get-intrinsic": "^1.3.0" }, "engines": { "node": ">= 0.4" @@ -3334,6 +3465,36 @@ "node": ">=12.20" } }, + "node_modules/combined-stream": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", + "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", + "dev": true, + "license": "MIT", + "dependencies": { + "delayed-stream": "~1.0.0" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/commondir": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/commondir/-/commondir-1.0.1.tgz", + "integrity": "sha512-W9pAhw0ja1Edb5GVdIF1mjZw/ASI0AlShXM83UUGe2DVr5TdAPEA1OA8m/g8zWp9x6On7gqufY+FatDbC3MDQg==", + "dev": true, + "license": "MIT" + }, + "node_modules/component-emitter": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.3.1.tgz", + "integrity": "sha512-T0+barUSQRTUQASh8bx02dl+DhF54GtIDY13Y3m9oWTklKbb3Wv974meRpeZ3lp1JpLVECWWNHC4vaG2XHXouQ==", + "dev": true, + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/concat-map": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", @@ -3426,6 +3587,13 @@ "integrity": "sha512-QADzlaHc8icV8I7vbaJXJwod9HWYp8uCqf1xa4OfNu1T7JVxQIrUgOWtHdNDtPiywmFbiS12VjotIXLrKM3orQ==", "license": "MIT" }, + "node_modules/cookiejar": { + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/cookiejar/-/cookiejar-2.1.4.tgz", + "integrity": "sha512-LDx6oHrK+PhzLKJU9j5S7/Y3jM/mUHvD/DeI1WQmJn652iPC5Y4TBzC9l+5OMOXlyTTA+SmVUPm0HQUwpD5Jqw==", + "dev": true, + "license": "MIT" + }, "node_modules/core-util-is": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.3.tgz", @@ -3584,23 +3752,6 @@ "node": ">=0.10.0" } }, - "node_modules/define-data-property": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/define-data-property/-/define-data-property-1.1.4.tgz", - "integrity": "sha512-rBMvIzlpA8v6E+SJZoo++HAYqsLrkg7MSfIinMPFhmkorw7X+dOXVJQs+QT69zGkzMyfDnIMN2Wid1+NbL3T+A==", - "license": "MIT", - "dependencies": { - "es-define-property": "^1.0.0", - "es-errors": "^1.3.0", - "gopd": "^1.0.1" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/degenerator": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/degenerator/-/degenerator-5.0.1.tgz", @@ -3615,6 +3766,16 @@ "node": ">= 14" } }, + "node_modules/delayed-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.4.0" + } + }, "node_modules/delegates": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/delegates/-/delegates-1.0.0.tgz", @@ -3665,6 +3826,17 @@ "integrity": "sha512-DPnhUXvmvKT2dFA/j7B+riVLUt9Q6RKJlcppojL5CoRywJJKLDYnRlw0gTFKfgDPHP5E04UoB71SxoJlVZy8FA==", "license": "BSD-3-Clause" }, + "node_modules/dezalgo": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/dezalgo/-/dezalgo-1.0.4.tgz", + "integrity": "sha512-rXSP0bf+5n0Qonsb+SVVfNfIsimO4HEtmnIpPHY8Q1UCzKlQrDMfdobr8nJOOsRgWCyMRqeSBQzmWUMq7zvVig==", + "dev": true, + "license": "ISC", + "dependencies": { + "asap": "^2.0.0", + "wrappy": "1" + } + }, "node_modules/diff": { "version": "4.0.2", "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz", @@ -3741,6 +3913,20 @@ "url": "https://dotenvx.com" } }, + "node_modules/dunder-proto": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz", + "integrity": "sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==", + "license": "MIT", + "dependencies": { + "call-bind-apply-helpers": "^1.0.1", + "es-errors": "^1.3.0", + "gopd": "^1.2.0" + }, + "engines": { + "node": ">= 0.4" + } + }, "node_modules/ecdsa-sig-formatter": { "version": "1.0.11", "resolved": "https://registry.npmjs.org/ecdsa-sig-formatter/-/ecdsa-sig-formatter-1.0.11.tgz", @@ -3841,13 +4027,10 @@ } }, "node_modules/es-define-property": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.0.tgz", - "integrity": "sha512-jxayLKShrEqqzJ0eumQbVhTYQM27CfT1T35+gCgDFoL82JLsXqTJ76zv6A0YLOgEnLUMvLzsDsGIrl8NFpT2gQ==", + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.1.tgz", + "integrity": "sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==", "license": "MIT", - "dependencies": { - "get-intrinsic": "^1.2.4" - }, "engines": { "node": ">= 0.4" } @@ -3861,6 +4044,34 @@ "node": ">= 0.4" } }, + "node_modules/es-object-atoms": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/es-object-atoms/-/es-object-atoms-1.1.2.tgz", + "integrity": "sha512-HWcBoN6NileqtSydK2FqHbS/LoDd2pqrnQHLyJzBj4kOp/ky2MWMN694xOfkK8/SnUsW2DH7EfyVlydKCsm1Zw==", + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-set-tostringtag": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/es-set-tostringtag/-/es-set-tostringtag-2.1.0.tgz", + "integrity": "sha512-j6vWzfrGVfyXxge+O0x5sh6cvxAog0a/4Rdd2K36zCMV5eJ+/+tOAngRO8cODMNWbVRdVlmGZQL2YS3yR8bIUA==", + "dev": true, + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.6", + "has-tostringtag": "^1.0.2", + "hasown": "^2.0.2" + }, + "engines": { + "node": ">= 0.4" + } + }, "node_modules/escalade": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.2.0.tgz", @@ -4141,6 +4352,15 @@ "node": ">= 0.6" } }, + "node_modules/events-universal": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/events-universal/-/events-universal-1.0.1.tgz", + "integrity": "sha512-LUd5euvbMLpwOF8m6ivPCbhQeSiYVNb8Vs0fQ8QjXo0JTkEHpz8pxdQf0gStltaPpw0Cca8b39KxvK9cfKRiAw==", + "license": "Apache-2.0", + "dependencies": { + "bare-events": "^2.7.0" + } + }, "node_modules/execa": { "version": "5.1.1", "resolved": "https://registry.npmjs.org/execa/-/execa-5.1.1.tgz", @@ -4334,6 +4554,13 @@ "dev": true, "license": "MIT" }, + "node_modules/fast-safe-stringify": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/fast-safe-stringify/-/fast-safe-stringify-2.1.1.tgz", + "integrity": "sha512-W+KJc2dmILlPplD/H4K9l9LcAHAfPtP6BY84uVLXQ6Evcz9Lcg33Y2z1IVblT6xdY54PXYVHEv+0Wpq8Io6zkA==", + "dev": true, + "license": "MIT" + }, "node_modules/fast-uri": { "version": "3.1.5", "resolved": "https://registry.npmjs.org/fast-uri/-/fast-uri-3.1.5.tgz", @@ -4476,6 +4703,24 @@ "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==", "license": "MIT" }, + "node_modules/find-cache-dir": { + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/find-cache-dir/-/find-cache-dir-3.3.2.tgz", + "integrity": "sha512-wXZV5emFEjrridIgED11OoUKLxiYjAcqot/NJdAkOhlJ+vGzwhOAfcG5OX1jP+S0PcjEn8bdMJv+g2jwQ3Onig==", + "dev": true, + "license": "MIT", + "dependencies": { + "commondir": "^1.0.1", + "make-dir": "^3.0.2", + "pkg-dir": "^4.1.0" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/avajs/find-cache-dir?sponsor=1" + } + }, "node_modules/find-up": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", @@ -4520,6 +4765,27 @@ "integrity": "sha512-GRnmB5gPyJpAhTQdSZTSp9uaPSvl09KoYcMQtsB9rQoOmzs9dH6ffeccH+Z+cv6P68Hu5bC6JjRh4Ah/mHSNRw==", "license": "MIT" }, + "node_modules/follow-redirects": { + "version": "1.16.3", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.16.3.tgz", + "integrity": "sha512-toOSoqN6d51Wjf1aOFJYcoVv1aND9rj/CwjLU0Vz40oDuSpWDayCeKe4JpL5NL0WdFvoOOCI3BRo69HahjbR1A==", + "dev": true, + "funding": [ + { + "type": "individual", + "url": "https://github.com/sponsors/RubenVerborgh" + } + ], + "license": "MIT", + "engines": { + "node": ">=4.0" + }, + "peerDependenciesMeta": { + "debug": { + "optional": true + } + } + }, "node_modules/foreground-child": { "version": "3.3.1", "resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-3.3.1.tgz", @@ -4548,6 +4814,41 @@ "url": "https://github.com/sponsors/isaacs" } }, + "node_modules/form-data": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.6.tgz", + "integrity": "sha512-vKatAh4SlVfgbv+YtmhiRjhEMJsYpsG1Y2rMQtR+SVSbytsSD1YGzDIcrAJmdFec88u/+VoGmxnl+80gL1tRCQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.8", + "es-set-tostringtag": "^2.1.0", + "hasown": "^2.0.4", + "mime-types": "^2.1.35" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/formidable": { + "version": "3.5.4", + "resolved": "https://registry.npmjs.org/formidable/-/formidable-3.5.4.tgz", + "integrity": "sha512-YikH+7CUTOtP44ZTnUhR7Ic2UASBPOqmaRkRKxRbywPTe5VxF7RRCck4af9wutiZ/QKM5nME9Bie2fFaPz5Gug==", + "dev": true, + "license": "MIT", + "dependencies": { + "@paralleldrive/cuid2": "^2.2.2", + "dezalgo": "^1.0.4", + "once": "^1.4.0" + }, + "engines": { + "node": ">=14.0.0" + }, + "funding": { + "url": "https://ko-fi.com/tunnckoCore/commissions" + } + }, "node_modules/forwarded": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz", @@ -4750,16 +5051,21 @@ } }, "node_modules/get-intrinsic": { - "version": "1.2.4", - "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.4.tgz", - "integrity": "sha512-5uYhsJH8VJBTv7oslg4BznJYhDoRI6waYCxMmCdnTrcCrHA/fCFKoTFz2JKKE0HdDFUF7/oQuhzumXJK7paBRQ==", + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.3.0.tgz", + "integrity": "sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ==", "license": "MIT", "dependencies": { + "call-bind-apply-helpers": "^1.0.2", + "es-define-property": "^1.0.1", "es-errors": "^1.3.0", + "es-object-atoms": "^1.1.1", "function-bind": "^1.1.2", - "has-proto": "^1.0.1", - "has-symbols": "^1.0.3", - "hasown": "^2.0.0" + "get-proto": "^1.0.1", + "gopd": "^1.2.0", + "has-symbols": "^1.1.0", + "hasown": "^2.0.2", + "math-intrinsics": "^1.1.0" }, "engines": { "node": ">= 0.4" @@ -4778,7 +5084,20 @@ "node": ">=8.0.0" } }, - "node_modules/get-stream": { + "node_modules/get-proto": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/get-proto/-/get-proto-1.0.1.tgz", + "integrity": "sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==", + "license": "MIT", + "dependencies": { + "dunder-proto": "^1.0.1", + "es-object-atoms": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/get-stream": { "version": "5.2.0", "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-5.2.0.tgz", "integrity": "sha512-nBF+F1rAZVCu/p7rjzgA+Yb4lfYXrpl7a6VmJrU8wF9I1CKvP/QwPNZHnOlwbTkY6dvtFIzFMSyQXbLoTQPRpA==", @@ -4853,12 +5172,12 @@ } }, "node_modules/gopd": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.0.1.tgz", - "integrity": "sha512-d65bNlIadxvpb/A2abVdlqKqV563juRnZ1Wtk6s1sIR8uNsXR70xqIzVqxVf1eTqDunwT2MkczEeaezCKTZhwA==", + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.2.0.tgz", + "integrity": "sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==", "license": "MIT", - "dependencies": { - "get-intrinsic": "^1.1.3" + "engines": { + "node": ">= 0.4" }, "funding": { "url": "https://github.com/sponsors/ljharb" @@ -4879,22 +5198,10 @@ "node": ">=8" } }, - "node_modules/has-property-descriptors": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.2.tgz", - "integrity": "sha512-55JNKuIW+vq4Ke1BjOTjM2YctQIvCT7GFzHwmfZPGo5wnrgkid0YQtnAleFSqumZm4az3n2BS+erby5ipJdgrg==", - "license": "MIT", - "dependencies": { - "es-define-property": "^1.0.0" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/has-proto": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/has-proto/-/has-proto-1.0.3.tgz", - "integrity": "sha512-SJ1amZAJUiZS+PhsVLf5tGydlaVB8EdFpaSO4gmiUKUOxk8qzn5AIy4ZeJUmh22znIdk/uMAUT2pl3FxzVUH+Q==", + "node_modules/has-symbols": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.1.0.tgz", + "integrity": "sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==", "license": "MIT", "engines": { "node": ">= 0.4" @@ -4903,11 +5210,15 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/has-symbols": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz", - "integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==", + "node_modules/has-tostringtag": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/has-tostringtag/-/has-tostringtag-1.0.2.tgz", + "integrity": "sha512-NqADB8VjPFLM2V0VvHUewwwsw0ZWBaIdgo+ieHtK3hasLz4qeCRjYcqfB6AQrBggRKppKF8L52/VqdVsO47Dlw==", + "dev": true, "license": "MIT", + "dependencies": { + "has-symbols": "^1.0.3" + }, "engines": { "node": ">= 0.4" }, @@ -4932,9 +5243,9 @@ } }, "node_modules/hasown": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz", - "integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==", + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.4.tgz", + "integrity": "sha512-T2UbfbBEF32wiepXIsMlTW9+dDYC6wMh/t/vYA4tuOMKqWz/n3vr1NFSxQiyP+zk2mXsoMA/i/7qV6LKut1t1A==", "license": "MIT", "dependencies": { "function-bind": "^1.1.2" @@ -5123,75 +5434,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/import-local/node_modules/find-up": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", - "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", - "dev": true, - "license": "MIT", - "dependencies": { - "locate-path": "^5.0.0", - "path-exists": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/import-local/node_modules/locate-path": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", - "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", - "dev": true, - "license": "MIT", - "dependencies": { - "p-locate": "^4.1.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/import-local/node_modules/p-limit": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", - "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", - "dev": true, - "license": "MIT", - "dependencies": { - "p-try": "^2.0.0" - }, - "engines": { - "node": ">=6" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/import-local/node_modules/p-locate": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", - "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", - "dev": true, - "license": "MIT", - "dependencies": { - "p-limit": "^2.2.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/import-local/node_modules/pkg-dir": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-4.2.0.tgz", - "integrity": "sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "find-up": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, "node_modules/imurmurhash": { "version": "0.1.4", "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", @@ -5220,14 +5462,10 @@ "license": "ISC" }, "node_modules/ip-address": { - "version": "9.0.5", - "resolved": "https://registry.npmjs.org/ip-address/-/ip-address-9.0.5.tgz", - "integrity": "sha512-zHtQzGojZXTwZTHQqra+ETKd4Sn3vgi7uBmlPoXVWZqYvuKmtI0l/VZTjqGmJY9x88GGOaZ9+G9ES8hC4T4X8g==", + "version": "10.7.6", + "resolved": "https://registry.npmjs.org/ip-address/-/ip-address-10.7.6.tgz", + "integrity": "sha512-00LYkM6byILa9eQIx6qoaXCM40xTLd56AZ4vyaPW3YTyb49VZYPo5xsiAq4tuQ54GH4R7gVdYScJ1B7B77PuTg==", "license": "MIT", - "dependencies": { - "jsbn": "1.1.0", - "sprintf-js": "^1.1.3" - }, "engines": { "node": ">= 12" } @@ -6575,6 +6813,21 @@ "yallist": "^3.0.2" } }, + "node_modules/make-dir": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.1.0.tgz", + "integrity": "sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw==", + "license": "MIT", + "dependencies": { + "semver": "^6.0.0" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/make-error": { "version": "1.3.6", "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz", @@ -6592,6 +6845,15 @@ "tmpl": "1.0.5" } }, + "node_modules/math-intrinsics": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/math-intrinsics/-/math-intrinsics-1.1.0.tgz", + "integrity": "sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, "node_modules/media-typer": { "version": "0.3.0", "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", @@ -6846,6 +7108,226 @@ "whatwg-url": "^13.0.0" } }, + "node_modules/mongodb-memory-server": { + "version": "11.3.0", + "resolved": "https://registry.npmjs.org/mongodb-memory-server/-/mongodb-memory-server-11.3.0.tgz", + "integrity": "sha512-8ZCDrraqKqmAikoeKuEq+16jeWdVKwjtEAuMxxeQctHiGSGYt17W9LmoRzV1Nwnz7owyxwDKMhow4IVkNYYRKw==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "dependencies": { + "mongodb-memory-server-core": "11.3.0", + "tslib": "^2.8.1" + }, + "engines": { + "node": ">=20.19.0" + } + }, + "node_modules/mongodb-memory-server-core": { + "version": "11.3.0", + "resolved": "https://registry.npmjs.org/mongodb-memory-server-core/-/mongodb-memory-server-core-11.3.0.tgz", + "integrity": "sha512-QBu/RsRpBfcNd5CrBDfCzqcaFPaYpivUzGYUy9YgVc3up78ff0gIHQVD9PLmBLOOxFX6BM9hU6YT0HocZH+s1g==", + "dev": true, + "license": "MIT", + "dependencies": { + "async-mutex": "^0.5.0", + "camelcase": "^6.3.0", + "debug": "^4.4.3", + "find-cache-dir": "^3.3.2", + "follow-redirects": "^1.16.0", + "https-proxy-agent": "^7.0.6", + "mongodb": "~7.5.0", + "new-find-package-json": "^2.0.0", + "semver": "^7.8.5", + "tar-stream": "^3.2.1", + "tslib": "^2.8.1", + "yauzl": "^3.4.0" + }, + "engines": { + "node": ">=20.19.0" + } + }, + "node_modules/mongodb-memory-server-core/node_modules/@types/whatwg-url": { + "version": "13.0.0", + "resolved": "https://registry.npmjs.org/@types/whatwg-url/-/whatwg-url-13.0.0.tgz", + "integrity": "sha512-N8WXpbE6Wgri7KUSvrmQcqrMllKZ9uxkYWMt+mCSGwNc0Hsw9VQTW7ApqI4XNrx6/SaM2QQJCzMPDEXE058s+Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/webidl-conversions": "*" + } + }, + "node_modules/mongodb-memory-server-core/node_modules/agent-base": { + "version": "7.1.4", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-7.1.4.tgz", + "integrity": "sha512-MnA+YT8fwfJPgBx3m60MNqakm30XOkyIoH1y6huTQvC0PwZG7ki8NacLBcrPbNoo8vEZy7Jpuk7+jMO+CUovTQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 14" + } + }, + "node_modules/mongodb-memory-server-core/node_modules/bson": { + "version": "7.3.4", + "resolved": "https://registry.npmjs.org/bson/-/bson-7.3.4.tgz", + "integrity": "sha512-eb33j2Ha6xgygjJ8bhI3sYaI9cLAbSaopZLRJQ5/rxk32XyBSoVVcbeHIzVGJx1SyQpyyoElkoEZgQrg+RVVoA==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=20.19.0" + } + }, + "node_modules/mongodb-memory-server-core/node_modules/camelcase": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.3.0.tgz", + "integrity": "sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/mongodb-memory-server-core/node_modules/https-proxy-agent": { + "version": "7.0.6", + "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-7.0.6.tgz", + "integrity": "sha512-vK9P5/iUfdl95AI+JVyUuIcVtd4ofvtrOr3HNtM2yxC9bnMbEdp3x01OhQNnjb8IJYi38VlTE3mBXwcfvywuSw==", + "dev": true, + "license": "MIT", + "dependencies": { + "agent-base": "^7.1.2", + "debug": "4" + }, + "engines": { + "node": ">= 14" + } + }, + "node_modules/mongodb-memory-server-core/node_modules/mongodb": { + "version": "7.5.0", + "resolved": "https://registry.npmjs.org/mongodb/-/mongodb-7.5.0.tgz", + "integrity": "sha512-5FnrEDLnvp6ycUOGLNLLU33BfCx2qmp2mJjGPDwKLruYsVzXVSK5fsGpoDXvsXJwBfBsD7ebMRdawbDxC2814g==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@mongodb-js/saslprep": "^1.4.11", + "bson": "^7.2.0", + "mongodb-connection-string-url": "^7.0.1" + }, + "engines": { + "node": ">=20.19.0" + }, + "peerDependencies": { + "@aws-sdk/credential-providers": "^3.806.0", + "@mongodb-js/zstd": "^7.0.0", + "gcp-metadata": "^7.0.1", + "kerberos": "^7.0.0", + "mongodb-client-encryption": "^7.2.0", + "snappy": "^7.3.2", + "socks": "^2.8.6" + }, + "peerDependenciesMeta": { + "@aws-sdk/credential-providers": { + "optional": true + }, + "@mongodb-js/zstd": { + "optional": true + }, + "gcp-metadata": { + "optional": true + }, + "kerberos": { + "optional": true + }, + "mongodb-client-encryption": { + "optional": true + }, + "snappy": { + "optional": true + }, + "socks": { + "optional": true + } + } + }, + "node_modules/mongodb-memory-server-core/node_modules/mongodb-connection-string-url": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/mongodb-connection-string-url/-/mongodb-connection-string-url-7.0.3.tgz", + "integrity": "sha512-5I/pX3C2gPEz1EDdYMdZwBx1b/jE/f+J+KItSUJ02uQZ66bbe7kHKjv2uqCHJWaMCagem3dyfWqoAcv+XYZ6aw==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@types/whatwg-url": "^13.0.0", + "whatwg-url": "^15.0.1" + }, + "engines": { + "node": ">=20.19.0" + } + }, + "node_modules/mongodb-memory-server-core/node_modules/semver": { + "version": "7.8.6", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.8.6.tgz", + "integrity": "sha512-9lpSSU4Mly3mrtruwLs1eLK6+gzbzqeBFwRNjIjE+9LuDpWdYctrQlQ3ej1Ilgi7gknpsTRnPoLP8DpCHqHIJw==", + "dev": true, + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/mongodb-memory-server-core/node_modules/tr46": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-6.0.0.tgz", + "integrity": "sha512-bLVMLPtstlZ4iMQHpFHTR7GAGj2jxi8Dg0s2h2MafAE4uSWF98FC/3MomU51iQAMf8/qDUbKWf5GxuvvVcXEhw==", + "dev": true, + "license": "MIT", + "dependencies": { + "punycode": "^2.3.1" + }, + "engines": { + "node": ">=20" + } + }, + "node_modules/mongodb-memory-server-core/node_modules/webidl-conversions": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-8.0.1.tgz", + "integrity": "sha512-BMhLD/Sw+GbJC21C/UgyaZX41nPt8bUTg+jWyDeg7e7YN4xOM05YPSIXceACnXVtqyEw/LMClUQMtMZ+PGGpqQ==", + "dev": true, + "license": "BSD-2-Clause", + "engines": { + "node": ">=20" + } + }, + "node_modules/mongodb-memory-server-core/node_modules/whatwg-url": { + "version": "15.1.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-15.1.0.tgz", + "integrity": "sha512-2ytDk0kiEj/yu90JOAp44PVPUkO9+jVhyf+SybKlRHSDlvOOZhdPIrr7xTH64l4WixO2cP+wQIcgujkGBPPz6g==", + "dev": true, + "license": "MIT", + "dependencies": { + "tr46": "^6.0.0", + "webidl-conversions": "^8.0.0" + }, + "engines": { + "node": ">=20" + } + }, + "node_modules/mongodb-memory-server-core/node_modules/yauzl": { + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/yauzl/-/yauzl-3.4.0.tgz", + "integrity": "sha512-jIH9yLR9wqr0wOS0TpBvo/g/2UgZH5qePVbjgRliiF0BYvOZyaBknKsF+x9Iht0O6sqgnB93rCICdOZFecJuDw==", + "dev": true, + "license": "MIT", + "dependencies": { + "pend": "~1.2.0" + }, + "engines": { + "node": ">=12" + } + }, "node_modules/mongoose": { "version": "8.8.1", "resolved": "https://registry.npmjs.org/mongoose/-/mongoose-8.8.1.tgz", @@ -6957,6 +7439,19 @@ "node": ">= 0.4.0" } }, + "node_modules/new-find-package-json": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/new-find-package-json/-/new-find-package-json-2.0.0.tgz", + "integrity": "sha512-lDcBsjBSMlj3LXH2v/FW3txlh2pYTjmbOXPYJD93HI5EwuLzI11tdHSIpUMmfq/IOsldj4Ps8M8flhm+pCK4Ew==", + "dev": true, + "license": "MIT", + "dependencies": { + "debug": "^4.3.4" + }, + "engines": { + "node": ">=12.22.0" + } + }, "node_modules/node-addon-api": { "version": "5.1.0", "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-5.1.0.tgz", @@ -7160,9 +7655,9 @@ } }, "node_modules/object-inspect": { - "version": "1.13.3", - "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.3.tgz", - "integrity": "sha512-kDCGIbxkDSXE3euJZZXzc6to7fCrKHNI/hSRQnRuQ+BWjFNzZwiFF8fj/6o2t2G9/jTj8PSIYTfCLelLZEeRpA==", + "version": "1.13.4", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.4.tgz", + "integrity": "sha512-W67iLl4J2EXEGTbfeHCffrjDfitvLANg0UlX3wFUUSTx92KXRFegMHUVgSqE+wvhAbi4WqjGg9czysTV2Epbew==", "license": "MIT", "engines": { "node": ">= 0.4" @@ -7502,6 +7997,75 @@ "node": ">= 6" } }, + "node_modules/pkg-dir": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-4.2.0.tgz", + "integrity": "sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "find-up": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/pkg-dir/node_modules/find-up": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", + "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", + "dev": true, + "license": "MIT", + "dependencies": { + "locate-path": "^5.0.0", + "path-exists": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/pkg-dir/node_modules/locate-path": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", + "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", + "dev": true, + "license": "MIT", + "dependencies": { + "p-locate": "^4.1.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/pkg-dir/node_modules/p-limit": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", + "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", + "dev": true, + "license": "MIT", + "dependencies": { + "p-try": "^2.0.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/pkg-dir/node_modules/p-locate": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", + "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", + "dev": true, + "license": "MIT", + "dependencies": { + "p-limit": "^2.2.0" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/prelude-ls": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", @@ -7734,12 +8298,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/queue-tick": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/queue-tick/-/queue-tick-1.0.1.tgz", - "integrity": "sha512-kJt5qhMxoszgU/62PLP1CJytzd2NKetjSRnyuj31fDd3Rlcz3fzlFdFLD1SItunPwyqEOkca6GbV612BWfaBag==", - "license": "MIT" - }, "node_modules/range-parser": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz", @@ -7957,7 +8515,6 @@ "version": "6.3.1", "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", - "dev": true, "license": "ISC", "bin": { "semver": "bin/semver.js" @@ -8032,23 +8589,6 @@ "integrity": "sha512-KiKBS8AnWGEyLzofFfmvKwpdPzqiy16LvQfK3yv/fVH7Bj13/wl3JSR1J+rfgRE9q7xUJK4qvgS8raSOeLUehw==", "license": "ISC" }, - "node_modules/set-function-length": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/set-function-length/-/set-function-length-1.2.2.tgz", - "integrity": "sha512-pgRc4hJ4/sNjWCSS9AmnS40x3bNMDTknHgL5UaMBTMyJnU90EgWh1Rz+MC9eFu4BuN/UwZjKQuY/1v3rM7HMfg==", - "license": "MIT", - "dependencies": { - "define-data-property": "^1.1.4", - "es-errors": "^1.3.0", - "function-bind": "^1.1.2", - "get-intrinsic": "^1.2.4", - "gopd": "^1.0.1", - "has-property-descriptors": "^1.0.2" - }, - "engines": { - "node": ">= 0.4" - } - }, "node_modules/setimmediate": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/setimmediate/-/setimmediate-1.0.5.tgz", @@ -8083,15 +8623,69 @@ } }, "node_modules/side-channel": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.6.tgz", - "integrity": "sha512-fDW/EZ6Q9RiO8eFG8Hj+7u/oW+XrPTIChwCOM2+th2A6OblDtYYIpve9m+KvI9Z4C9qSEXlaGR6bTEYHReuglA==", + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.1.1.tgz", + "integrity": "sha512-6x6dK6zJdpTzF4sQeNYxwtvBzf6Eg4GtlesS94HOvTudUeyK2WXAaIfmDgsyslYrRBeFIlsi54AYsFGUuhmvrQ==", + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "object-inspect": "^1.13.4", + "side-channel-list": "^1.0.1", + "side-channel-map": "^1.0.1", + "side-channel-weakmap": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/side-channel-list": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/side-channel-list/-/side-channel-list-1.0.1.tgz", + "integrity": "sha512-mjn/0bi/oUURjc5Xl7IaWi/OJJJumuoJFQJfDDyO46+hBWsfaVM65TBHq2eoZBhzl9EchxOijpkbRC8SVBQU0w==", + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "object-inspect": "^1.13.4" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/side-channel-map": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/side-channel-map/-/side-channel-map-1.0.1.tgz", + "integrity": "sha512-VCjCNfgMsby3tTdo02nbjtM/ewra6jPHmpThenkTYh8pG9ucZ/1P8So4u4FGBek/BjpOVsDCMoLA/iuBKIFXRA==", + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.2", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.5", + "object-inspect": "^1.13.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/side-channel-weakmap": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/side-channel-weakmap/-/side-channel-weakmap-1.0.2.tgz", + "integrity": "sha512-WPS/HvHQTYnHisLo9McqBHOJk2FkHO/tlpvldyrnem4aeQp4hai3gythswg6p01oSoTl58rcpiFAjF2br2Ak2A==", "license": "MIT", "dependencies": { - "call-bind": "^1.0.7", + "call-bound": "^1.0.2", "es-errors": "^1.3.0", - "get-intrinsic": "^1.2.4", - "object-inspect": "^1.13.1" + "get-intrinsic": "^1.2.5", + "object-inspect": "^1.13.3", + "side-channel-map": "^1.0.1" }, "engines": { "node": ">= 0.4" @@ -8156,12 +8750,12 @@ } }, "node_modules/socks": { - "version": "2.8.3", - "resolved": "https://registry.npmjs.org/socks/-/socks-2.8.3.tgz", - "integrity": "sha512-l5x7VUUWbjVFbafGLxPWkYsHIhEvmF85tbIeFZWc8ZPtoMyybuEhL7Jye/ooC4/d48FgOjSJXgsF/AJPYCW8Zw==", + "version": "2.8.10", + "resolved": "https://registry.npmjs.org/socks/-/socks-2.8.10.tgz", + "integrity": "sha512-e0VyvkVTwVYViNovRkZ9aodhxVlyoMn7eJhVUPxZ+eK9P/7CBkxvvsBOHqFPEH416726W8tLXXXjKwqgTErrCQ==", "license": "MIT", "dependencies": { - "ip-address": "^9.0.5", + "ip-address": "^10.1.1", "smart-buffer": "^4.2.0" }, "engines": { @@ -8214,12 +8808,6 @@ "memory-pager": "^1.0.2" } }, - "node_modules/sprintf-js": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.1.3.tgz", - "integrity": "sha512-Oo+0REFV59/rz3gfJNKQiBlwfHaSESl1pcGyABQsnnIfWOFt6JNj5gCog2U6MLZ//IGYD+nA8nI+mTShREReaA==", - "license": "BSD-3-Clause" - }, "node_modules/stack-trace": { "version": "0.0.10", "resolved": "https://registry.npmjs.org/stack-trace/-/stack-trace-0.0.10.tgz", @@ -8270,17 +8858,14 @@ } }, "node_modules/streamx": { - "version": "2.20.2", - "resolved": "https://registry.npmjs.org/streamx/-/streamx-2.20.2.tgz", - "integrity": "sha512-aDGDLU+j9tJcUdPGOaHmVF1u/hhI+CsGkT02V3OKlHDV7IukOI+nTWAGkiZEKCO35rWN1wIr4tS7YFr1f4qSvA==", + "version": "2.28.1", + "resolved": "https://registry.npmjs.org/streamx/-/streamx-2.28.1.tgz", + "integrity": "sha512-zEzXb0s5Cds7tqMH6rhZ05lcJydCWiQPEwiNngVqzsxCc962vLY4Uw+mW7od8kDH258k2Uz/JrOkdIAAhSh9VA==", "license": "MIT", "dependencies": { + "events-universal": "^1.0.0", "fast-fifo": "^1.3.2", - "queue-tick": "^1.0.1", "text-decoder": "^1.1.0" - }, - "optionalDependencies": { - "bare-events": "^2.2.0" } }, "node_modules/string_decoder": { @@ -8365,6 +8950,82 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/superagent": { + "version": "10.4.2", + "resolved": "https://registry.npmjs.org/superagent/-/superagent-10.4.2.tgz", + "integrity": "sha512-u+PFV+VKiAKKzJqnCvveNya3N+pR/8jUZs/ek6jRfE41fpSCNdFY61L7NYmSgB6I9TTFM50ywoPXRKgw2k3wKw==", + "dev": true, + "license": "MIT", + "dependencies": { + "component-emitter": "^1.3.1", + "cookiejar": "^2.1.4", + "debug": "^4.3.7", + "fast-safe-stringify": "^2.1.1", + "form-data": "^4.0.6", + "formidable": "^3.5.4", + "methods": "^1.1.2", + "mime": "2.6.0", + "qs": "^6.17.1" + }, + "engines": { + "node": ">=14.18.0" + } + }, + "node_modules/superagent/node_modules/mime": { + "version": "2.6.0", + "resolved": "https://registry.npmjs.org/mime/-/mime-2.6.0.tgz", + "integrity": "sha512-USPkMeET31rOMiarsBNIHZKLGgvKc/LrjofAnBlOttf5ajRvqiRA8QsenbcooctK6d6Ts6aqZXBA+XbkKthiQg==", + "dev": true, + "license": "MIT", + "bin": { + "mime": "cli.js" + }, + "engines": { + "node": ">=4.0.0" + } + }, + "node_modules/superagent/node_modules/qs": { + "version": "6.17.1", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.17.1.tgz", + "integrity": "sha512-jd3COkaKVgGUW+ZHyEHCG9bH7RoaaiWuMgzsIBjUMVjLAaWGWpoUAVwljVvBHxRu/2qEHnadLGZrkutYUBPQJA==", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "es-define-property": "^1.0.1", + "side-channel": "^1.1.1" + }, + "engines": { + "node": ">=0.6" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/supertest": { + "version": "7.3.2", + "resolved": "https://registry.npmjs.org/supertest/-/supertest-7.3.2.tgz", + "integrity": "sha512-hR0dKRUE+PwZhHLdq/GRhf97HbUQte+AhbpWBQ9nh02tpjujVJj0GY4aygd1dAKdNZ7UZexWHpeItyJi/jLsgw==", + "dev": true, + "license": "MIT", + "dependencies": { + "cookie-signature": "^1.2.2", + "methods": "^1.1.2", + "superagent": "^10.4.1" + }, + "engines": { + "node": ">=14.18.0" + } + }, + "node_modules/supertest/node_modules/cookie-signature": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.2.2.tgz", + "integrity": "sha512-D76uU73ulSXrD1UXF4KE2TMxVVwhsnCgfAyTg9k8P6KGZjlXKrOLe4dJQKI3Bxi5wjesZoFXJWElNWBjPZMbhg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.6.0" + } + }, "node_modules/supports-color": { "version": "7.2.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", @@ -8569,22 +9230,62 @@ } }, "node_modules/tar-stream": { - "version": "3.1.7", - "resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-3.1.7.tgz", - "integrity": "sha512-qJj60CXt7IU1Ffyc3NJMjh6EkuCFej46zUqJ4J7pqYlThyd9bO0XBTmcOIhSzZJVWfsLks0+nle/j538YAW9RQ==", + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-3.2.2.tgz", + "integrity": "sha512-+8NeqHRjQWH9nYlwo2gamAMImZCVzI4UoEgDpWorBt9OEfppiZn+uSkskzQKPWIZyji/C8fpWO7u69G0DX0tbg==", "license": "MIT", "dependencies": { - "b4a": "^1.6.4", - "fast-fifo": "^1.2.0", - "streamx": "^2.15.0" + "b4a": "^1.9.0", + "bare-fs": "^4.8.2", + "fast-fifo": "^1.3.2", + "streamx": "^2.28.1" + } + }, + "node_modules/tar-stream/node_modules/bare-fs": { + "version": "4.8.4", + "resolved": "https://registry.npmjs.org/bare-fs/-/bare-fs-4.8.4.tgz", + "integrity": "sha512-MPC2eyrpbk3A873sK4y6rk+Iv4o2enxTjHZ8zH3HO0mjrpm5XjnguY2XmfidIsDV6vnjpbMBKUAJpV0ISD2SsQ==", + "license": "Apache-2.0", + "dependencies": { + "bare-events": "^2.5.4", + "bare-path": "^3.0.0", + "bare-stream": "^2.6.4", + "bare-url": "^2.2.2", + "fast-fifo": "^1.3.2" + }, + "engines": { + "bare": ">=1.28.0" + }, + "peerDependencies": { + "bare-buffer": "*" + }, + "peerDependenciesMeta": { + "bare-buffer": { + "optional": true + } } }, + "node_modules/tar-stream/node_modules/bare-path": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/bare-path/-/bare-path-3.1.3.tgz", + "integrity": "sha512-8r+FVU/o4zcFmpCDqbqAYhHHbtXPP+cyZKo7DRGRWc7OLlNs4TMaSQEpXL/sIdzyEG0M7RHw4B7xYMGrTc+qrg==", + "license": "Apache-2.0" + }, "node_modules/tar/node_modules/yallist": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", "license": "ISC" }, + "node_modules/teex": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/teex/-/teex-1.0.1.tgz", + "integrity": "sha512-eYE6iEI62Ni1H8oIa7KlDU6uQBtqr4Eajni3wX7rpfXD8ysFx8z0+dri+KWEPWpBsxXfxu58x/0jvTVT1ekOSg==", + "license": "MIT", + "dependencies": { + "streamx": "^2.12.5" + } + }, "node_modules/test-exclude": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/test-exclude/-/test-exclude-6.0.0.tgz", diff --git a/package.json b/package.json index 28ff8bd3..809f6cfb 100644 --- a/package.json +++ b/package.json @@ -67,11 +67,14 @@ "@types/multer": "^2.2.0", "@types/node": "^20.14.12", "@types/pdf-parse": "^1.1.5", + "@types/supertest": "^7.2.1", "@types/swagger-jsdoc": "^6.0.4", "@types/swagger-ui-express": "^4.1.8", "eslint": "^9.39.5", "jest": "^29.7.0", + "mongodb-memory-server": "^11.3.0", "nodemon": "^3.1.0", + "supertest": "^7.3.2", "ts-jest": "^29.2.5", "ts-node": "^10.9.2", "tsconfig-paths": "^4.2.0", diff --git a/src/__tests__/integration/auth.http.test.ts b/src/__tests__/integration/auth.http.test.ts new file mode 100644 index 00000000..8603c92b --- /dev/null +++ b/src/__tests__/integration/auth.http.test.ts @@ -0,0 +1,124 @@ +import mongoose from 'mongoose'; +import request from 'supertest'; +import { MongoMemoryServer } from 'mongodb-memory-server'; +import type { Express } from 'express'; + +import { createApp } from '@/server'; +import { isRedisAvailable } from '@/services/redis'; +import { Candidate } from '@/models'; +import Profile from '@/models/profile.model'; +import { memStore } from '@/middlewares/rateLimit.middleware'; + +jest.mock('@/logger'); + +const PASSWORD = 'Str0ng!Passw0rd'; + +let mongo: MongoMemoryServer; +let app: Express; + +const register = (email: string) => request(app).post('/api/v1/auth/register').send({ email, password: PASSWORD, repassword: PASSWORD }); + +const login = async (email: string) => { + const res = await request(app).post('/api/v1/auth/login').send({ email, password: PASSWORD }); + expect(res.status).toBe(200); + return { token: res.body.data.token as string, tokenRefresh: res.body.data.tokenRefresh as string, cookies: res.headers['set-cookie'] as unknown as string[] }; +}; + +const getProfiles = (token: string) => request(app).get('/api/v1/profile').set('Authorization', `Bearer ${token}`); + +beforeAll(async () => { + mongo = await MongoMemoryServer.create(); + await mongoose.connect(mongo.getUri()); + app = createApp(); + + // One user per flow: access tokens carry no jti, so a same-second login would mint a token another flow already blacklisted. + const results = await Promise.all(['alice@example.com', 'bob@example.com', 'carol@example.com', 'dave@example.com'].map(register)); + expect(results.map((r) => r.status)).toEqual([201, 201, 201, 201]); +}, 120_000); + +afterAll(async () => { + await mongoose.disconnect(); + await mongo.stop(); +}); + +// Every request comes from 127.0.0.1, so without this the flows share one 10-request authLimiter bucket. +beforeEach(() => memStore.clear()); + +afterEach(() => jest.restoreAllMocks()); + +it('runs with Redis absent (in-memory blacklist/revocation fallback)', () => { + expect(isRedisAvailable()).toBe(false); +}); + +it('register → login → authenticated GET → refresh → logout, then the logged-out token is rejected', async () => { + const first = await login('alice@example.com'); + expect((await getProfiles(first.token)).status).toBe(200); + + const refreshed = await request(app).post('/api/v1/auth/refresh').send({ refreshToken: first.tokenRefresh }); + expect(refreshed.status).toBe(200); + const { token, tokenRefresh } = refreshed.body.data as { token: string; tokenRefresh: string }; + expect((await getProfiles(token)).status).toBe(200); + + const logout = await request(app).post('/api/v1/auth/logout').set('Authorization', `Bearer ${token}`).send({ refreshToken: tokenRefresh }); + expect(logout.status).toBe(200); + + const after = await getProfiles(token); + expect(after.status).toBe(401); + expect(after.body.error.code).toBe('TOKEN_REVOKED'); + + const refreshAfter = await request(app).post('/api/v1/auth/refresh').send({ refreshToken: tokenRefresh }); + expect(refreshAfter.status).toBe(401); + expect(refreshAfter.body.error.code).toBe('TOKEN_REVOKED'); +}); + +it('reusing a rotated refresh token after the 10s grace window revokes every session', async () => { + const session = await login('bob@example.com'); + const rotated = await request(app).post('/api/v1/auth/refresh').send({ refreshToken: session.tokenRefresh }); + expect(rotated.status).toBe(200); + const { token: newToken, tokenRefresh: newRefresh } = rotated.body.data as { token: string; tokenRefresh: string }; + + const realNow = Date.now.bind(Date); + jest.spyOn(Date, 'now').mockImplementation(() => realNow() + 11_000); + + const reuse = await request(app).post('/api/v1/auth/refresh').send({ refreshToken: session.tokenRefresh }); + expect(reuse.status).toBe(401); + expect(reuse.body.error.code).toBe('TOKEN_REVOKED'); + + // Both the original and the freshly rotated access token predate the revocation. + expect((await getProfiles(session.token)).status).toBe(401); + expect((await getProfiles(newToken)).status).toBe(401); + + const refreshWithRotated = await request(app).post('/api/v1/auth/refresh').send({ refreshToken: newRefresh }); + expect(refreshWithRotated.status).toBe(401); + expect(refreshWithRotated.body.error.code).toBe('TOKEN_REVOKED'); +}); + +it('rejects a cookie-only state-changing request without the CSRF header', async () => { + const { cookies } = await login('carol@example.com'); + + const res = await request(app).post('/api/v1/profile/create').set('Cookie', cookies).send({ _id: null, name: 'No CSRF' }); + expect(res.status).toBe(403); + expect(res.body.error.code).toBe('CSRF_TOKEN_INVALID'); + expect(await Profile.countDocuments({ name: 'No CSRF' })).toBe(0); +}); + +it('ignores a client-supplied candidateId (IDOR)', async () => { + const { token } = await login('dave@example.com'); + const dave = await Candidate.findOne({ email: 'dave@example.com' }); + const bob = await Candidate.findOne({ email: 'bob@example.com' }); + + const res = await request(app) + .post('/api/v1/profile/create') + .set('Authorization', `Bearer ${token}`) + .send({ _id: null, name: 'Spoofed owner', candidateId: String(bob?._id) }); + expect(res.status).toBe(201); + + const created = await Profile.findOne({ name: 'Spoofed owner' }); + expect(String(created?.candidateId)).toBe(String(dave?._id)); +}); + +it('answers an unknown route with 404 in the standard error shape', async () => { + const res = await request(app).get('/api/v1/does-not-exist'); + expect(res.status).toBe(404); + expect(res.body).toEqual({ success: false, error: expect.objectContaining({ code: 'ROUTE_NOT_FOUND', message: expect.any(String) }) }); +}); diff --git a/src/server.ts b/src/server.ts index bd237536..58230922 100644 --- a/src/server.ts +++ b/src/server.ts @@ -25,12 +25,8 @@ import { moveLegacyCvUploads } from '@/middlewares/uploadCV.middleware'; dotenv.config(); -// Last safety net: Node ≥15 exits on an unhandled rejection; asyncHandler should make this unreachable. -process.on('unhandledRejection', (reason) => { - logger.error('Unhandled promise rejection', { error: reason instanceof Error ? reason.message : String(reason), stack: reason instanceof Error ? reason.stack : undefined }); -}); - -const runServer = async ({ portNumber }: { portNumber: number }) => { +/** The full middleware chain without listen/Redis/cleanup side effects, so the HTTP integration tests can drive it through supertest. */ +export const createApp = () => { const app = express(); // req.ip (rate-limit key) must be the real client, not Render's proxy. @@ -97,6 +93,12 @@ const runServer = async ({ portNumber }: { portNumber: number }) => { app.use(notFoundHandler); app.use(errorsMiddleware); + return app; +}; + +const runServer = async ({ portNumber }: { portNumber: number }) => { + const app = createApp(); + const _env = process.env['NODE_ENV'] || 'development'; /** * Respect LOCAL_PORT whenever it's actually set, in every environment — @@ -147,4 +149,11 @@ const startServer = async () => { } }; -startServer(); +// Importing this module (tests) must not connect to Mongo, bind a port or install process-wide handlers. +if (require.main === module) { + // Last safety net: Node ≥15 exits on an unhandled rejection; asyncHandler should make this unreachable. + process.on('unhandledRejection', (reason) => { + logger.error('Unhandled promise rejection', { error: reason instanceof Error ? reason.message : String(reason), stack: reason instanceof Error ? reason.stack : undefined }); + }); + void startServer(); +}