Repository navigation
Phase 14 security hardening - #12
Merged
Merged
Conversation
…visories - Bump drizzle-orm 0.36.4 -> 0.45.2 (fixes SQL injection via improperly escaped identifiers, OWA-001-relevant, direct prod dependency). - Bump file-type 16.5.4 -> 21.3.4 (fixes DoS via malformed input). - Add pnpm.overrides forcing multer >=2.2.0 (fixes 3 DoS advisories) and lodash >=4.18.0 (code injection + prototype pollution, transitive via @nestjs/config); a plain package.json bump can't win here because @nestjs/platform-express@10.4.22 pins multer to the exact version 2.0.2. - file-type v17+ is ESM-only while this project compiles to CommonJS, so add server/src/core/storage/sniff-mime-type.ts wrapping the sniff call in a dynamic import(); update knowledge.controller.ts's upload handler to use it instead of a static import. - v21 also renamed fromBuffer -> fileTypeFromBuffer and now validates the IHDR chunk instead of trusting the bare 8-byte PNG signature; update the evidence-upload e2e test's PNG fixture to a structurally valid PNG. pnpm audit --prod --audit-level=high on server: 0 high/critical (was 6 high before this commit). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
- Bump next 16.2.10 -> ^16.2.11 (resolves to 16.3.4), fixing 4 high advisories including SSRF in Server Actions/rewrites and a middleware/proxy bypass. - Add pnpm.overrides forcing sharp >=0.35.0 (libvips CVEs), postcss >=8.5.18, nanoid >=3.3.18, browserslist >=4.28.7 -- safe patch-level fixes for Tailwind/PostCSS/webpack build-tool-chain transitive deps. pnpm audit --prod --audit-level=high on client: 0 high/critical (was 10 high before this commit). typecheck, lint, test (166 tests), and build all pass unchanged. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
- Add a security:audit script (pnpm audit --prod --audit-level=high) to
both server/package.json and client/package.json.
- Add .github/workflows/security-audit.yml running both on push/PR to
main. No CI existed at all before this commit; this is the minimum
needed to satisfy SEC-022 ('automated dependency vuln scanning in CI').
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…t (SEC-017) env.schema.ts previously validated NVIDIA_API_BASE_URL with a bare z.string().url(), so any host would pass -- a compromised or misconfigured deployment could point the AI Assistant's API key and every prompt/response at an arbitrary host. Add a superRefine restricting the hostname to nvidia.com or a *.nvidia.com subdomain, enforced only when NVIDIA_API_KEY is actually set so the existing 'optional feature still boots gracefully' contract (documented SEC-017 deviation) is preserved when the whole assistant feature is unconfigured. Deferred from Phase 11's security review to Phase 14 per Progress.md. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Default URL passes with the key set, an off-allow-list host is rejected only when NVIDIA_API_KEY is present, the URL stays permissive when the key is unset (feature-disabled contract preserved), and any *.nvidia.com subdomain is accepted. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
… routes (SEC-034) app/api/auth/refresh and app/api/auth/logout are the only two BFF routes that are both cookie-authenticated (read the httpOnly refresh_token cookie) and state-changing; the NestJS backend itself is bearer-token-only and isn't CSRF-exposed. SameSite=Lax on the cookie (auth-cookies.ts) is already a partial mitigation but doesn't cover every case, and no Origin/Referer check existed at all. Add lib/csrf.ts's assertTrustedOrigin(request), checking Origin (falling back to Referer) against the request's own origin and returning a 403 on mismatch. A request with neither header present is let through -- SameSite=Lax already covers that gap and rejecting risks breaking legitimate same-origin requests from clients that omit both headers. Wire it into both routes as an early return before any cookie/token logic. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
First tests for these two route handlers. Covers: cross-origin Origin rejected 403 before the backend is touched, cross-origin Referer rejected when Origin is absent, same-origin proceeds and preserves existing behavior (401 on missing cookie, cookie rotation on success, unconditional cookie clearing on logout), and a request with neither header is let through per the documented SameSite=Lax fallback. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…dapters (EXE-002, OWA-006) Batteries a set of classic shell-metacharacter payloads (;, |, &&, backticks, $(), newlines) against every free-text-shaped input on the Nmap, ffuf, and Nuclei adapters -- target and each tool option -- proving the Zod allow-list schemas reject every one via InvalidInputError before buildInvocation ever constructs the args array that's handed to child_process/Docker. Also confirms the enum-based options (ffuf wordlist, Nuclei tags) can't be used to smuggle a payload past validation. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Extend jwt-auth.guard.test.ts with: a token forged with the wrong secret, a valid token whose payload segment was swapped post-signing (signature no longer matches), and a structurally malformed token -- all rejected with UnauthorizedError, alongside the existing expired-token case. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…A-001) Creates a project whose name is a classic injection payload (Robert'); DROP TABLE projects;--) against a real Postgres instance and proves Drizzle's parameterized queries store and return it as inert string data -- the table and every prior row in the suite survive intact. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…storage (SEC-051, OWA-005) resolveRef() already rejected the two basic traversal cases; extend coverage with an absolute Unix path, a Windows-style absolute path, traversal embedded inside an otherwise well-formed-looking ref, a null byte suffix, a too-short/long fake hash, and a positive check that a structurally valid ref resolves inside the storage root (ENOENT, not an escape) rather than merely 'anything invalid is rejected'. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Alex350-coder
added a commit
that referenced
this pull request
Sep 8, 2026
… (BUG #12) useProjects() called apiRequestPaginated("/projects") with no pageSize, so the server defaulted to DEFAULT_PAGE_SIZE=25 (repository.types.ts). The hook then discarded the response's pagination `meta` entirely, and ProjectList has no "load more"/pager UI -- so an account with more than 25 projects silently lost access to the 26th+ project from the Projects page. No error, no count, no indicator that more existed. Reproduced live: created 26 test projects via the API (27 total), reloaded /app, and confirmed only 25 rendered with zero way to reach the rest through the UI. Fixed by requesting the server's hard cap (MAX_PAGE_SIZE=100) instead of relying on the default. This resolves the reported symptom for any realistic project count; a true paginated/infinite-scroll UI for counts beyond 100 is tracked separately as the "add missing pagination/caching" work already scoped in Plan.md's hardening phase. The same apiRequestPaginated-with-discarded-meta pattern also appears in use-runs.ts, use-evidence.ts, use-reports.ts, and use-project-members.ts; none were reproduced as broken via the browser in this pass, so they're flagged for the same follow-up rather than changed speculatively here. Verified live: created 26 test projects (27 total), confirmed all 27 now render after the fix, then deleted the 26 test projects via the API to restore the account to its prior state (Debug Test only). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Alex350-coder
added a commit
that referenced
this pull request
Sep 8, 2026
…bling) use-runs.ts, use-evidence.ts, use-reports.ts, and use-project-members.ts all called apiRequestPaginated without a pageSize param, so the server silently truncated results at DEFAULT_PAGE_SIZE=25. None of the corresponding UIs (RunsList, EvidenceGrid, reports list, MembersPanel) have pager/load-more controls, so any project with more than 25 runs, evidence files, reports, or members would silently lose access to the rest with zero indication -- the exact same root cause already fixed in use-projects.ts under BUG #12. Applied the identical fix: request the server's hard cap (?pageSize=100) instead of relying on the default. Updated each hook's existing test to assert the corrected URL and added coverage where a query param already existed (evidence's nodeId case). Full client suite verified green: 63 files / 190 tests passing. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.